Skip to content

Conversation

@CV-Bowen
Copy link
Contributor

@CV-Bowen CV-Bowen commented Dec 18, 2025

Summary

Provide rpmsg_get_signals ops to the transport layer implementation. add rpmsg_get_signals API for rpmsg services to get remote core's status.

Use flag RPMSG_SIGNAL_RUNNING to mark remote core is running or not and api rpmsg_is_running() can use to judge remote core is running or not.

Why need this API:
In the embeded system, somes applications running on a low-power coprocessor (i.e., the Sensor) to decide whether to send data based on the sleep state of the main application processor (AP) primarily aims to achieve communication synchronization and maximize energy efficiency.

Changes

1 rpmsg: Add rpmsg_get_signals API and rpmsg transport ops support

provide get_signals ops to the transport layer implementation.
add rpmsg_get_signals API for rpmsg service to get remote core's
status.

2 rpmsg_port: add rpmsg_port_get_signals api

And set signal_running when rpmsg devices registered

Now rpmsg port transport support to get the remote core's state
by api rpmsg_get_signals()

3 rpmsg_port: print remotes's running state in rpmsg_port_dump

Now rpmsg dump can print the remote core's running/sleep state

4 qemu-armv8a/rpserver and rpproxy: support the rpmsg port uart

Use virtio-serial as the rpmsg-port-uart serial device, so we
can bringup the rpmsg-port-uart in qemu platform.

5 qemu-armv7a/rpserver and rpproxy: support the rpmsg port uart

Use virtio-serial as the rpmsg-port-uart serial device, so we
can bringup the rpmsg-port-uart in qemu platform.

And update the documents:
nuttx/Documentation/platforms/arm/qemu/boards/qemu-armv7a/index.rst

6 qemuv7a/v8a-rpserver/proxy: remove "_ivshmem" suffix and update documents

Now the qemu-armv7a:rpserver_ivshmem, qemu-armv7a:rpproxy_ivshmem and
qemu-armv8a:rpserver_ivshmem, qemu-armv8a:rpproxy_ivshmem are not
only based on the ivshmem device but also the virtio-serial, so
remove the "_ivshmem" suffix and update documents.

Impact

Add new api for the rpmsg services.

Testing

Compiler Pass.
qemuv8a:rpserver and qemuv8a-rpproxy rpmsg/rptun ping and dump
server log:

qemu-system-aarch64 -cpu cortex-a53 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-object memory-backend-file,discard-data=on,id=shmmem-shmem0,mem-path=/dev/shm/my_shmem0,size=4194304,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb \
-device virtio-serial-device,bus=virtio-mmio-bus.0 \
-chardev socket,path=/tmp/rpmsg_port_uart_socket,server=on,wait=off,id=foo \
-device virtconsole,chardev=foo \
-mon chardev=con,mode=readline -kernel ./nuttx/cmake_out/v8a_server/nuttx \
-gdb tcp::7775
[    0.000000] [ 0] [  INFO] [server] pci_register_rptun_ivshmem_driver: Register ivshmem driver, id=0, cpuname=proxy, master=1
[    0.000000] [ 3] [  INFO] [server] pci_scan_bus: pci_scan_bus for bus 0
[    0.000000] [ 3] [  INFO] [server] pci_scan_bus: class = 00000600, hdr_type = 00000000
[    0.000000] [ 3] [  INFO] [server] pci_scan_bus: 00:00 [1b36:0008]
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar0 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar1 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar2 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar3 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar4 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar5 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_scan_bus: class = 00000200, hdr_type = 00000000
[    0.000000] [ 3] [  INFO] [server] pci_scan_bus: 00:08 [1af4:1000]
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar0: mask64=fffffffe 32bytes
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar1: mask64=fffffff0 4096bytes
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar2 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar3 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar4: mask64=fffffffffffffff0 16384bytes
[    0.000000] [ 3] [  INFO] [server] pci_scan_bus: class = 00000500, hdr_type = 00000000
[    0.000000] [ 3] [  INFO] [server] pci_scan_bus: 00:58 [1af4:1110]
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar0: mask64=fffffff0 256bytes
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar1 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar2: mask64=fffffffffffffff0 4194304bytes
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar4 set bad mask
[    0.000000] [ 3] [  INFO] [server] pci_setup_device: pbar5 set bad mask
[    0.000000] [ 3] [  INFO] [server] ivshmem_probe: shmem addr=0x10400000 size=4194304 reg=0x10008000
[    0.000000] [ 3] [  INFO] [server] rptun_ivshmem_probe: shmem addr=0x10400000 size=4194304

NuttShell (NSH) NuttX-12.10.0
server> [    0.000000] [ 0] [  INFO] [proxy] pci_register_rptun_ivshmem_driver: Register ivshmem driver, id=0, cpuname=server, master=0
[    0.000000] [ 3] [  INFO] [proxy] pci_scan_bus: pci_scan_bus for bus 0
[    0.000000] [ 3] [  INFO] [proxy] pci_scan_bus: class = 00000600, hdr_type = 00000000
[    0.000000] [ 3] [  INFO] [proxy] pci_scan_bus: 00:00 [1b36:0008]
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar0 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar1 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar2 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar3 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar4 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar5 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_scan_bus: class = 00000200, hdr_type = 00000000
[    0.000000] [ 3] [  INFO] [proxy] pci_scan_bus: 00:08 [1af4:1000]
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar0: mask64=fffffffe 32bytes
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar1: mask64=fffffff0 4096bytes
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar2 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar3 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar4: mask64=fffffffffffffff0 16384bytes
[    0.000000] [ 3] [  INFO] [proxy] pci_scan_bus: class = 00000500, hdr_type = 00000000
[    0.000000] [ 3] [  INFO] [proxy] pci_scan_bus: 00:58 [1af4:1110]
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar0: mask64=fffffff0 256bytes
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar1 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar2: mask64=fffffffffffffff0 4194304bytes
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar4 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] pci_setup_device: pbar5 set bad mask
[    0.000000] [ 3] [  INFO] [proxy] ivshmem_probe: shmem addr=0x10400000 size=4194304 reg=0x10008000
[    0.000000] [ 3] [  INFO] [proxy] rptun_ivshmem_probe: shmem addr=0x10400000 size=4194304
[    0.000000] [ 3] [  INFO] [proxy] rptun_ivshmem_probe: Start the wdog

server> 
server> 
server> ps
  PID GROUP PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK            STACK    USED FILLED COMMAND
    0     0   0 FIFO     Kthread   - Ready              0000000000000000 0008160 0001792  21.9%  Idle_Task
    1     0 192 FIFO     Kthread   - Waiting  Semaphore 0000000000000000 0008096 0001344  16.6%  hpwork 0x40474c60 0x40474ce0
    2     0 100 FIFO     Kthread   - Waiting  Semaphore 0000000000000000 0008096 0001344  16.6%  lpwork 0x40474d10 0x40474d90
    4     0 224 FIFO     Kthread   - Waiting  Semaphore 0000000000000000 0008096 0001808  22.3%  rptun proxy 0x40494bb8
    5     0 224 FIFO     Kthread   - Waiting  Semaphore 0000000000000000 0008096 0001920  23.7%  rpmsg-uart-rx proxy2 0x404a01f0
    6     0 224 FIFO     Kthread   - Waiting  Semaphore 0000000000000000 0008096 0001968  24.3%  rpmsg-uart-tx proxy2 0x404a01f0
    7     7 100 FIFO     Task      - Running            0000000000000000 0008128 0004176  51.3%  nsh_main
server> ls /dev/rptunm
nsh: ls: stat failed: 2
server> ls /dev/rptun
/dev/rptun:
 proxy
server> ls /dev/rpmsg
/dev/rpmsg:
 proxy2
server> rptun ping /dev/rptun/proxy 1 1 1 1
[    0.000000] [ 7] [ EMERG] [server] ping times: 1
[    0.000000] [ 7] [ EMERG] [server] buffer_len: 2032, send_len: 17
[    0.000000] [ 7] [ EMERG] [server] avg: 0 s, 30814032 ns
[    0.000000] [ 7] [ EMERG] [server] min: 0 s, 30814032 ns
[    0.000000] [ 7] [ EMERG] [server] max: 0 s, 30814032 ns
[    0.000000] [ 7] [ EMERG] [server] rate: 0.004413 Mbits/sec
server> rpmsg ping /dev/rpmsg/proxy2 1 1 1 1
[    0.000000] [ 7] [ EMERG] [server] ping times: 1
[    0.000000] [ 7] [ EMERG] [server] buffer_len: 2024, send_len: 17
[    0.000000] [ 7] [ EMERG] [server] avg: 0 s, 9421344 ns
[    0.000000] [ 7] [ EMERG] [server] min: 0 s, 9421344 ns
[    0.000000] [ 7] [ EMERG] [server] max: 0 s, 9421344 ns
[    0.000000] [ 7] [ EMERG] [server] rate: 0.014435 Mbits/sec
server> rpmsg dump all
[    0.000000] [ 7] [ EMERG] [server] Remote: proxy2 state: 1
[    0.000000] [ 7] [ EMERG] [server] ept NS
[    0.000000] [ 7] [ EMERG] [server] ept rpmsg-sensor
[    0.000000] [ 7] [ EMERG] [server] ept rpmsg-ping
[    0.000000] [ 7] [ EMERG] [server] rpmsg_port queue RX: {used: 0, avail: 8}
[    0.000000] [ 7] [ EMERG] [server] rpmsg buffer list:
[    0.000000] [ 7] [ EMERG] [server] rpmsg_port queue TX: {used: 0, avail: 8}
[    0.000000] [ 7] [ EMERG] [server] rpmsg buffer list:
server> rptun dump all
[    0.000000] [ 7] [ EMERG] [server] Remote: proxy headrx 8
[    0.000000] [ 7] [ EMERG] [server] Dump rpmsg info between cpu (master: yes)server <==> proxy:
[    0.000000] [ 7] [ EMERG] [server] rpmsg vq RX:
[    0.000000] [ 7] [ EMERG] [server] rpmsg vq TX:
[    0.000000] [ 7] [ EMERG] [server]   rpmsg ept list:
[    0.000000] [ 7] [ EMERG] [server]     ept NS
[    0.000000] [ 7] [ EMERG] [server]     ept rpmsg-sensor
[    0.000000] [ 7] [ EMERG] [server]     ept rpmsg-ping
[    0.000000] [ 7] [ EMERG] [server]     ept rpmsg-syslog
[    0.000000] [ 7] [ EMERG] [server]   rpmsg buffer list:
[    0.000000] [ 7] [ EMERG] [server]     RX buffer, total 8, pending 0
[    0.000000] [ 7] [ EMERG] [server]     TX buffer, total 8, pending 0
server> 

@github-actions github-actions bot added Area: Drivers Drivers issues Size: S The size of the change in this PR is small labels Dec 18, 2025
@jerpelea jerpelea changed the title rpmsg: Add rpmsg_get_signals API and rpmsg transport ops support drivers/rpmsg: Add rpmsg_get_signals API and rpmsg transport ops support Dec 18, 2025
jerpelea
jerpelea previously approved these changes Dec 18, 2025
@acassis acassis requested review from cederom, jerpelea and linguini1 and removed request for jerpelea December 18, 2025 11:33
Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this is a new feature, it still requires testing to make sure that it does what it's supposed to. Could you please provide some testing information and logs?

@cederom
Copy link
Contributor

cederom commented Dec 18, 2025

Yes! Special care should be taken here please we already have one CVE for RPC https://nvd.nist.gov/vuln/detail/CVE-2025-35003.

@CV-Bowen
Copy link
Contributor Author

CV-Bowen commented Jan 4, 2026

@linguini1 @cederom Of course, but this PR need add some transport porting patches to verify this feature, and these patches have some dependency on other patches, so I will push other patches first.

Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @CV-Bowen :-)

*rdev and/or *rpmsg may be NULL, please add checks against null pointer dereference.

xiaoxiang781216
xiaoxiang781216 previously approved these changes Jan 4, 2026
@CV-Bowen CV-Bowen dismissed stale reviews from xiaoxiang781216 and jerpelea via 8bb5780 January 5, 2026 07:22
@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Board: arm Board: arm64 Size: M The size of the change in this PR is medium labels Jan 5, 2026
@CV-Bowen
Copy link
Contributor Author

CV-Bowen commented Jan 5, 2026

CI check failed, but it's not related to this PR.
I will force push to retrigger the CI

431cffa5d8 x86_64:fix syscall type mismatch
1914dd0820 net/socket: Check on the end of the NIC name when binding device
../nuttx/tools/checkpatch.sh -c -u -m -g d5633f75a8bff1ab7579922f5e697b2c7e767124..HEADCommit subject missing colon (e.g. 'subsystem: msg')
❌ Missing Signed-off-byMissing git commit message
Used config files:
    1: .codespellrc
/home/runner/work/nuttx/nuttx/nuttx/Documentation/ReleaseNotes/NuttX-12.12.0:57: ans ==> and
/home/runner/work/nuttx/nuttx/nuttx/Documentation/ReleaseNotes/NuttX-12.12.0:154: bootup ==> boot up, boot-up
/home/runner/work/nuttx/nuttx/nuttx/Documentation/ReleaseNotes/NuttX-12.12.0:193: writen ==> written
/home/runner/work/nuttx/nuttx/nuttx/Documentation/ReleaseNotes/NuttX-12.12.0:273: ans ==> and
/home/runner/work/nuttx/nuttx/nuttx/Documentation/applications/testing/nuts/index.rst:167: gaurd ==> guard, gourd
/home/runner/work/nuttx/nuttx/nuttx/Documentation/components/drivers/special/mtd/devices/at45db.rst:12: optin ==> option
Error: /home/runner/work/nuttx/nuttx/nuttx/crypto/rijndael.c:6:82: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/include/crypto/rijndael.h:7:82: error: Long line found
All done! ✨ 🍰 ✨
1 file would be left unchanged.
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md
Error: Process completed with exit code 1.

wyr-7 and others added 6 commits January 5, 2026 15:30
provide get_signals ops to the transport layer implementation.
add rpmsg_get_signals API for rpmsg service to get remote core's
status.

Signed-off-by: Yongrong Wang <[email protected]>
Signed-off-by: cuiziwei <[email protected]>
Signed-off-by: Bowen Wang <[email protected]>
And set signal_running when rpmsg devices registered

Now rpmsg port transport support to get the remote core's state
by api rpmsg_get_signals()

Signed-off-by: liaoao <[email protected]>
Signed-off-by: Bowen Wang <[email protected]>
Now rpmsg dump can print the remote core's running/sleep state

Signed-off-by: liaoao <[email protected]>
Use virtio-serial as the rpmsg-port-uart serial device, so we
can bringup the rpmsg-port-uart in qemu platform.

Server command:
qemu-system-aarch64 -cpu cortex-a53 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-object memory-backend-file,discard-data=on,id=shmmem-shmem0,mem-path=/dev/shm/my_shmem0,size=4194304,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb \
-device virtio-serial-device,bus=virtio-mmio-bus.0 \
-chardev socket,path=/tmp/rpmsg_port_uart_socket,server=on,wait=off,id=foo \
-device virtconsole,chardev=foo \
-mon chardev=con,mode=readline -kernel ./out/nuttx_qemu-armv8a_rpserver_ivshmem/nuttx \
-gdb tcp::7775

Proxy command:
qemu-system-aarch64 -cpu cortex-a53 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-object memory-backend-file,discard-data=on,id=shmmem-shmem0,mem-path=/dev/shm/my_shmem0,size=4194304,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb \
-device virtio-serial-device,bus=virtio-mmio-bus.0 \
-chardev socket,path=/tmp/rpmsg_port_uart_socket,server=off,id=foo \
-device virtconsole,chardev=foo \
-mon chardev=con,mode=readline -kernel ./out/nuttx_qemu-armv8a_rpproxy_ivshmem/nuttx \
-gdb tcp::7776

Signed-off-by: Bowen Wang <[email protected]>
Use virtio-serial as the rpmsg-port-uart serial device, so we
can bringup the rpmsg-port-uart in qemu platform.

And update the documents:
nuttx/Documentation/platforms/arm/qemu/boards/qemu-armv7a/index.rst

Signed-off-by: Bowen Wang <[email protected]>
…ents

Now the qemu-armv7a:rpserver_ivshmem, qemu-armv7a:rpproxy_ivshmem and
qemu-armv8a:rpserver_ivshmem, qemu-armv8a:rpproxy_ivshmem are not
only based on the ivshmem device but also the virtio-serial, so
remove the "_ivshmem" suffix and update documents.

Signed-off-by: Bowen Wang <[email protected]>
@CV-Bowen
Copy link
Contributor Author

CV-Bowen commented Jan 5, 2026

@cederom @linguini1 Please check the last patches and test logs.

Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @CV-Bowen :-)

Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the testing!

@xiaoxiang781216 xiaoxiang781216 merged commit 7dfc62b into apache:master Jan 5, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Area: Drivers Drivers issues Board: arm Board: arm64 Size: M The size of the change in this PR is medium Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants