Commit graph

24237 commits

Author SHA1 Message Date
wangchengdong
8919950326 arch/sparc: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
2a0990bd31 arch/sim: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
00c1946e35 arch/renesas: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
ec2684c885 arch/or1k: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
8df791b057 arch/misoc: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
23fa9b16b3 arch/mips: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
dfd3426aa5 arch/avr: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
9670b17ffd arch/z80: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
d04ca30169 arch/z16: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
1b8d8f7565 arch/xtensa: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
7dbd568477 arch/x86_64: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
2d6eef74b5 arch/x86: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
92f097e354 arch/tricore: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
d3f89c2661 arch/arm64: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
0813357308 arch/risc-v: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
wangchengdong
09b99e5b90 arch/arm: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
Alexey Matveev
1b993875b5 arch/stm32: Fix stm32-capture if timer don't support GTIM_CCER_CC1NP
Fix: Some STM32 chips don't support GTIM_CCER_CC1NP; use HAVE_GTIM_CCXNP guards to exclude it. Adds/updates #ifdef HAVE_GTIM_CCXNP guards so GTIM_CCER_CC1NP is only included when supported, preventing register writes on chips without it.

Signed-off-by: Alexey Matveev <tippet@yandex.ru>
2026-01-18 11:40:32 +08:00
hujun5
3129c06390 arch/arm64: disable fork support in protected build mode
Modify ARM64 architecture configuration to disable fork support in protected
build mode (BUILD_PROTECTED). Update ARCH_HAVE_FORK condition from
"!BUILD_KERNEL" to "!BUILD_KERNEL && !BUILD_PROTECTED", ensuring fork is
only available in flat/monolithic builds, not in protected kernel builds.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-18 11:17:13 +08:00
hujun5
657ac8317e arch: fix addrenv_switch changing this_task causing exceptions
After addrenv_switch(), the current running task (this_task) may change due to
deferred work execution. Update all architecture interrupt, syscall, and exit
handlers to re-fetch tcb = this_task() after addrenv_switch(). Ensures scheduler
and context operations use the correct TCB, preventing context corruption and
exceptions across SMP and memory-protected builds.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-17 18:23:06 -03:00
ligd
113bb02568 checkstack: fix access overflow when checkstack
We should check length first, and then check the value

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-01-17 18:04:28 -03:00
xucheng5
2f3eb6d677 caros_x86_64: add support for generating linker map
This patch introduces support for generating a linker map file during
the build process for the x86_64 configuration.

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2026-01-17 14:14:13 +08:00
hujun5
13d1092939 arm64: add missing REG_SCTLR_EL1 initialization in signal processing
Add REG_SCTLR_EL1 system register initialization in arm64_init_signal_process
when setting up register context for signal handlers. Initialize with current
sctlr_el1 value and apply CONFIG_ARM64_MTE settings if enabled. Fixes regression
where signal handler context was missing critical system control register setup.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-17 14:13:55 +08:00
Ari Kimari
fb7e5c5618 arch/imx9: Modify default ddr config handling
Remove default ddr config
Add imx9_ddr_config() function  to return default config

Signed-off-by: Ari Kimari <ari.kimari@tii.ae>
2026-01-17 11:41:57 +08:00
hujun5
f4cbc1455f arm: use global variables for CPU startup addresses
Replace direct labels for CPU startup routines with indirection through global
variables. Export cpu1_start, cpu2_start, cpu3_start as global objects containing
addresses to __cpu1_start, __cpu2_start, __cpu3_start respectively. Use load-then-
branch-exchange (ldr r1, =cpu*_start; ldr r1, [r1]; bxeq r1) instead of direct beq
jumps. Enables flexible control of CPU startup positions and supports future AMP/
dynamic loading scenarios.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 14:05:24 -03:00
hujun5
c1884b8a4f arm: add CONFIG_NCPUS for AMP mode support
Add new CONFIG_NCPUS configuration option to support both SMP and AMP modes.
Replace SMP-specific CONFIG_SMP_NCPUS checks with generic CONFIG_NCPUS in ARM
boot code (ARMv7-A, ARMv7-R, ARMv8-R). CONFIG_NCPUS defaults to SMP_NCPUS when
SMP is enabled, or 1 otherwise, enabling multi-CPU support regardless of SMP mode.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 14:05:24 -03:00
hujun5
6f87c092a1 arm: support AMP mode with GIC SGI inter-core interrupts
Enable SGI (Software Generated Interrupts) usage in AMP mode for inter-core
communication. Modify arm_cpu_sgi() to use SGI_TGTFILTER_LIST for both SMP and
AMP modes instead of requiring CONFIG_SMP. Add CPU0-only guard checks using
sched_getcpu() to ensure arm_gic0_initialize() executes only once on CPU0 during
initialization in both SMP and AMP configurations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 14:05:24 -03:00
Jiri Vlasak
f49e61bf76 kinetis/enet: Set carrier on/off on ifup/ifdown
We need IFF_IS_RUNNING(dev->d_flags) to be true for ethernet device to
work properly. However, dev->d_flags are not set anywhere in the
Kinetis' ethernet code.

This change updates kinetis_ifup and kinetis_ifdown procedures to call
netdev_carrier_on and netdev_carrier_off to set dev->d_flags.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-01-16 13:55:13 -03:00
Peter van der Perk
8c77fccaef imx95-m7: Fix Kconfig for flexcan typo
Fixes typo in flexcan2, which renders it unusable

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-16 13:49:25 -03:00
ligd
c000974700 arm64: fix compile failed
CC:  mm_heap/mm_mallinfo.c chip/bcm2711_serial.c: In function 'bcm2711_miniuart_attach':
chip/bcm2711_serial.c:571:3: error: implicit declaration of function 'up_prioritize_irq' [-Werror=implicit-function-declaration]
  571 |   up_prioritize_irq(BCM_IRQ_VC_AUX, 0);
      |   ^~~~~~~~~~~~~~~~~
CC:  mm_heap/mm_memalign.c chip/bcm2711_gpio.c: In function 'bcm2711_gpio_irqs_init':
chip/bcm2711_gpio.c:275:7: error: implicit declaration of function 'up_prioritize_irq' [-Werror=implicit-function-declaration]
  275 |       up_prioritize_irq(g_gpio_irqs[i], 0);
      |       ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-01-16 10:26:58 -05:00
guoshichao
5a9f6efddb ghs: update the compile option to recommended options
add new build option config that recommended from other mass-produced
products

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 21:57:00 +08:00
hujun5
79b6d27018 arm64: fix SP_EL0 register handling in syscall return path
Use regs[REG_SP_EL0] from register context instead of direct sp_el0 system
register read/write operations in arm64_syscall(). Replace read_sysreg(sp_el0)
with regs[REG_SP_EL0] and write_sysreg(usp, sp_el0) with direct assignment to
regs[REG_SP_EL0]. Ensures userspace stack pointer is correctly maintained from
register context during signal delivery, preventing userspace SP corruption on
syscall return.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 21:34:41 +08:00
hujun5
ad3abcd277 arm64: g_mpu_region need support SMP
Convert g_mpu_region from single-CPU global variable to per-CPU array indexed
by this_cpu(). Change declaration from "unsigned int g_mpu_region" to
"unsigned int g_mpu_region[CONFIG_SMP_NCPUS]". Update all accesses in
mpu_allocregion(), mpu_freeregion(), and mpu_modify_region() to use
g_mpu_region[this_cpu()] for proper per-CPU MPU region tracking in multi-core
configurations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 20:37:25 +08:00
hujun5
ffb4c101d8 arm64: fix FIQ mask initialization in task state
Add FIQ bit (DAIF_FIQ_BIT) initialization to SPSR register when creating new
ARM64 tasks. By default, FIQ interrupts are masked unless CONFIG_ARM64_DECODEFIQ
is enabled. Ensures consistent FIQ masking behavior across all task contexts.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 20:37:17 +08:00
guoshichao
eda1969888 ghs.cmake: add preprocess command to the .ld script generate procedure
Modify nuttx_generate_preprocess_target() to inject
$<TARGET_PROPERTY:nuttx_global,NUTTX_CPP_COMPILE_OPTIONS> into the
preprocessing command, ensuring that linker script preprocessing uses
the same C preprocessor flags as the rest of the build (e.g., -D defines,
include paths).

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 20:32:05 +08:00
wangzhi16
ce982fac4c arch/arm64: fix compile error.
14:35:29  chip/a64_twi.c:1846:3: error: implicit declaration of function 'up_prioritize_irq' [-Werror=implicit-function-declaration]
14:35:29   1846 |   up_prioritize_irq(priv->config->irq, 0);
14:35:29        |   ^~~~~~~~~~~~~~~~~

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-16 20:26:14 +08:00
lipengfei28
efedf48cde arch/arm64: use up_prioritize_irq and up_set_type_irq instead
arm64_gic_irq_set_priority

use use up_prioritize_irq and up_set_type_irq as std api

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-16 20:26:14 +08:00
lipengfei28
e70c31162a arch/arm: add api to config irq type
arm add api to config irq type

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-16 20:26:14 +08:00
lipengfei28
ddb797b0ab arch/arm64: add api to config irq type
arm64 add api to config irq type

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-16 20:26:14 +08:00
hujun5
2a08860a08 arch/arm64: fix backtrace register access and gdbstub config guard
Fix arm64_backtrace to access TCB register context directly instead of using
running_regs(), which may not reflect the actual context being backtraced.
Add CONFIG_ARCH_HAVE_DEBUG guard to prevent undefined references in non-debug builds.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 08:55:47 -03:00
hujun5
ac8a61d70b arm64: add the interrupt status in the syscall
Set interrupt status flag in tpidr_el1 register (bit 0 set to 1) when entering
syscall handler to indicate IRQ-in-progress state, and clear it when exiting
to properly track kernel execution context across all code paths.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 08:55:07 -03:00
guoshichao
ba63a4d234 ghs: fix the UsageFault:INVSTATE error triggered by exception_common
when we build with greenhills compiler, if the exception_common function
is put into a separate section: ".text.exception_common", then the
address of exception_common function is an even number, for example "0x16a6c",
in this case, it will trigger the UsageFaults:INVSTATE error.
The reason for this error is that in the GHS compiler, a section declared
through the ".section" directive must specify at least the "a" attribute.
Otherwise, this section will not be linked into the final file, and this
is why the address of exception_common function is invalid.
The following is the official explanation in the GHS compiler documentation:
"The reason for this error is that in the GHS compiler, a section
declared through the .section directive must specify at least the "a"
attribute. Otherwise, this section will not be linked into the final
file. The following is the official explanation in the documentation:
"Sections that are intended be part of the final linked output should
have at least the `a` attribute"
and for GHS compiler, the .text section is recommended specify the
attribute of `ax`.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 09:41:13 +08:00
guanyi3
f99dd20c4e sim/usrsock: move g_work_queue init before net_initialize
usrsock register work in net_initialize before g_work_queue is created, so move g_work_queue in irq_initialize.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-01-16 09:39:02 +08:00
guanyi3
7dde767155 sim: add global work queue to replace HPWORK
rpmsg work in hpwork are waiting for remote buffer, remote get buffer and callback, but callback also in hpwork, deadlock occurs here.
now we move periodic work to global work queue instead of hpwork to fix deadlock.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-01-16 09:39:02 +08:00
guanyi3
27c9d388d9 sim: replace wdog to work queue to avoid deadlock
The wdog callbacks are executed in the host's signal handler context, which has strict limitations on what operations can be safely performed. Specifically, signal handlers should not call non-async-signal-safe functions (e.g., sim_alsa use mutex_lock in wdog and cause deadlock).

This change only replaces uses of wdog for periodic tasks. Other interrupt callbacks that are still invoked from the host signal handler are not replace to work queue.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-01-16 09:39:02 +08:00
daichuan
1817484bcd arch/sim: support SOCK_RAW in host_usrsock_socket
Convert NUTTX_SOCK_RAW to native SOCK_RAW in the simulator usrsock implementation.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-16 09:38:46 +08:00
liwenxiang1
fceba08e0e arch/x64:Fix the abnormal backtrace display issue
Need to wait until nuttx and allsymbols linking is completed before generating nuttx.mb1.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-16 09:38:09 +08:00
liwenxiang1
addc6b165a arch/x64:Fix the issue where RFLAGS is not restored after a syscall return
When a syscall is invoked, the RFLAGS register is saved into R11. It must be restored before returning

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-16 09:37:20 +08:00
liwenxiang1
794c325947 arch/x64:Syscall support is enabled by default
Syscall enablement is controlled by CONFIG_ARCH_HAVE_SYSCALL

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-16 09:37:20 +08:00
liqinhui
0e4d291156 sim: Pass through unknown sockopt to system.
Remove the interception of unknown levels and option names in sim usrsock.
This allows the system socket interface to handle them and return the correct error codes or behavior, rather than returning a generic error locally.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2026-01-15 13:29:56 -08:00
p-szafonimateusz
ee06211e05 arch/x86_64/intel64: fix build break for timerisr
fix these errors when build with CONFIG_SCHED_TICKLESS=n:

1. intel64_tsc_timerisr.c:56: multiple definition of `g_x86_64_timer_freq';
2. intel64_cpustart.c:196: undefined reference to `get_tsc_adjust'

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-15 11:43:33 -08:00