arch: imx6: add support kernel build and smp
Summary: - add support BUILD_KERNEL and SMP for imx6 - prepare page tables of cpu1,2,3 - add sabre-6quad:knsh_smp config Impact: - imx6 Testing: - getprime, smp on sabre-6quad:knsh_smp w/ qemu Signed-off-by: Oki Minabe <minabe.oki@gmail.com>
This commit is contained in:
parent
d9e95a8f9b
commit
f0fb530eaa
@ -637,7 +637,11 @@
|
||||
*/
|
||||
|
||||
#define PGTABLE_SIZE 0x00004000
|
||||
#define ALL_PGTABLE_SIZE (PGTABLE_SIZE * CONFIG_SMP_NCPUS)
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define ALL_PGTABLE_SIZE (PGTABLE_SIZE * CONFIG_SMP_NCPUS)
|
||||
#else
|
||||
# define ALL_PGTABLE_SIZE PGTABLE_SIZE
|
||||
#endif
|
||||
|
||||
/* Virtual Page Table Location **********************************************/
|
||||
|
||||
|
@ -814,10 +814,10 @@
|
||||
|
||||
# ifdef CONFIG_ARCH_LOWVECTORS
|
||||
|
||||
/* In this case, page table must lie at the top 16Kb of OCRAM. */
|
||||
/* In this case, page table must lie at the top 16Kb * ncpus of OCRAM. */
|
||||
|
||||
# define PGTABLE_BASE_PADDR (IMX_OCRAM_PBASE + IMX_OCRAM_SIZE - PGTABLE_SIZE)
|
||||
# define PGTABLE_BASE_VADDR (IMX_OCRAM_VBASE + IMX_OCRAM_SIZE - PGTABLE_SIZE)
|
||||
# define PGTABLE_BASE_PADDR (IMX_OCRAM_PBASE + IMX_OCRAM_SIZE - ALL_PGTABLE_SIZE)
|
||||
# define PGTABLE_BASE_VADDR (IMX_OCRAM_VBASE + IMX_OCRAM_SIZE - ALL_PGTABLE_SIZE)
|
||||
# define PGTABLE_IN_HIGHSRAM 1
|
||||
|
||||
/* We will force the IDLE stack to precede the page table */
|
||||
@ -829,7 +829,7 @@
|
||||
|
||||
/* Otherwise, the vectors lie at another location (perhaps in NOR FLASH,
|
||||
* perhaps elsewhere in OCRAM). The page table will then be positioned
|
||||
* at the first 16Kb of SRAM.
|
||||
* at the first 16Kb * ncpus of SRAM.
|
||||
*/
|
||||
|
||||
# define PGTABLE_BASE_PADDR IMX_OCRAM_PBASE
|
||||
@ -838,8 +838,8 @@
|
||||
|
||||
/* We will force the IDLE stack to follow the page table */
|
||||
|
||||
# define IDLE_STACK_PBASE (PGTABLE_BASE_PADDR + PGTABLE_SIZE)
|
||||
# define IDLE_STACK_VBASE (PGTABLE_BASE_VADDR + PGTABLE_SIZE)
|
||||
# define IDLE_STACK_PBASE (PGTABLE_BASE_PADDR + ALL_PGTABLE_SIZE)
|
||||
# define IDLE_STACK_VBASE (PGTABLE_BASE_VADDR + ALL_PGTABLE_SIZE)
|
||||
|
||||
# endif /* CONFIG_ARCH_LOWVECTORS */
|
||||
|
||||
@ -884,8 +884,8 @@
|
||||
|
||||
/* We will force the IDLE stack to follow the page table */
|
||||
|
||||
# define IDLE_STACK_PBASE (PGTABLE_BASE_PADDR + PGTABLE_SIZE)
|
||||
# define IDLE_STACK_VBASE (PGTABLE_BASE_VADDR + PGTABLE_SIZE)
|
||||
# define IDLE_STACK_PBASE (PGTABLE_BASE_PADDR + ALL_PGTABLE_SIZE)
|
||||
# define IDLE_STACK_VBASE (PGTABLE_BASE_VADDR + ALL_PGTABLE_SIZE)
|
||||
|
||||
#endif /* !PGTABLE_BASE_PADDR || !PGTABLE_BASE_VADDR */
|
||||
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "smp.h"
|
||||
#include "scu.h"
|
||||
#include "gic.h"
|
||||
#include "mmu.h"
|
||||
#include "barriers.h"
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
@ -205,6 +207,14 @@ void imx_cpu_enable(void)
|
||||
|
||||
for (cpu = 1; cpu < CONFIG_SMP_NCPUS; cpu++)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Copy cpu0 page table to each cpu. */
|
||||
|
||||
memcpy((uint32_t *)(PGTABLE_BASE_VADDR + PGTABLE_SIZE * cpu),
|
||||
(uint32_t *)PGTABLE_BASE_VADDR, PGTABLE_SIZE);
|
||||
ARM_DSB();
|
||||
#endif
|
||||
|
||||
/* Set the start up address */
|
||||
|
||||
regaddr = g_cpu_gpr[cpu];
|
||||
|
@ -940,3 +940,53 @@ Configuration sub-directories
|
||||
thread #0 finished, found 1230 primes, last one was 9973
|
||||
Done
|
||||
/system/bin/getprime took 1850 msec
|
||||
|
||||
knsh_smp
|
||||
--------
|
||||
This is a configuration of testing the BUILD_KERNEL and SMP configuration.
|
||||
|
||||
$ cd nuttx
|
||||
$ ./tools/configure.sh sabre-6quad:knsh_smp
|
||||
$ make
|
||||
$ make export
|
||||
$ cd ../apps
|
||||
$ ./tools/mkimport.sh -x ../nuttx/nuttx-export-*.zip
|
||||
$ make import
|
||||
$ cd ../nuttx
|
||||
$ qemu-system-arm -semihosting -M sabrelite -m 1024 -smp 4 -nographic -kernel ./nuttx
|
||||
|
||||
NuttShell (NSH) NuttX-10.3.0-RC2
|
||||
nsh> uname -a
|
||||
NuttX 10.3.0-RC2 d9e95a8f9b-dirty May 26 2022 23:39:42 arm sabre-6quad
|
||||
nsh> ps
|
||||
PID GROUP CPU PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
|
||||
0 0 0 0 FIFO Kthread N-- Assigned 00000000 002024 000880 43.4% CPU0 IDLE
|
||||
1 1 1 0 FIFO Kthread N-- Running 00000000 002024 000664 32.8% CPU1 IDLE
|
||||
2 2 2 0 FIFO Kthread N-- Running 00000000 002024 000664 32.8% CPU2 IDLE
|
||||
3 3 3 0 FIFO Kthread N-- Running 00000000 002024 000664 32.8% CPU3 IDLE
|
||||
4 4 0 100 RR Task --- Running 00000000 004064 001116 27.4% /system/bin/init
|
||||
nsh> free
|
||||
total used free largest nused nfree
|
||||
Umem: 1048224 5872 1042352 1036256 9 2
|
||||
Kmem: 1065247648 12800 1065234848 1065234768 45 3
|
||||
Page: 134217728 1101824 133115904 133115904
|
||||
nsh> hello
|
||||
Hello, World!!
|
||||
nsh> getprime 4
|
||||
Set thread priority to 10
|
||||
Set thread policy to SCHED_RR
|
||||
Start thread #0
|
||||
Start thread #1
|
||||
thread #1 started, looking for primes < 10000, doing 10 run(s)
|
||||
Start thread #2
|
||||
thread #2 started, looking for primes < 10000, doing 10 run(s)
|
||||
Start thread #3
|
||||
thread #3 started, looking for primes < 10000, doing 10 run(s)
|
||||
thread #0 started, looking for primes < 10000, doing 10 run(s)
|
||||
thread #1 finished, found 1230 primes, last one was 9973
|
||||
thread #2 finished, found 1230 primes, last one was 9973
|
||||
thread #3 finished, found 1230 primes, last one was 9973
|
||||
thread #0 finished, found 1230 primes, last one was 9973
|
||||
Done
|
||||
getprime took 1570 msec
|
||||
nsh>
|
||||
|
87
boards/arm/imx6/sabre-6quad/configs/knsh_smp/defconfig
Normal file
87
boards/arm/imx6/sabre-6quad/configs/knsh_smp/defconfig
Normal file
@ -0,0 +1,87 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_ADDRENV=y
|
||||
CONFIG_ARCH_BOARD="sabre-6quad"
|
||||
CONFIG_ARCH_BOARD_SABRE_6QUAD=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="imx6"
|
||||
CONFIG_ARCH_CHIP_IMX6=y
|
||||
CONFIG_ARCH_CHIP_IMX6_6QUAD=y
|
||||
CONFIG_ARCH_DATA_NPAGES=256
|
||||
CONFIG_ARCH_DATA_VBASE=0x80100000
|
||||
CONFIG_ARCH_HEAP_NPAGES=256
|
||||
CONFIG_ARCH_HEAP_VBASE=0x80200000
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_IRQBUTTONS=y
|
||||
CONFIG_ARCH_KERNEL_STACKSIZE=3072
|
||||
CONFIG_ARCH_LOWVECTORS=y
|
||||
CONFIG_ARCH_PGPOOL_MAPPING=y
|
||||
CONFIG_ARCH_PGPOOL_PBASE=0x18000000
|
||||
CONFIG_ARCH_PGPOOL_SIZE=134217728
|
||||
CONFIG_ARCH_PGPOOL_VBASE=0x18000000
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_TEXT_NPAGES=256
|
||||
CONFIG_ARCH_TEXT_VBASE=0x80000000
|
||||
CONFIG_ARM_SEMIHOSTING_HOSTFS=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=99369
|
||||
CONFIG_BOOT_RUNFROMSDRAM=y
|
||||
CONFIG_BUILD_KERNEL=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE=4096
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_ELF=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FS_HOSTFS=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_IMX6_DDRCS_PGHEAP_OFFSET=0x08000000
|
||||
CONFIG_IMX6_DDRCS_PGHEAP_SIZE=134217728
|
||||
CONFIG_IMX6_UART1=y
|
||||
CONFIG_IMX_DDR_SIZE=1073741824
|
||||
CONFIG_INIT_FILEPATH="/system/bin/init"
|
||||
CONFIG_INIT_MOUNT=y
|
||||
CONFIG_INIT_MOUNT_DATA="fs=../apps"
|
||||
CONFIG_INIT_MOUNT_FLAGS=0x1
|
||||
CONFIG_INIT_MOUNT_FSTYPE="hostfs"
|
||||
CONFIG_INIT_MOUNT_SOURCE=""
|
||||
CONFIG_INIT_MOUNT_TARGET="/system"
|
||||
CONFIG_INIT_STACKSIZE=3072
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_ENVPATH=y
|
||||
CONFIG_LIBC_EXECFUNCS=y
|
||||
CONFIG_MM_PGALLOC=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_FILE_APPS=y
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PATH_INITIAL="/system/bin"
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=1073741824
|
||||
CONFIG_RAM_START=0x10000000
|
||||
CONFIG_RAM_VSTART=0x10000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_MONTH=5
|
||||
CONFIG_START_YEAR=2022
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSLOG_TIMESTAMP=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_PROGNAME="init"
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_SMP=y
|
||||
CONFIG_UART1_SERIAL_CONSOLE=y
|
Loading…
Reference in New Issue
Block a user