Commit Graph

22581 Commits

Author SHA1 Message Date
Ville Juven 24c931c220 arm64_task/pthread_start: Set sp_el0 upon starting user process
As the handling of sp_el0 was moved from the context switch routine
to exception entry/exit, we must set sp_el0 explicitly when the user
process is first started.
2024-10-02 14:09:22 +08:00
lipengfei28 8e200e69d4 Kernel build: enter exception save sp_sl0,exit exception restroe sp_el0
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-02 14:09:22 +08:00
ligd c3da7c29e8 arm64: simply the vectors
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-02 14:09:22 +08:00
ligd 007399dd75 arm64: save FPU regs every time
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-02 14:09:22 +08:00
xuxin19 18b6b72240 cmake:fix windows build break
-U_WIN32 will cause windows host source such as sim_hostirq.c hearder windows.h exception

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-01 21:34:26 +08:00
xuxin19 b9dc9fb0fc cmake:refine SIM platform CMake Toolchain file
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-01 21:34:26 +08:00
cuiziwei 394a967263 nuttx/arch: Remove GCCVER and add compilation options directly.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-01 20:41:02 +08:00
xuxingliang 7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
yangguangcai 62d7b3beeb arm-v7m systick:call irq_attach_thread.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-10-01 12:26:07 +08:00
hujun5 c039ea77ba arm64: fix use arch-timer in SMP
reason:
only one timer will be effective at a time.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-01 12:10:06 +08:00
hujun5 ea29217442 arm64: fix tickless mode in SMP
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-01 12:10:06 +08:00
xuxingliang 060ac93f82 arm64: allow to use custom up_timer_initialize
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 12:10:06 +08:00
guoshichao ff4ad07576 greenhills: add cmake support
1. refactor the ghs/gcc/clang/armclang toolchain management in CMake
2. unify the cmake toolchain naming style
3. support greenhills build procedure with CMake
4. add protect build for greenhills and gnu toolchain with CMake

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-10-01 11:48:09 +08:00
hujun5 17b31d2037 xtensa: add parameters to xtensa_pause_handler
reason:
nxsched_smp_call_handler need these parameters

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-01 11:45:56 +08:00
hujun5 0e87a475d3 x86_64: we should call x86_64_restorestate/x86_64_savestate
reason:
In x86_64, g_current_regs is still used for context switching.

This commit fixes the regression from https://github.com/apache/nuttx/pull/13616

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-01 11:47:25 +09:00
Filipe Cavalcanti 8153307da5 espressif: remove static from spiflash operations 2024-09-30 20:42:00 +02:00
Filipe Cavalcanti b3d0dca84e xtensa/esp32: fix cpuint debug asssertion bit mask 2024-09-30 20:42:00 +02:00
Filipe Cavalcanti a876f00e2a risc-v/espressif: support marking interrupt as running from IRAM 2024-09-30 20:42:00 +02:00
Kevin Zhou 7acb298f26 xtensa/esp32s3: add setup rx dma after slave receive data 2024-09-30 21:24:55 +08:00
buxiasen b0e8193b7a qemu/arm64: add pm support
add arm64 qemu pm compatible for demo pm_idle in not smp & smp usage
demo, chip should based on demo to add more operation in pm_idle_handler

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
chenrun1 4b7c36554c mps_allocateheap:Modify the heap logic
Summary:
  Due to the modification of 4244610, the heap_size may be used on SRAM1, which can lead to misconfiguration problems for some mps qemu configurations (e.g.MPS3) that use extern DDR as the heap, refer to the previous issue VELAPLATFO-34555.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
ligd 23ad93f430 mps: update the mps3-an547 mps2-an500 defconfig
Fix compile failed when open BASEPRI
Open same feature on mps3

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
anjiahao f79ae00a4f mps3-an547:fix sram range error
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
anjiahao 9122c3e44d mps:Supplement the interrupt definition about nvic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
qinwei1 9f97d9abb0 boards/arm.mps/mps2-an521: add support for mps-521 board
Summary
   MPS-521 support Dual Cortex-M33 and maybe suitable for AMP-like
case which is for AUTO OS, the change
  1. add support for single core at msp-521 with nsh bringup
  2. testing with ostest

TODO:
  Dual core support for flat-build
  Dual CORE support for Protected Build

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
Gao Jiawei aaf63d1d85 Enable stack check feature on MPS2-AN500 board
Signed-off-by: Gao Jiawei <gaojiawei@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
chenrun1 9f1ad1fc4f mps_an547:Adjust the an547 initialization stack allocation
Summary(for an547):
  1. Add maximum external storage expansion (2GB)
  2. Change PRIMARY_RAM_START to MPS_SRAM2_START (4MB)
  3. When REGIONS > 1, use external expansion as Heap

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
qinwei1 02f1d732a9 arch/arm/src/mps: implement Protected Build for mps2-an500
Summary
 1. add Protected build Support for ARM MPS AN500
 2. refine mps Memory layout configure and enable MPU support
Note
 1. ostest for an547:nsh
 2. ostest for an500:nsh and an500:knsh

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
Gao Jiawei e763b0cfe6 add cmake building support for mps board
Signed-off-by: Gao Jiawei <gaojiawei@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 20:06:52 +08:00
Jukka Laitinen 429252152a arch/arm64/src/common/arm64_arch_timer.c: Remove clock drift from tick timer
This fixes two issues with the tick timer
1) Each tick was longer than the requested period. This is because setting
   the compare register was done by first reading the current time, and only
   after that setting the compare register. In addition, when handling the
   timer interrupts in arch_alarm.c / oneshot_callback, the current_tick is
   first read, all the tick handling is done and only after that the next tick
   is started. The whole tick processing time was added to the total tick time.

2) When the compare time is not aligned with tick period, and is drifting,
   eventually any call to ONESHOT_TICK_CURRENT would either return the current
   tick, or the next one, depending on the rounding of division by the
   cycle_per_tick. This again leads to oneshot_callback randomly handling
   two ticks at a time, which breaks all wdog based timers, causing them to
   randomly timeout too early.

The issues are fixed as follows:

Align the compare time register to be evenly divisible by cycle_per_tick.
This will lead arm64_tick_current always to return the currently ongoing tick,
fixing 2). Also calculating the next tick's start from the aligned current
count will fix 1), as there is no time drift in the start cycle.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-30 19:23:01 +08:00
hujun5 5fb56f6d95 sim: add NXSYMBOLS pthread_gettid_np pthread_self
reason:
enable sim:smp can boot

This commit fixes the regression from https://github.com/apache/nuttx/pull/12561

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-30 18:26:00 +08:00
yezhonghui 85591fc360 pci alloc mis irq support new interface
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-30 15:41:28 +08:00
ouyangxiangzhen edd7d718eb arch/x86_64: Reimplement the NuttX32 multiboot1 wrapper.
This commit reimplemented the NuttX32 multiboot1 wrapper:
1. Fixed the issue of SMP AP booting.
2. Reduced memory copy overhead. We only need to copy .realmode section
   now.
3. Move the multiboot1 header to intel64_head.S.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-30 15:35:41 +08:00
chenxiaoyi 45f4ce84ad xtensa: fix up_saveusercontext in interrupt context
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-30 14:59:00 +08:00
ligd c4b969b5ee armv7/8-m/r: fix build warning
Error: armv7-m/arm_mpu.c:211:13: error: function declaration isn't a prototype [-Werror=strict-prototypes]
  211 | static void mpu_reset_internal()
      |             ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:168: arm_mpu.o] Error 1

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-30 14:09:15 +08:00
Huang Qi 52bb516d37 risc-v: Support customize idle loop
Support customize idle loop by CONFIG_ARCH_IDLE_CUSTOM
as other architectures.

Then user can provide their own `up_idle()` function
with CONFIG_ARCH_IDLE_CUSTOM enabled.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-30 14:08:56 +08:00
hujun5 07061d882c fix compile error:
Register: smp
Register: nsh
Register: sh
Register: getprime
Register: ostest
Espressif HAL for 3rd Party Platforms: b4c723a119344b4b71d69819019d55637fb570fd
common/xtensa_cpupause.c: In function 'xtensa_pause_handler':
common/xtensa_cpupause.c:240:3: warning: implicit declaration of function 'xtensa_savestate'; did you mean 'xtensa_setps'? [-Wimplicit-function-declaration]
  240 |   xtensa_savestate(tcb->xcp.regs);
      |   ^~~~~~~~~~~~~~~~
      |   xtensa_setps
common/xtensa_cpupause.c:243:3: warning: implicit declaration of function 'xtensa_restorestate'; did you mean 'xtensa_context_restore'? [-Wimplicit-function-declaration]
  243 |   xtensa_restorestate(tcb->xcp.regs);
      |   ^~~~~~~~~~~~~~~~~~~
      |   xtensa_context_restore

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 16:30:33 +08:00
dongjiuzhu1 1f1d90de1c binfmt/modlib: support loading each sections to different memory for Relocate object
The feature depends on ARCH_USE_SEPARATED_SECTION
the different memory area has different access speed and cache
capability, so the arch can custom allocate them based on
section names to achieve performance optimization

test:
sim:elf
sim:sotest

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-29 15:06:54 +08:00
lipengfei28 6e746ed364 arm64 fork: FORK_REG_LR,FORK_REG_SP should save the func local stack
not the last func stack

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-29 13:48:24 +08:00
hujun5 d4707646d5 arch: We can use an independent SIG interrupt to handle async pause,
which can save processing time.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 08:54:51 +08:00
hujun5 9de9f8168d sched: change the SMP scheduling policy from synchronous to asynchronous
reason:
Currently, if we need to schedule a task to another CPU, we have to completely halt the other CPU,
manipulate the scheduling linked list, and then resume the operation of that CPU. This process is both time-consuming and unnecessary.

During this process, both the current CPU and the target CPU are inevitably subjected to busyloop.

The improved strategy is to simply send a cross-core interrupt to the target CPU.
The current CPU continues to run while the target CPU responds to the interrupt, eliminating the certainty of a busyloop occurring.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 08:54:51 +08:00
hujun5 ba5091d2f7 arm64: remove the operation of clearing interrupts during GIC initialization
To align with the implementation of ARMv7-A, remove the operation of clearing
interrupts during GIC initialization to avoid losing interrupts during asynchronous startup.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 00:01:44 +08:00
hujun5 8f1a1006ec arm64:add busy wait flag
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 00:01:44 +08:00
hujun5 5e2eadacf7 arm64/smp: changing the startup of arm64 SMP from serial to parallel
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 00:01:44 +08:00
hujun5 64ebb149c6 syscall: Use a more compatible writing style
compile error:
Register: ostest
Register: nsh
Register: sh
Register: hello
Register: getprime
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/arch/irq.h:35,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/irq.h:37,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:40,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/arch.h:87,
                 from common/arm_signal_dispatch.c:26:
common/arm_signal_dispatch.c: In function 'up_signal_dispatch':
common/arm_signal_dispatch.c:72:3: error: 'asm' operand has impossible constraints
   72 |   sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo,
      |   ^~~~~~~~~
make[1]: *** [Makefile:168:arm_signal_dispatch.o] error 1

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 19:08:15 +08:00
hujun5 4c69bb8cc7 arch: inline up_switch_context,in arm arm64
reason:
when a context switch occurs, up_switch_context is executed.
In order to reduce the time taken for context switching,
we inline the up_switch_context function.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 19:08:15 +08:00
yezhonghui f81c844685 arm64 support gicv2m for pci irq
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 16:09:11 +08:00
chenxiaoyi b6225676f4 xtensa: hostfs: handle nonblock open for iss
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-28 13:53:06 +08:00
Yongrong Wang fa6d41471f arm_gicv2.c: fix armv7a compile error
/vela/nuttx/drivers/pci/pci_ecam.c:432:(.text.pci_ecam_get_irq+0x16): undefined reference to `up_get_legacy_irq'

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-28 13:34:33 +08:00
lipengfei28 30be81add6 arm64 pci legacy irq do not support yet
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-28 13:34:33 +08:00