Commit graph

8069 commits

Author SHA1 Message Date
jiangtao16
3b005dbdf7 sched/wdog: Fix MISRA 2004 rule 10.1
Fix MISRA 2004 rule 10.1 implicit type conversion

Signed-off-by: jiangtao16 <jiangtao16@xiaomi.com>
2026-01-22 22:14:00 +08:00
jiangtao16
e171415897 sched/clock: has external linkage but is only used in one translation unit
Fix for MISRA-C rule 8.10

Signed-off-by: jiangtao16 <jiangtao16@xiaomi.com>
2026-01-22 22:14:00 +08:00
chenxiaoyi
397e7e7a4f macro: use portable variadic macros
The old implementation used a GCC extension related to variadic macros,
where a name prepends the ellipsis, which has portability issues.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2026-01-22 22:14:00 +08:00
yinshengkai
34e8267fcc macro: FOREACH_ARG Add parameter field
Adjust the definition and fix CONCATENATE.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-01-22 22:14:00 +08:00
yinshengkai
cc578e33a9 macro: FOREACH_ARG Add parameter field
FOREACH_ARG Add parameter field.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-01-22 22:14:00 +08:00
daichuan
763caabf6d boards/boardctl: Add BOARDIOC_MACADDR command
Add a new boardctl command BOARDIOC_MACADDR to retrieve the MAC address of the network interface.

The board_macaddr function needs to be implemented by the board logic.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-22 22:13:31 +08:00
wangzhi16
d5ed98c11f sched/rwspinlock: There is a bug in the rw_spinlock.
There is a bug in the rw_spinlock. Each time atomic_compare_exchange_strong(object, expected, desired) is executed, the value of object is assigned to expected, so the value of expected needs to be reset each time.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-22 22:11:17 +08:00
yukangzhi
dd307ab82c libc/pthread: Avoid compiler optimizations for once_control->done
Prevent compiler reordering that may read stale value of once_control->done.
Use volatile to ensure visibility across threads and prevent incorrect once initialization.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-22 19:47:45 +08:00
hujun5
223230a9ed spinlock: add rspin_lock_count
spinlock: add rspin_lock_count query interface

Add rspin_lock_count() function to query the current recursion count of a
recursive spinlock. This allows callers to inspect the lock state without
modifying it, useful for debugging and diagnostics.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:38:37 +08:00
hujun5
4c43efafa5 spinlock: optimize the implementation of rspinlock in a single-core
Add CONFIG_SPINLOCK conditional compilation to optimize rspinlock functions
for systems without spinlock support. Provide simple macro implementations
that bypass recursive lock logic when spinlock is not configured.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:38:37 +08:00
hujun5
bb69f77164 spinlock: add rspinlock interface for recursive spinlock support
Add new recursive spinlock (rspinlock) interface functions to support nested
spinlock acquisitions by the same CPU. Includes rspin_lock, rspin_unlock,
rspin_breaklock, and rspin_restorelock for proper recursive lock management.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:38:37 +08:00
hujun5
6f03601169 arch: rename STACK_ALIGNMENT to STACKFRAME_ALIGN across all architectures
Rename STACK_ALIGNMENT macro to STACKFRAME_ALIGN throughout the codebase
to provide clearer naming semantics. The new name better reflects the macro's
purpose of frame alignment rather than general stack alignment.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:37:24 +08:00
Côme VINCENT
34d3b06955 drivers/timers/capture: fix typo in capture.h
This commit fixes a typo in the capture.h header file. This is a
breaking change, but the fix is trivial (replace macro with new one).

Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com>
2026-01-22 00:06:45 +08:00
fangxinyong
cd958831d8 sched/init: use enum type for g_nx_initstate
Change g_nx_initstate type from uint8_t to enum nx_initstate_e.
Avoid enum/integer base-type mismatch in init state comparisons.
Satisfies MISRA C:2012 Rule 10.4 without behavior change.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-01-21 20:31:35 +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
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
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
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
2c1e3d6ed0 sched/addrenv: replace critical section with spinlock for refs protection
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
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
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
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
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
zhangyuan29
f44060ca9f arch/tricore: support minimal vectortalbe in tricore
The SRN number in TriCore far exceeds the PN number.
Using IRQ as the PN number would result in an overflow.
Therefore, MINIMAL_VECTORTABLE is used to ensure that
the PN number does not overflow.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2026-01-19 17:51:48 +08:00
pangzhen1
42bf54b24c rptun: add configuring the stack of rptun as static
Support use the drivers provided stack to initialize the rptun
kthread.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-19 14:18:27 +08:00
Xiang Xiao
9767b20251 rptun: Align command value with rpmsg_virtio_lite
so we can mix rptun and rpmsg_virtio_lite in the same system.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
e369bce787 drivers/rptun: add panic and reset method for new rptun framework
Use share memory to send PANIC and RESET command to peer if the rptun
driver do not support panic() and reset ops.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
239130c1fd mm/mm_heap: add nokasan flag in mm_heap_config_s structure
Support enable/disable the kasan when initialize the heap.
This requirement is from rptun, because rptun use share memory init
the heap and share memory is precious, so we need disable the kasan
feature for rptun's heap to save the share memory.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
e686a3ac42 mm/mm_heap: use struct mm_heap_config_s to init the memory heap
To avoid add new parameters to the mm_initialize_heap() and
mm_initialize_pool()

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
anjiahao
6ed4ea63d8 mm: support mm_initialize_heap to specify a specific heap pointer
Support user pass it own heap struct to the mm_initialize_heap() to
avoid the heap struct is reserved from the heap range

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-19 14:18:27 +08:00
Xiang Xiao
d7f3e41b13 Revert "rptun/rptun_ivshmem:add restart cmd to reboot slave"
This reverts commit 4fa1c460d3.
to reducing the complexity of rptun driver.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
7ba6425933 drivers/rptun: remove rpmsg virtio deivce in rptun
Now rptun only as remoteproc and remoteproc_virtio transport layer,
because the rpmsg virtio device should be a stand alone virtio/vhost
driver in the virtio bus

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
e20a05dce2 drivers/rptun: add rptun debug config macros and Kconfig
rptun and rptun driver can use this macro to add debug log

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
a98dc94f93 rpmsg/rpmsg_virtio: add rpmsg virtio common implementation
This is the virtio-rpmsg and vhost-rpmsg common implementation for
VirtIO-Rpmsg: drivers/virtio/virtio-rpmsg.c
Vhost-Rpmsg: drivers/vhost/vhost-rpmsg.c

Later we will seperate the rpmsg virtio from the rptun framework to
make the rpmsg virtio can work with all the virtio transport layer.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
makejian
d15081838b crypto/cryptodev: support private data in driver
Add support for storing driver-specific private data in the crypto
driver structure. This allows crypto drivers to maintain session
state and other driver-specific information.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-19 14:17:38 +08:00
makejian
3ce3d4cb20 crypto/blake2s.h: fix tasking compile warning
Fix unexpected text after preprocessing directive compilation warning
in blake2s.h header file.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-19 14:16:25 +08:00
ouyangxiangzhen
efa0ae5275 list: Fix the list conflicts.
This commit is workaround for the list conflicts introduced by the wqueue and wdog. By spliting the list type definition and the list implementation, we can avoid the list conflicts with user-defined lists.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-19 14:12:09 +08:00
ouyangxiangzhen
57a12556d2 list: Optimize the list structure.
Since lists are traversed sequentially in most cases, moving the next pointer before the prev pointer can optimize memory access on some architectures.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-19 14:12:09 +08:00
makejian
35886c18ab nuttx/mutex: correct documentation for nxmutex_destroy
Correct and clarify the documentation note for nxmutex_destroy function
to properly document behavior and safety considerations in OS context.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-19 14:10:42 +08:00
dongjiuzhu1
8afca79359 drivers/sensors: add sensor_device_info when sensor_regsiter by usensor.
The logic for obtaining the info and configuring the user buffer
have been optimized.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Signed-off-by: likun17 <likun17@xiaomi.com>
2026-01-19 12:22:46 +08:00
hujun5
835c9c0f77 binfmt: refactor loadable module cleanup mechanism
Remove deprecated group_exitinfo() function and related critical section locking
from binfmt_exec.c, moving module unload setup directly into exec_module() where
it integrates naturally with task activation, simplifying code flow and reducing
unnecessary synchronization overhead.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-18 08:30:15 -03:00
wangchengdong
faf864b04f sched/signal: Add support for disabling all signal functions
Signals in NuttX serve two primary purposes:

      1. Synchronization and wake-up:
        Signals can be used to block threads on specific signal sets and later
        wake them up by delivering the corresponding signals to those threads.

      2. Asynchronous notification:
        Signals can also be used to install callback handlers for specific signals, allowing threads to
        asynchronously invoke those handlers when the signals are delivered.

    This change introduces the ability to  disable all signal functionality to reduce footprint for NuttX.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2026-01-18 08:24:13 -03:00
wangchengdong
0ea686bc5b sched/signal: Add support for partially disabling signals
Signals in NuttX serve two primary purposes:

    1. Synchronization and wake-up:
    Signals can be used to block threads on specific signal sets and later
    wake them up by delivering the corresponding signals to those threads.

    2. Asynchronous notification:
    Signals can also be used to install callback handlers for specific signals, allowing threads to
    asynchronously invoke those handlers when the signals are delivered.

This change introduces the ability to partially disable signal functionality: to disable only signal functions for
Asynchronous notification, keeping functions for Synchronization and wake-up.
This enables finer-grained control over signal usage while preserving existing behavior for supported use cases.

Co-authored-by: Guo Shichao guoshichao@xiaomi.com
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2026-01-18 08:24:13 -03:00
makejian
b11901ffaf crypto: add key management and RSA/ECDSA keypair generation
Add key management interfaces and support for generating key pairs in RSA and ECDSA cryptographic processes to the cryptodev module.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-17 11:41:23 +08:00