Commit Graph

330 Commits

Author SHA1 Message Date
Bowen Wang
bf5c571098 arm64/qemu_boot: add arm64 pci io memory map
and rename other pci region name to make them more
readable

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-10 14:34:31 +08:00
Bowen Wang
b12fa7f760 qemu_boot: change IVSHMEM memory region to PCI memory region
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-10 14:34:31 +08:00
Bowen Wang
99876fa529 arm64/mmu_region: add ivshmem mmu region for arm64
Now the ivhsmem memory region can be used in arm64

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-10 14:34:31 +08:00
yangshuyong
6a09037efd arm64/qemu_boot: add the pcie cfg address for arm64
1. Extend the arm64 address to 48bit;
2. Add pci cfg address to the mmu map table;

Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-10 14:34:31 +08:00
hujun5
608b59e401 smp: enable smp_call in all smp arch
reason:
In subsequent implementations, we will replace up_cpu_pause with smp_call.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-06 07:11:38 +09:00
hujun5
198630a809 sched: use this_task replace nxsched_self
reason:
We can reduce a function call to improve performance.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-05 09:33:50 -03:00
fangxinyong
7b05a550dc sched: replace up_cpu_index with this_cpu
Make this_cpu is arch independent and up_cpu_index do that.
In AMP mode, up_cpu_index() may return the index of the physical core.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-09-05 12:09:24 +08:00
chao an
6098747c4f arm/giv3: add g_ prefix to some global variables
Signed-off-by: chao an <anchao@lixiang.com>
2024-09-05 09:58:21 +08:00
hujun5
433f159c06 arch: remove unused up_cpu_pausereq waiting
reason:
After the up_cpu_pause call completes, it guarantees that other CPUs have fully stopped.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-05 07:15:54 +09:00
chao an
b15c1a441a arm/gicv3: set routing affinity before enable IRQ
In corner case, the pending ISR will be triggered immediately
after enable the IRQ, this PR will setting CPU affinity first
to avoid routing the unexpected IRQ to other CPUs.

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-03 19:14:14 -03:00
Ville Juven
23e0bf5953 imx9_usdhc.c: Fix build error when CONFIG_ARM64_DCACHE_DISABLE=y
priv->rxbuffer does not exist when CONFIG_ARM64_DCACHE_DISABLE=y so
references to it will create a build error -> flag / remove accesses
to it.
2024-08-30 01:13:26 +08:00
Ville Juven
a0a85e5c10 arch/arm64: Move ELF_64BIT selection to arch/Kconfig
Unify the elf file format for the whole arm64 architecture
2024-08-28 07:45:36 -04:00
Ville Juven
12ba2eeb23 arm64_checkstack.c: Fix traversing of user stack when ARCH_ADDRENV=Y
Need to instantiate the correct address environment when reading from
user stack, otherwise the result is very likely a crash
2024-08-27 21:34:43 +08:00
Ville Juven
963c5e8e52 arm64/imx9: Force 64-bit ELF format
The format is always 64-bits
2024-08-27 07:39:26 -04:00
hujun5
1d6a099180 irq: remove restore_critical_section in irq
Only in the non-critical region, nuttx can the respond to the irq and not hold the lock
When returning from the irq, there is no need to check whether the lock needs to be released
we also need keep restore_critical_section in svc call

test:
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-08-25 21:14:19 +08:00
Petro Karashchenko
d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Petro Karashchenko
f40b09cbc9 style: remove redundant spaces
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Ville Juven
29f8648ecc arm64: Initial implementation of CONFIG_BUILD_KERNEL
This is the initial version for kernel mode build on the arm64 platform.
It works much in the same way as the risc-v implementation so any
highlights can be read from there.

Features that have been tested working:
- Creating address environments
- Loading init (nsh) from elf file
- Booting to nsh
- Starting other processes from nsh
- ostest runs to completion

Features that are not tested / do not work:
- SHM / shared memory support
- Kernel memory mapping (MM_KMAP)
- fork/vfork

An example qemu target is provided as a separate patch:
tools/configure.sh qemu-armv8a:knsh
2024-08-23 10:26:34 -03:00
Ville Juven
7f228b1554 arm64/barriers.h: Generalize barrier macros
Make it possible to define arguments for barriers
2024-08-23 10:26:34 -03:00
Ville Juven
52781221b3 arm64_sync_exc: Use temporaries x9/x10 instead of x0/x1
Why? Because this allows optimizing the user system call path in such
a way that the parameter registers don't have to be read from the saved
integer register context when the system call is executed.
2024-08-23 10:26:34 -03:00
chenrun1
62f598e547 arm_mpu:Reentrant allocation Region
Changes have been completed:
1.armv7m
2.armv8m
3.armv7r
4.arm64

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:58:46 +08:00
hujun5
4cb419866f arch: inline up_testset in arm arm64 riscv xtensa
test:
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-08-21 01:45:10 +08:00
xuxin19
9fdd299d32 cmake:split the archive process to avoid parameter problems
refer to:https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_ARCHIVE_APPEND.html

this will solve the problem of too long parameters
when executing ar in cygwin environment such as msys.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-18 23:26:01 +08:00
Jouni Ukkonen
9c2af7284b arch/arm64/imx93: Add more base addresses
mem slice and src base address added

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-08-16 19:39:02 +08:00
chenxiaoyi
7ce5241f0e types.h: fix windows build error
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(605,39): error C2371: 'wint_t': redefinition; different basic types
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(606,39): error C2371: 'wctype_t': redefinition; different basic types

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
yanghuatao
fecc5091af toolchain/ghs: Fix SP_DSB warnings
"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 252: warning #76-D:
          argument to macro is empty
        SP_DSB();
               ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 261: warning #76-D:
          argument to macro is empty
    SP_DMB();
           ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 252: warning #76-D:
          argument to macro is empty
        SP_DSB();
               ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 261: warning #76-D:
          argument to macro is empty
    SP_DMB();
           ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 296: warning #76-D:
          argument to macro is empty
        SP_DSB();
               ^

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-11 14:28:12 -03:00
zouboan
d74a612a6e zynq-mpsoc/zcu111: independent JTAG configs from normal nsh configs 2024-07-30 12:41:30 -03:00
buxiasen
f5021021ae up_backtrace: fix maybe backtrace the exiting thread
when the thread to backtrace is exiting, get_tcb and up_backtrace in
different critical section may cause try to dump invalid pointer, have
to ensure the nxsched_get_tcb and up_backtrace inside same critical
section procedure.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-07-26 12:03:43 +08:00
zouboan
b817db86b8 zynq-mpsoc: add support for mio/emio 2024-07-16 18:50:52 -03:00
zouboan
ae8ce535f3 arm64/arm64_boot.c: Fix exception caused by accesses to ICC_SRE_EL3 when GICv3 was not implemented 2024-07-15 02:26:40 +08:00
zouboan
ea532cb11a arch/arm64: add initial support for ZYNQ MPSOC
arch/arm64: add initial support for ZYNQ MPSOC

arch/arm64: add initial support for ZYNQ MPSOC
2024-07-13 20:51:39 -03:00
simbit18
f12c4e05cc Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
Replace help => ---help---
Remove extra TABs
2024-07-12 06:37:59 +08:00
Eero Nurkkala
48cf91a7be arm64/imx9: ccm: add default clk init
This adds enablers for setting various clocks to some default
values. Also, this provides helpers to grant nonsecure access
to a number of clocks. Bootloader may utilize these to make
the system boot in a deterministic manner.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2024-07-09 21:14:11 -03:00
xuxingliang
848eca04ca arch/arm64: allow to use custom idle
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-07-09 19:36:48 +08:00
xuxingliang
94387630c9 arch/arm64: remove not used idle trace
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-07-09 19:36:48 +08:00
Jukka Laitinen
b008653ac0 arch/arm64/src/imx9/imx9_lowputc.c: Fix an arithmetic sign error in divisor calculation
In the algorithm there is a subtraction (int - unsigned), which results (potentially overflowed)
unsigned.

Passing this to macro ABS and the assigning to int doesn't work ( unsigned is always >= 0 ).

Fix this by replacing (dangerous) ABS macro with stdlib's standard "int abs(int)"
and change the substraction to (int - int).

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-07-05 21:47:07 +08:00
Jukka Laitinen
31644ec0f5 arch/arm64/src/imx9: Add an mtd driver for NOR flash on FlexSPI interface
This is an initial FlexSPI SPI NOR MTD driver for IMX9

This supprts M25P SPI NOR on FlexSPI for now, and can later be extended to other
SPINOR devices if needed. The following configurations are needed to use this driver:
  CONFIG_IMX9_FLEXSPI_NOR=y
  CONFIG_MTD_M25P=y

In addition, board initialization logic needs to call the imx9_flexspi_nor_initialize
to receive a pointer to the mtd device.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Co-authored-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-07-05 21:46:47 +08:00
Jouni Ukkonen
31a6a4f5d0 imx9: Add flexspi support, ported from imxrt
Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-07-05 21:46:47 +08:00
Masayuki Ishikawa
04c19bb1c9 Revert "irq: remove restore_critical_section in irq"
This reverts commit f6a9e91057.
2024-07-02 15:46:20 +08:00
hujun5
80fdf95790 tee: smp support
During the boot phase, when we transition from tee smp to ap smp, we can use a busy waitflag to wait for the completion of the initialization of ap's core0

test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-07-02 13:31:41 +08:00
hujun5
f6a9e91057 irq: remove restore_critical_section in irq
Only in the non-critical region, nuttx can the respond to the irq and not hold the lock
When returning from the irq, there is no need to check whether the lock needs to be restored

test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-07-02 03:00:57 +08:00
xuxingliang
c6d712df0e sched: move nxsched_dumponexit() to task_exithook
So the tcb->group still exists to dump files.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-06-30 17:30:42 +08:00
hujun5
13bbea0f1c arm64: inline up_cpu_index
reduce the time consumed by function call

test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-06-28 21:29:33 +08:00
yanghuatao
7e342b3422 arch: Add --whole-archive linker option for some of architectures
Add Kconfig option that enable --whole-archive linker option for some of architectures

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-06-28 02:31:40 +08:00
hujun5
ed78646798 signal: fix deadlock when sigdeliver call enter_critical_section
cpu0                                 cpu1:

user_main
signest_test
sched_unlock
nxsched_merge_pending
nxsched_add_readytorun
up_cpu_pause
			             arm_sigdeliver
				     enter_critical_section

Reason:
In the SMP, cpu0 is already in the critical section and waiting for cpu1 to enter the suspended state.
However, when cpu1 executes arm_sigdeliver, it is in the irq-disabled state but not in the critical section.
At this point, cpu1 is unable to respond to interrupts and
is continuously attempting to enter the critical section, resulting in a deadlock.

Resolve:
adjust the logic, do not entering the critical section when interrupt-disabled.

test:
We can use qemu for testing.

compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-06-22 19:35:28 -03:00
wangming9
aabc458bcd arch/arm/psci: Fixed the poweroff command blocking problem.
Summary:
1. Delete redundant psci_cpu_reset interfaces
2. Adjust the correct interfaces for poweroff and reset

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2024-06-21 22:44:09 +08:00
Peter Bee
c429438f0d arch/arm: add up_systempoweroff()
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2024-06-21 22:44:09 +08:00
wangming9
914b8367ba arm64/qemu: The PSCI can be configured with CONFIG_ARM64_PSCI
Signed-off-by: wangming9 <wangming9@xiaomi.com>
2024-06-20 09:41:28 +08:00
wangming9
4422c26c78 arch/arm64: Change the ARM configuration to ARM64.Add ARM64_NEON configuration
Summary:
1. Change the ARM to ARM64
2. Add CONFIG_ARM64_NEON

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2024-06-20 09:41:28 +08:00
Xu Xingliang
caa94ef64b arch/arm64: make sure regs_context is aligned to 16
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-19 02:04:12 +08:00