Commit Graph

60916 Commits

Author SHA1 Message Date
anjiahao
adddfc3bfd abi_check.py:Check ABI compatibility between different ELF versions.
1. The input consists of multiple static libraries and an ELF file. The tool searches
   for external APIs used by the static libraries, then locates these API function signatures
   in the ELF file, and outputs the results as a JSON file.
2. Using the first feature, with the static libraries unchanged,
   the tool can take a new ELF file and an old ELF file as input, output two JSON files,
   and compare the function signatures of functions with the same name in the two JSON files.
   The comparison includes return values, parameters, and if they are structures,
   it also compares the structure size, member offsets, member types, etc.
3.When the input is a single ELF file, the tool can check if structures with the same name have different members.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-28 18:32:39 +01:00
Vlad Pruteanu
17393df52a crypto/cryptosoft: Fix HMAC-SHA when a long key is used
When using a key that is longer than the block size of the hashing
algorithm used, the key must be hashed before it is used.

Signed-off-by: Vlad Pruteanu <pruteanuvlad1611@yahoo.com>
2026-01-28 13:14:05 -03:00
Bowen Wang
def2e89b6e qemu-armv8a/netnsh: enabel the virtio-pci transport
Use to verify the virtio pci transport, and update the qemu-armv8a
document.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
b65d2544d2 arm64/qemu-bringup: use common fdt function to register virtio and pci
Use common implementation is better.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
9f351523a7 Documentation/virtio: add VirtIO framework documentation
Add comprehensive VirtIO framework documentation including:
- VirtIO architecture overview (driver layer, framework layer, transport layer)
- Driver and device registration workflow
- Source code directory structure
- API reference for NuttX VirtIO interfaces and OpenAMP virtqueue interfaces

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
0a27aef078 virtio/virtio-pci-modern: support PCI_RESOURCE_MEM_64 capability
On 64-bit platforms, the capability flags use PCI_RESOURCE_MEM_64
instead of PCI_RESOURCE_MEM. Add support to find both flag types.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
4f591e19db virtio/virtio-pci: add PCI INTX interrupt fallback support
Fall back to INTX interrupt mode when MSI/MSI-X is not supported
or MSI-X IRQ connection fails. This improves compatibility with
more virtio-pci devices.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
63c147bfa4 virtio/virtio-pci: remove unused config change IRQ handler
The config change IRQ is not currently used. Remove it now and
add it back when actually needed.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
Bowen Wang
5c835881b2 virtio/virtio-pci: improve debug logging and fix comments
- Replace pciXXX() debug calls with vrtXXX() for consistency
- Add additional debug logging for better traceability
- Fix minor comment typos

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 13:09:19 -03:00
hujun5
effdb88710 sched_getscheduler.c: coverity HIS_metric_violation: RETURN
Refactor nxsched_get_scheduler() to consolidate multiple return statements into a single
exit point by inverting the null check condition. This improves code structure and resolves
Coverity HIS_metric_violation defect for better MISRA HIS standards compliance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:07:20 -03:00
hujun5
a4d09a4e25 sched_sysinfo.c: misra_c_2012_rule_9_1_violation: uninit_use
Initialize the cpuload_s structure with zero values at declaration to eliminate
uninitialized variable usage. This resolves MISRA C 2012 Rule 9.1 violation and
ensures consistent, predictable system information retrieval behavior.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:05:04 -03:00
hujun5
e171f547fa sem_post.c: coverity HIS_metric_violation: RETURN
Refactor nxsem_post_slow() to consolidate multiple return statements into a single exit point
by introducing a result variable and wrapping semaphore operations in an error-check condition block.
This improves code structure and resolves Coverity HIS_metric_violation defect for MISRA HIS standards compliance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:04:11 -03:00
hujun5
dc6ddd8d4d sched: Fix scheduler CPU selection and ready-to-run list management
Fix critical issues in SMP scheduler: correct CPU selection logic by
removing redundant lock check and prioritizing eligible CPUs, simplify
ready-to-run list addition by removing unnecessary condition check and
early validation, and relocate switch_running() call for proper cleanup
sequencing in remove_self() operation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 13:02:58 -03:00
hujun5
2df1ecca3c semaphore.h: fix ubsan error
Replace left-shift of 1 by 31 bits with direct hexadecimal constant
to eliminate undefined behavior warning when left-shifting signed values
beyond their bit width on platforms with strict sanitizer checking.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 12:45:11 -03:00
hujun5
3a214b5808 sem_waitirq.c: coverity HIS_metric_violation: RETURN
Refactor nxsem_wait_irq() to consolidate multiple return statements into a single
exit point by inverting the mutex condition check. This improves code maintainability
and resolves Coverity HIS_metric_violation defect for better compliance with MISRA HIS standards.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 23:43:16 +08:00
dongjiuzhu1
afaaa7b8cb include/notifier: fix undefined reference to spin_lock_irqsave_nopreempt
Fix linker error caused by including spinlock_type.h instead of
spinlock.h in notifier.h header file.

Error message:
  undefined reference to 'spin_lock_irqsave_nopreempt'
  in .text.clock_changed_notifier_call_chain

Root cause:
The notifier.h header was including <nuttx/spinlock_type.h> which only
provides type definitions, but the inline functions in notifier.h use
spinlock functions like spin_lock_irqsave_nopreempt(). These functions
are defined in <nuttx/spinlock.h>, not in spinlock_type.h.

Solution:
Change the include from <nuttx/spinlock_type.h> to <nuttx/spinlock.h>
to get both the type definitions and the function implementations.

This fixes the undefined reference error when using notifier chains
with spinlock protection.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-28 23:37:32 +08:00
dongjiuzhu1
1946bc4e44 drivers/serial: fix crash when buffer is full and only recvbuf is implemented
When the receive buffer is full and the driver only implements recvbuf
operation without receive operation, the code would crash due to calling
a NULL function pointer. This patch fixes the issue by:

1. Check if recvbuf is available before calling it
2. When buffer is full, use a temporary buffer to drain hardware FIFO
   to prevent data accumulation in hardware
3. Add proper NULL check for receive operation to avoid crash
4. Initialize pbuf to NULL to prevent uninitialized variable usage

This ensures the serial driver works correctly even when only recvbuf
is implemented and the receive buffer is full.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-28 22:19:21 +08:00
hujun5
c7bb7ece8e sched_profil.c: misra_c_2012_rule_8_9_violation
Move static g_prof variable declaration into block scope for the profil()
function when CONFIG_SMP is disabled, following MISRA C 2012 Rule 8.9 which
requires objects used by only one function to be declared within that function's scope.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 22:01:45 +08:00
hujun5
dde0d7405d sched_getfiles.c: coverity HIS_metric_violation: RETURN
This change consolidates multiple return statements in nxsched_get_fdlist_from_tcb()
into a single exit point to reduce cyclomatic complexity and comply with MISRA HIS
coding standards for safety-critical embedded systems.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 22:01:01 +08:00
Peter van der Perk
79ce1647da arch/arm: GPIO IMX9 Add support for IRQ line1 and GPIO5
Adds support to select irq line 1 to share the same GPIO with Linux
Also added GPIO5 definiton for IRQ

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-28 21:13:31 +08:00
Peter van der Perk
99501bba9a arch/arm: LPSPI imx9 add support for 2nd CS
If pinconfig are defined for CS1 then configure CS

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-28 21:13:19 +08:00
Bowen Wang
0a96f116bb boards/sim and qemuv7a: enable SCHED_EVENTS for boards used rpmsg port uart
Enable CONFIG_SCHED_EVENTS for the sim:rpproxy_uart,rpserver_uart and
qemu-armv7a:rpproxy,rpserver configurations because rpmsg port uart
depends on the SCHED_EVENTS now.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
0d628cfc5b Documentation/rpmsg: add RPMsg Port UART transport documentation
Add documentation for RPMsg Port UART, a transport layer that enables
RPMsg communication between SoCs via UART when shared memory is not
available.

The documentation covers:
- Hardware requirements (UART with flow control)
- Software architecture
- Escape coding protocol for command/data separation
- Connection establishment protocol
- Data frame format
- Low power support with ping-pong wake mechanism

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
eee50fc6cf Documentation/rpmsg: add RPMsg Port transport layer documentation
Add comprehensive documentation for the RPMsg Port abstract transport
layer, which supports cross-SoC communication via physical backends
like SPI and UART.

The documentation covers:
- Architecture overview and layer diagram
- Buffer management with TX/RX free and ready lists
- Buffer layout with header reservation
- Data transmission and reception flow

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
zhangbo56
6735550815 drivers/rpmsg_port_uart: Fix some compile warnings
some printf formats warning fix

Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
6b7acc1760 drivers/rpmsg_port_uart: clear the connected stats first when recv poweroff
When recv peer poweroff command, should clear the connected status
first to avoid there is data to send when call the rpmsg_unregister(),
then tx thread hang at the data send process but peer has power
off.

When clear the connected status first, rpmsg_port_uart_tx_ready()
will drop the tx packet to avoid tx thread is waked up to send useless
data.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
8889bdd967 drivers/rpmsg_port_uart: do rpmsg_port_unreigster when connected
rpmsg_port_unreigster() should be called after rpmsg_port_reigster(),
so add the connected condition when receive poweroff command.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
f93876228a drivers/rpmsg_port_uart: add rpmsg_port_uart dump support
Dump the rx/tx thread backtrace.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
7496666de3 drivers/rpmsg_port: support dump ops and dump when get buffer timeout
To debug the tx buffer get failed issue, the rpmsg port uart/spi
can use this mechanism to dump more debug informations.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
e36fd2d05a drivers/rpmsg_port_uart: support the rx recursive logic
Fix the case that tx thread want to send data to peer and try to
wakeup peer, but rx thread blocked on the tx buffer got procees and
so rx thread can't process the commands includes the wakeup ack
command, then the tx thread will hang at the wakeup process forever.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
b200f49697 drivers/rpmsg_port: notify the lower transport when no free buffers
When no free buffers, notify the lower transport, so the lower
transports can know this thing and do some work, such as continue
to process the rx data to avoid the rx thread is blocked that
even can't process the commands.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: liaoao <liaoao@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
5efa6b8ecd drivers/rpmsg_port_uart: move the command process to a function
Extract command process code to a standalone function to simplify
the rx thread code.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
4dce10e024 drivers/rpmsg_port_uart: rename tx/rxwakelock to tx/rx_wakelock
Unified naming method

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
42809c17a7 drivers/rpmsg_port_uart: use ping-pong wake/ack to fix wake/ack issue
Orignal issue: the new wakeup process may be waked by the last Ack
command from peer, and lead the data is lost because peer may have
enter into the sleep mode.

W = Wake, A = WakeAck, R = Relax, D = Data
TX: [0]W-[1]R--------[4]W----[6]DDDDDDDDDDDD-------
RX: ------------[3]A----[5]Enter Sleep-------------

In this figure, Ack command [3] wakeup the wakeup process [4] because
[3] may be received with a delay.

Now use the ping-pong wake/ack command to fix this issue because
the different wake/ack command can block the last Ack command
wake the wrong wakeup process.
W1 = Wake1, A1 = WakeAck1, W2 = Wake2, A2 = WakeAck2, R = Relax, D = Data
TX: [0]W1-[1]R-------[4]W2----------[6]DDDDDDDDDDD--
RX: ------------[3]A1---------[5]A2-----------------

With this patch, the Ack comamnd [3] can't wakeup the wakeup process [4]
because [3] is Ack1 but [4] is Wake2, and local will not send data until
peer response a [5]Ack2.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
4025f258c7 drivers/rpmsg_port_uart: dump error data when recv error char
Try to dump more error log to catch the uart trasmission issue.
1. dump the received error char when received the non start char
at the wait start state;
2. dump the dbg buffer and received buffer when received the
duplicate end char at the wait start state;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
f833f0ed79 drivers/rpmsg_port_uart: add debug buffer for rpmsg_port_uart
Record the history receive data for debug

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
df366b591f drivers/rpmsg_port_uart: add reboot notifier for rpmsg_port_uart
Peer will receive the power off command and unregister the rpmsg
connections to avoid the rpmsg services stuck at the rpmsg operations.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
3e9003802b drivers/rpmsg_port_uart: support wake up by peer core
Support wakeup by peer core (Linux)

1. Add 3 commands: STAYWAKE/RELAXWAKE/STAYWAKEACK

Local will stay the wakeup source when received the STAYWAKE command
and relax the pm wake soucre when received the RELAXWAKE.
And local should response the STAYWAKEACK to peer to notify local has
been waked up.

Local core must send the RELAXWAKE command to peer when there is nothing
to do (send/receive data) otherwise peer can't enter into sleep mode.
So we wakeup the tx thread to send the RELAXWAKE command at the time
that may blocked in the file_read() in rx thread.

NOTE:
Local core should relax the pm wakelock when received POWEROFF
command to allow enter into sleep mode when peer core SHUTDOWN.

2. Change all the flags to event, use event is more convinent
to reprsent all the flags. But the tx sem must be kept because we need
support notify the tx is ready event the tx thread is running to avoid
miss any tx ready event.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
af7ff1b52b drivers/rpmsg_port_uart: process the commands as much as possible
To avoid the command is not processed when hang in the rx_cb

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
d0185e2746 drivers/rpmsg_port_uart: change some important debug logs level
Increace some important debug logs level fot debug

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
ee02d0c769 drivers/rpmsg_port_uart: switch the uart IO to GPIO when peer poweroff
Use the TIOCVHANGUP to notify the driver to switch the uart io
to gpio mode to avoid the current leak caused by the uart io because
peer core may already poweroff so the io can be in high voltage
state.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
579cf47299 drivers/rpmsg_port_uart: reserved more commands for future use
To maintain compatibility in future update, the data transfer is
still valid even can't process the new added command.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Bowen Wang
2386d80d53 drivers/rpmsg_port_uart: do not panic when received error happened
1. Dump the error log and continue process the next packet when
received error happened instead direclty panic to allow use adb
to update peer core's firmeware;
2. Add more error log to debug the receive error;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-28 19:23:41 +08:00
Xiang Xiao
91d4aeba66 drivers/rpmsg_port_uart: unify the timeout usage
All the timeout use macro RPMSG_PORT_UART_TIMEOUT

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-01-28 19:23:41 +08:00
Xiang Xiao
4bbccac6f0 drivers/rpmsg_port_uart: Zero next when hit RPMSG_PORT_UART_RX_WAIT_START twice
align the behaviour with Linux driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-01-28 19:23:41 +08:00
wangchengdong
1196f0869e board/fvp-armv8r: enable hrtimer CITEST on fvp-armv8r:citest
Enable  high-resolution timer (hrtimer) using the list
implementation in the CITEST configuration on fvp-armv8r:citest.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-28 18:20:41 +08:00
wangchengdong
f87b3997f8 board/qemu-rv: enable hrtimer CITEST on rv-virt:citest64
Enable the default high-resolution timer (hrtimer) using the RB-tree
implementation in the CITEST configuration on rv-virt:citest64.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-28 18:20:41 +08:00
zhenwei fang
2614693bc0 mps:fix AN524 Kconfig symbol (MPS3, not MPS2)
The code currently checks CONFIG_ARCH_CHIP_MPS2_AN524, but
the corresponding Kconfig option is ARCH_CHIP_MPS3_AN524(i.e.
 CONFIG_ARCH_CHIP_MPS3_AN524) in arch/arm/src/mps/Kconfig

Signed-off-by: zhenwei fang <fangzhenwei@bytedance.com>
2026-01-28 18:20:11 +08:00
dongjiuzhu1
90fa0ed122 drivers/sensors: sensor bug fix.
Some checks failed
Build Documentation / build-html (push) Has been cancelled
fix deadlock about set_nonwakeup.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-28 16:50:19 +08:00
pangzhen1
7b154402fb sched/irq: Consolidate IRQ bounds checking into IRQ_TO_NDX macro
Previously, IRQ bounds checking (irq >= 0 && irq < NR_IRQS) was duplicated
across multiple IRQ subsystem functions before calling IRQ_TO_NDX(). This
led to code duplication and inconsistency.

This patch consolidates all IRQ bounds checking into the IRQ_TO_NDX() macro
itself, which now returns -EINVAL for out-of-bounds IRQ numbers. This approach:

1. Eliminates duplicated bounds checking code
2. Ensures consistent error handling across all IRQ functions
3. Simplifies caller code - just check if IRQ_TO_NDX() returns negative
4. Makes the macro behavior more predictable and self-contained

Changes:
- Modified IRQ_TO_NDX() to check (irq < 0 || irq >= NR_IRQS) and return -EINVAL
- Removed redundant IRQ range checks in irq_attach(), irq_attach_thread(),
  irq_attach_wqueue(), and irqchain_detach()
- Simplified error handling to check ndx < 0 after IRQ_TO_NDX() call

This consolidation reduces code size and improves maintainability while
preserving all existing error checking functionality.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-28 13:35:30 +08:00