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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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
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>