Repository navigation
drivers/rptun/rptun_ivshmem: vsock and net entries, vendor resource tables - #21818
Merged
xiaoxiang781216 merged 11 commits intoNov 14, 2026
Merged
Conversation
|
xiaoxiang781216
approved these changes
Nov 13, 2026
CV-Bowen
force-pushed
the
up/P84-rptun-ivshmem-vsock
branch
from
November 13, 2026 09:02
0ba428b to
22bacfa
Compare
Add a virtio-vsock vdev with its three vrings, config space and a carveout to the ivshmem resource table, so the rptun peer can bind vsock over the same shared memory as the rng and rpmsg devices. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Advertise VIRTIO_VSOCK_F_HOST_CID and fill host_cid in the vsock config space, so the driver side learns the cid of the device side instead of assuming VMADDR_CID_HOST. Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Grow the vsock carveout from two to eight shared memory blocks, so the vsock buffers do not run out of shared memory. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Fixed cids 2 and 3 collide when one instance talks to several peers. Set guest_cid from the peer cpu name and host_cid from CONFIG_RPMSG_LOCAL_CPUNAME, using the first four bytes of each. Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
Build the two rng vdevs into the resource table only when CONFIG_DRIVERS_VHOST_RNG is enabled, and number the resource offsets and carveout names sequentially so the table stays consistent when they are left out. Signed-off-by: zhangbo56 <zhangbo56@xiaomi.com>
The master side polls hdr.ver to know the slave has written the resource table. Add a barrier so the table contents are visible before hdr.num and hdr.ver are set. Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
Let a slave register its own resource table with pci_register_rptun_ivshmem_slave_driver() instead of the built-in one. The built-in table becomes a const g_rsc_table that is copied into shared memory, and a NULL table marks the master side. Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com> Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
g_rsc_table hard-coded "server" and "proxy" as the rpmsg cpu names. Use CONFIG_RPMSG_LOCAL_CPUNAME for the remote name and copy the peer name into host_cpuname when the built-in table is used. Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
The const g_rsc_table lost the run-time cid setup; fill guest_cid and host_cid from the cpu names again when the built-in table is copied to shared memory. Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Derive RPTUN_IVSHMEM_VIRTIO_NUM from the enabled vhost devices (rng, rpmsg, vsock) instead of hard-coding it, and guard each vdev entry with its own Kconfig. Drop the second rng vdev and generate the "vdevNbuffer" carveout names in order at run time. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Add a virtio-net vdev with its rx/tx vrings and carveout, gated by CONFIG_DRIVERS_VHOST_NET, so the vhost-net backend can serve the peer. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
CV-Bowen
force-pushed
the
up/P84-rptun-ivshmem-vsock
branch
from
November 13, 2026 13:28
22bacfa to
8443640
Compare
GUIDINGLI
approved these changes
Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The rptun ivshmem resource table only carries two rng devices and one
rpmsg device, fixed at compile time, so a vhost vsock or vhost-net
backend on one side has no vdev to bind to, and a board cannot supply
its own table.
cpu names, so several instances get distinct cids.
pci_register_rptun_ivshmem_slave_driver(cpuname, drvid, rsc_table, rsc_size)lets a slave register its own table; the built-in onebecomes a const
g_rsc_tablecopied into shared memory.Kconfig, and the vdev count follows.
These are kept as separate commits in the order they were made; the
later ones rework the table the earlier ones extend.
Impact
for each vhost backend it enables:
CONFIG_DRIVERS_VHOST_RNG,CONFIG_DRIVERS_VHOST_RPMSG,CONFIG_NET_VSOCK_VHOST,CONFIG_DRIVERS_VHOST_NET. qemu-armv8a:rpproxy enables rng and rpmsg,so its table keeps one rng device (was two) and the rpmsg device.
pci_register_rptun_ivshmem_slave_driver()ininclude/nuttx/rptun/rptun_ivshmem.h.Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
Each commit builds with 0 warnings on qemu-armv8a:rpserver,
qemu-armv8a:rpproxy, both with the vsock overlay below, and
qemu-armv8a:rpproxy with
CONFIG_NET+CONFIG_DRIVERS_VHOST_NET.vsock between the two instances over ivshmem. Overlay on
qemu-armv8a:rpserver and rpproxy:
CONFIG_NET,CONFIG_NET_SOCKOPTS,CONFIG_NET_VSOCK; rpproxy (writes the table) addsCONFIG_DRIVERS_VHOST+CONFIG_NET_VSOCK_VHOST, rpserver addsCONFIG_DRIVERS_VIRTIO+CONFIG_NET_VSOCK_VIRTIO. The vsock testclient is apps/examples/vsock from apache/nuttx-apps#4045.
Echo server on the proxy, client on the server connecting to the
proxy's cid "prox" (0x786f7270):
this PR
master
One of 12 runs crashed at proxy boot in
rptun_ivshmem_wdog()->rptun_callback()->remoteproc_get_notification()->virtqueue.c:429, before any vsock traffic: the polling wdog fireswhile the vring is still being created. The same race shows on master
with the default rpproxy config (seen in #21757 and #21813 testing);
this PR does not touch that path.
No regression in rpmsg: sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC disabled, which current master needs for nxinit to start nsh there; unrelated to this change.