Move rpmsg internal APIs from public header include/nuttx/rpmsg/rpmsg.h
to private header drivers/rpmsg/rpmsg.h. These APIs are only used within
the rpmsg driver implementation and should not be exposed to external
modules.
Moved APIs:
- rpmsg_modify_signals()
- rpmsg_ns_bind() / rpmsg_ns_unbind()
- rpmsg_device_created() / rpmsg_device_destory()
- rpmsg_register() / rpmsg_unregister()
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Add trace points to record transitions of g_nx_initstate and to mark
board early/late initialization boundaries. Also add trace marks for
RESET and PANIC to improve boot-time diagnostics and failure analysis.
Add OSINIT_RESET to indicate system is in reset process.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
Add a new getrecvbuf callback to the SPI slave device operations
that allows the slave device to provide a pre-allocated receive
buffer directly to the controller. This enables zero-copy data
transfer by allowing the controller to receive data directly into
the device's buffer instead of copying.
Changes:
- Add SPIS_DEV_GETRECVBUF macro and getrecvbuf callback to
spi_slave_devops_s structure in include/nuttx/spi/slave.h
- Implement getrecvbuf in rpmsg_port_spi_slave driver
- Update getdata to return 0 as it's no longer used for this path
Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit fixes a memory alignment issue in the rpmsg subsystem.
The previous implementation used a flexible array member (rdev[0])
in struct rpmsg_s, but due to automatic 8-byte padding, rpmsg->rdev
could differ from the transport layer's rdev address (e.g.,
rpmsg_virtio->rvdev.rdev), causing potential memory corruption.
Changes:
- Remove rdev[0] flexible array member from struct rpmsg_s
- Add rpmsg_get_rdev_by_rpmsg() inline helper to calculate rdev
address as (rpmsg + 1), ensuring correct pointer arithmetic
- Update all rpmsg->rdev references to use the new helper function
- Fix rpmsg_virtio_notify_wait() to use correct container_of macro
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
This lock is currently used in three places,
mainly to protect tls->tl_mhead. Among them,
pthread_mutex_add and pthread_mutex_remove involve
writing to tls->tl_mhead, and there is
certainly no conflict within the same thread.
As for pthread_mutex_inconsistent, it involves reading. Currently,
it can only be called when the TCB task corresponding to
this tls exits, and the TCB corresponding to the
tls can no longer continue to run.
It seems that adding the lock serves no real purpose.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit fixed the functional correctness issue in hrtimer_start by
adding HRTIMER_MAX_DELAY fr the HRTIMER_MODE_REL.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit added hrtimer_gettime API to support the query of the
rest of the delay time of the hrtimer in nanoseconds.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit move the hrtimer_gettime to clock_systime_nsec to improve
the code reusability.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Since the hrtimer->expired is not monotonic, it can not be used as the
version. This commit added the ownership encoding to ensure the
invariant that the cancelled the timer can not modify the hrtimer again.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Conditionally enable MMU-specific configuration
checks (CONFIG_MM_PGALLOC, CONFIG_MM_PGSIZE,
address base/size definitions) only when
CONFIG_ARCH_USE_MMU is defined. This allows
addrenv support in MPU-based systems that
don't use MMU paging.
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Several code comments in the hrtimer subsystem have become outdated
following recent implementation changes. This patch updates them to
accurately describe the current code behavior and algorithms.
Signed-off-by: Chengdong Wang <wangcd91@gmail.com>
Fix macro line continuation formatting in trace.h by consolidating
multi-line macro definitions onto single lines. This eliminates unnecessary
line continuations and improves code readability while maintaining functionality.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Unify all the cpuname/local_cpuname to struct rpmsg_s, so we can
remove the ops->get_cpuname and ops->get_local_cpuname in
struct rpmsg_ops_s.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Add head pointer checks in notifier_call_chain macros to prevent recursion into
sched_lock() when assertions are triggered during early system startup. This avoids
cascading DEBUGASSERT failures when the notifier head is empty or uninitialized.
backtrace:
DEBUGASSERT(rtcb && rtcb->lockcount < MAX_LOCK_COUNT);
sched_lock()
panic_notifier_call_chain
_assert()
arm64_fatal_handler
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Add compilation condition for 'nx_vsyslog' syscall.
Export 'sched_note_printf_ip' syscall when CONFIG_SYSLOG_TO_SCHED_NOTE=y
Put the implementation of sched_note_printf_ip in libc/misc/lib_note.c
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
Move pthread mutex operations from kernel-space syscall
interface to user-space implementations
to reduce syscall overhead. Relocate mutex holder list
tracking from task control block (tcb) to
thread local storage (tls) to improve memory layout and
cache efficiency. Add helper macros for
conditional mutex implementations and update syscall
interface accordingly.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Since the macro.h may confilict with the user definition, we should
avoid including the macro.h in clock.h.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
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>