Commit Graph

60601 Commits

Author SHA1 Message Date
yukangzhi 3448e84a4c arch/arm: armv8-r PL at startup needs to be checked
When the system startup from the PL1 SYS mode, the initialization
of the PL2 HYP register needs to be skipped. Put the Hypervisor
initialization code together and skip it all at once.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-21 19:21:43 +08:00
xuxin19 98d4d887da msvc ci:change arm source to xpack
Try using Xpack to obtain the Windows toolchain to resolve CI/BB issues.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-21 19:19:39 +08:00
hujun5 f6f8acafbb arch: fix cmake error
Add default values (0x0) for ARCH_TEXT_VBASE, ARCH_DATA_VBASE, and
ARCH_HEAP_VBASE to resolve cmake configuration warnings when these
values are not explicitly set during initialization.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 14:38:36 +08:00
hujun5 37ecb28eb1 semaphore/sem_trywait.c: Remove redundancy leave_critical_section
Remove redundant leave_critical_section() call in nxsem_trywait_slow() as the
critical section is properly released at the exit point via 'out' label, making
the intermediate call unnecessary and eliminating code duplication.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 14:27:14 +08:00
hujun5 0b96303fda libc/environ: add interrupt context check to getenv
Prevent getenv() from being called in interrupt context by adding
up_interrupt_context() check. This ensures thread-safe access to
environment variables in multi-threaded scenarios.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:37:55 +08:00
hujun5 5fb2ff3fe9 sched/tls: fix thread ID initialization in tls_dup_info
Set the thread ID (tl_tid) to the destination task's pid during TLS
duplication in fork operations. This ensures the duplicated TLS info
correctly reflects the forked task's thread identifier.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:34:27 +08:00
wangchengdong 291938150f sched/hrtimer: add option for list-based hrtimer management
Add support for managing hrtimers using a simple list. This approach
  is more memory-efficient, as list nodes use less memory, and it is
  preferable to an RB-tree when the number of hrtimers is relatively small.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-21 10:33:12 +08:00
anpeiyun 3c1712c66d kasan/hook.c: prevent recursive report overflow
Stop the report handler from re-entering KASAN by halting checks when printing.
Reuse the dump_only flag so read/write panic toggles only emit stack traces.
Retain stack dumps for panic-disabled paths without risking another overflow.

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-01-21 10:27:02 +08:00
hujun5 c9e5b52f33 sched/pthread: remove duplicate robust mutex checking logic
Remove redundant robust mutex owner validation code from pthread_mutex_timedlock
that duplicates similar logic already present in pthread_mutex_take. This reduces
code duplication and improves maintainability.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:12:22 +08:00
hujun5 bc3d478749 sched/pthread: use spin_lock_irqsave_nopreempt for mutex head lock
Replace spin_lock_irqsave with spin_lock_irqsave_nopreempt in
pthread_mutex_inconsistent to prevent preemption during mutex list
manipulation and avoid potential deadlocks or race conditions.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 10:05:17 +08:00
yintao f7dc54e869 drivers/rpmsg: use nuttx/atomic.h instead meatl/atomic.h
All the atomic operation already changed to nuttx's, so change
the include header too

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-21 10:01:40 +08:00
raiden00pl 491e86762b boards/nrf53: correct rptun names
after recent changes in rptun framework, HCI over rptun was broken due to
wrong cpu names.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-01-20 17:54:49 +01:00
Laczen JMS 88f62fd322 boards/xtensa/esp32: add rtc_reserved_seg to legacy_sections
Enable building the legacy idf format of nuttx when rtc is enabled.
Without this addition the build fails because the rtc data is placed in
rom.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2026-01-21 00:39:12 +08:00
makejian 5b52a32f5a crypto/crypto.c: Determine the order of obtained crypto drivers
After adding the cross-core crypto driver, there are now three encryption modes:
1. Hardware driver in local core
2. Crypto driver in remote core
3. Software encryption in local core

This prioritizes local hardware driver first, then remote driver (typically hardware),
and finally local software encryption as a fallback.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian e23dd613c9 crypto/cryptodev: optimize without dynamic memory in crypto process
Replace dynamic memory allocation with stack-based variables in cryptodev_op().
This eliminates kmm_malloc/kmm_free overhead and simplifies error handling
by removing the need for goto bail cleanup paths.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian 66f9329839 crypto/cryptodev: export ivlen to support different cipher algs
Add ivlen field to crypt_op and crp_ivlen to cryptop structure to support
cipher algorithms with different IV lengths.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
makejian 143547128b crypto/cryptodev: add encrypt op and olen for support virtio mode
Add olen field to crypt_op structure and crp_olen to cryptop structure
to support output length tracking in virtio crypto mode.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-21 00:25:07 +08:00
hujun5 66f9ced0cb arch: default enable TLS_ALIGNED when BUILD_PROTECTED=y
Change TLS_ALIGNED default configuration to enable when either BUILD_KERNEL
or BUILD_PROTECTED is selected. Protected mode requires stack alignment to
properly handle TLS data structure at stack base.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-21 00:20:13 +08:00
hujun5 e604bacd42 sim: it is not necessary to call restore_critical_section in irq
Build Documentation / build-html (push) Has been cancelled
Remove restore_critical_section() call from up_switch_context() in simulator
as it is not necessary during interrupt context switching. The critical
section state is properly managed elsewhere in the interrupt handling flow.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 12:22:18 -03:00
hujun5 7ee3890e7a x64_64: it is not necessary to call restore_critical_section in irq
Remove restore_critical_section() call from common_handler() in x86_64 interrupt
processing as it is not necessary during interrupt handling. The critical section
state is properly managed by the interrupt framework elsewhere.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 11:49:39 -03:00
liwenxiang1 2645e06c86 arch/x86_64: Add gprof
add gprof tool

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
liwenxiang1 b1373857b7 arch/x86_64: Resolve the issue of abnormal stack check display.
Resolve the issue of abnormal stack check display

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
liwenxiang1 0046070395 arch/x86_64:Add runtime stack size analysis
Add runtime stack size analysis tool

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
liwenxiang1 79b82da476 arch/x86_64: Add stack usage
add stack usage tool

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 22:43:38 +08:00
daichuan a82ee60da8 usrsock: Check RECVFROM_AVAIL before setting POLLIN in pollsetup
In usrsock_pollsetup, only set POLLIN if USRSOCK_EVENT_RECVFROM_AVAIL is set when remote is closed, avoiding invalid POLLIN events.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 22:37:10 +08:00
daichuan 7a4a6ce4ce usrsock: Avoid frequent POLLIN when remote close during accept.
Clear USRSOCK_EVENT_RECVFROM_AVAIL flag when remote closes connection during accept to prevent repeated POLLIN events and EPIPE loop.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 22:37:10 +08:00
hujun5 8bb6758490 sched: move process ID from kernel to TLS for faster access
Add pid field to task_info_s and move getpid() implementation to user
space TLS access. Remove getpid from syscall interface as it now returns
cached PID from thread local storage instead of kernel lookup.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 22:33:45 +08:00
hujun5 0f7c992cea sched/task: fix gettid by moving tls_dup_info after child pid initialization
Move tls_dup_info() call to after child process priority is set, ensuring
the child's pid is properly initialized before duplicating TLS information.
This fixes incorrect thread ID assignment during task fork operations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 22:33:45 +08:00
v-zhangxiaomeng5 c95b6b1bb6 libxx: fix __config_site for libcxx compile errors
The errors are 'No thread API' and '__ULong undefined'

Signed-off-by: v-zhangxiaomeng5 <v-zhangxiaomeng5@xiaomi.com>
2026-01-20 17:45:48 +08:00
liwenxiang1 bd2cce7f1a arch/x64: fix revoke_low_memory
the virtual address of the page table (PT) is saved into the page directory (PD) entry, but the PD entry should store the physical address instead

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 17:15:50 +08:00
makejian 8309aadd69 Documentation: Add Whetstone FPU benchmark documentation
Add documentation for the Whetstone floating-point benchmark
application which is being added to nuttx-apps.

The documentation includes:
- Overview of the benchmark
- Configuration options
- Usage examples
- Output interpretation
- Test modules description

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-20 17:15:31 +08:00
hujun5 2c1e3d6ed0 sched/addrenv: replace critical section with spinlock for refs protection
Build Documentation / build-html (push) Has been cancelled
Replace global enter_critical_section() calls with lightweight spinlock in
addrenv_switch() to reduce interrupt latency, and convert refs counter to
atomic_t for thread-safe reference counting without blocking operations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 11:29:22 +08:00
daichuan d19ee93c60 net: Support no-lto option for the network build.
Add CONFIG_NET_NO_LTO to allow compiling the network stack with -fno-lto.
This is useful for avoiding LTO-related issues in the network layer.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 10:12:45 +08:00
daichuan 32ffc69bdd net/icmp: Fix devif_loopback dead loop when unrecognized ICMP packet received
When an unrecognized ICMP (type=3, code=2) packet is received, the ICMP flow does not set dev->d_len to 0, causing a devif_loopback dead loop.

Therefore, in ICMP input processing, when an ICMP_DEST_UNREACHABLE message is received, if it is not ICMP_FRAG_NEEDED code, jump to typeerr for error handling.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-20 06:56:27 +08:00
wangchengdong 303bc7411f sched/sched: add hrtimer support to drive the scheduler
Add hrtimer support to drive the scheduler.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-20 06:55:15 +08:00
wangchengdong 9d8f0ace40 sched/sched: consolidate nxsched_process_timer into sched_timer.c
Consolidate nxsched_process_timer into sched_timer.c, and introduce
nxsched_process_tick() to improve readability and maintainability of
the scheduler timer processing logic.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-20 06:55:15 +08:00
liwenxiang1 46c319d948 arch/x64: Solve the sig_nest hang issue
When an interrupt occurs, the hardware automatically pushes the current RIP/RSP onto the interrupt stack. During the interrupt return, the iretq instruction pops them back. The problem is that the RIP/RSP modified by the signal is stored in the XCP context, whereas iretq operates on the interrupt stack. As a result, the RIP/RSP modified by the signal does not take effect in the iretq instruction, causing the task receiving the signal to fail to jump correctly to the signal handler. This behavior appears as if the signal is lost

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 06:53:04 +08:00
liwenxiang1 41da7121bd arch/x64: interrupt add CFI info
interrupt add CFI info

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-20 06:52:00 +08:00
zhangshuai39 49ffd94d84 net/pkt: Fix coverity issue
The value ret is overwritten after being assigned a value.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2026-01-19 15:33:03 -05:00
makejian 60b1cef84b Kconfig: Add ALLOW_CUSTOM_PERMISSIVE_COMPONENTS option
Add a new license configuration option for components that have
custom permissive licenses which are not covered by the standard
license options (BSD, MIT, GPL, etc.).

This option allows projects to explicitly opt-in to using components
with custom permissive licenses that allow free use, modification,
and distribution but may have specific attribution or notice
requirements.

Also update the License Setup documentation section to include
this new option.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-20 02:15:19 +08:00
hujun5 63e59e26c0 arch: move some macros to public code.
Move stack alignment and kernel stack macros from architecture-specific internal
headers to public include/nuttx/irq.h. Consolidates duplicate definitions across
17 architecture families, reducing code duplication while enabling common code
to access these core alignment utilities without architecture dependencies.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 01:53:08 +08:00
cuiziwei 6a51857e90 libs/libxx: Add _LIBCPP_HAS_NO_CONTENTION_TABLE to reduce RAM usage
When _LIBCPP_HAS_NO_CONTENTION_TABLE is defined, libcxx will not
allocate the contention table used for semaphore implementation,
which can save significant RAM on memory-constrained embedded systems.

This optimization is particularly useful for NuttX targets where
every byte of RAM matters.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-01-20 01:51:12 +08:00
buxiasen f0cb80d297 libm: fix warning maybe-uninitialized
nuttx/libs/libm/openlibm/openlibm/src/k_rem_pio2.c:421:24: error: 'fq' may be used uninitialized [-Werror=maybe-uninitialized]

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-01-19 23:26:14 +08:00
fangxinyong 507056e870 cmake(bugfix):fix arch x86_64 cmake build openlibm warning
Building C object libs/libm/openlibm/CMakeFiles/m.dir/openlibm/src/s_clog.c.obj
In file included from /work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/src/math_private.h:22,
                 from /work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/src/s_clog.c:61:
/work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/src/s_clog.c:78:33: warning: ‘clogl’ alias between functions of incompatible types ‘_Complex long double(_Complex long double)’ and ‘_Complex double(_Complex double)’ [-Wattribute-alias=]
   78 | openlibm_strong_reference(clog, clogl);
      |                                 ^~~~~
/work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/src/cdefs-compat.h:24:50: note: in definition of macro ‘openlibm_strong_reference’
   24 |         OLM_DLLEXPORT extern __typeof (aliassym) aliassym __attribute__ ((__alias__ (#sym)));
      |                                                  ^~~~~~~~
/work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/src/s_clog.c:64:1: note: aliased declaration here
   64 | clog(double complex z)

Building C object libs/libm/openlibm/CMakeFiles/m.dir/openlibm/amd64/fenv.c.obj
In file included from /work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/include/openlibm_fenv.h:8,
                 from /work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/amd64/fenv.c:35:
/work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/include/openlibm_fenv_amd64.h:99:1: warning: declaration of ‘feclearexcept’ shadows a built-in function [-Wshadow]
   99 | feclearexcept(int __excepts)
      | ^~~~~~~~~~~~~
/work/rel-5.0/nuttx/libs/libm/openlibm/openlibm/include/openlibm_fenv_amd64.h:117:1: warning: declaration of ‘fegetexceptflag’ shadows a built-in function [-Wshadow]
  117 | fegetexceptflag(fexcept_t *__flagp, int __excepts)

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-19 23:26:14 +08:00
makejian cdfe81ff4c crypto/siphash: avoid redefine name issue
Rename siphash related symbols to avoid conflicts with compiler-generated
section names. Tricore-gcc produces function sections with '_end' suffix,
which conflicts with siphash_end symbol.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-19 23:25:37 +08:00
daichuan b01f8b04e9 netdev: delete macro CONFIG_NETDEV_CHECKSUM with nuttx
not need CONFIG_NETDEV_CHECKSUM with nuttx

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
daichuan 99bf7c3c5f net: skip TCP/UDP pseudo-header checksum with hardware offload
When supporting hardware checksum offloading, the network protocol stack
does not perform TCP/UDP pseudo-header checksum calculation.

Skip TCP/UDP pseudo header checksum calculation in network protocol stack

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
daichuan 42da4e322a net/netdev: fix compile error and add cmake/makefile
Fix compilation errors and add build files

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
daichuan d2dde8a29a net/netdev: modify for hardware checksum offload
Implementation of main hardware verification and uninstallation functions

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-19 23:22:46 +08:00
yangao1 9903b11656 drivers/rpmsg: remove unnecessary header files, revise make.def and cmake
Already copy the rpmsg_internal.h from openamp to the nuttx/include,
so do not need add the include patch for .c files.

Signed-off-by: yangao1 <yangao1@xiaomi.com>
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
2026-01-19 23:14:53 +08:00