CV-Bowen opened a new pull request, #21577:
URL: https://github.com/apache/nuttx/pull/21577

   ## Summary
   
   Switch the virtio and vhost buses from `struct list_node` to the
   `dq_queue_s` helpers in `<nuttx/queue.h>`, which rpmsg and rptun already
   use, so the four modules share one list type. Later virtio/vhost changes
   (dump support, new drivers) are written against the dq version.
   
   - `nuttx/queue`: add `sq_for_every_entry()`, `sq_for_every_entry_safe()`
     and the `dq_` aliases, the queue counterparts of
     `list_for_every_entry()` / `list_for_every_entry_safe()`, with the
     macro arguments parenthesized.
   - `drivers/virtio,vhost`: `struct virtio_driver` / `struct vhost_driver`
     `.node` becomes `dq_entry_s`, and the bus device/driver lists become
     `dq_queue_s`. A zeroed `dq_queue_s` is an empty queue, so the bus and
     every in-tree driver drop their `LIST_INITIAL_VALUE()` initializers.
     `node` is the last member, so the positional initializers of the other
     fields are unchanged.
   
   No functional change.
   
   ## Impact
   
   - API: `struct virtio_driver.node` and `struct vhost_driver.node` change
     type. Out-of-tree drivers must drop `LIST_INITIAL_VALUE(x.node)` from
     their initializer; registration (`virtio_register_driver()` /
     `vhost_register_driver()`) is unchanged.
   - New macros in `<nuttx/queue.h>`; nothing else in the tree changes.
   - No Kconfig change.
   
   ## 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
   
   Both buses are exercised at runtime:
   
   - virtio: `qemu-armv8a:netnsh` with virtio rng, blk (mmio and pci), net
     and 9p, running the fixed virtio cases (probe through the bus, then
     rng read, blk write/remount/compare, mmio<->pci copy, ping, 9p).
   - vhost and virtio together: `sim:rpserver` / `sim:rpproxy` and
     `qemu-armv8a:rpserver` / `rpproxy`, where rpmsg runs over
     `vhost-rpmsg` on one side and `virtio-rpmsg` on the other, plus
     vhost-rng/virtio-rng on sim.
   
   <details><summary>results.md</summary>
   
   Baseline (`test.sh`, cases: baseline.yaml + virtio.yaml):
   
   - 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
   - tested: nuttx 5654f00d943 apps 19a303645
   - qemu-armv8a:rpserver qemu-armv8a:rpproxy built with test-only overlay: 
disabled LIBC_ENVPATH BINFMT_CHECKEXEC
   - qemu-armv8a:netnsh built with test-only overlay: disabled LIBC_ENVPATH 
BINFMT_CHECKEXEC
   - sim:rpserver + sim:rpproxy: PASS
     - [x] `uname -a` (server)
     - [x] `rpmsg dump all` (server)
     - [x] `rpmsg ping all 10 1024 3 0` (server)
     - [x] `uname -a` (proxy)
     - [x] `rpmsg ping all 10 1024 3 0` (proxy)
     - [x] `mount -t rpmsgfs -o cpu=server,fs=/proc /sp` (proxy)
     - [x] `cat /sp/version` (proxy)
     - [x] `rpmsg dump all` (proxy)
   - qemu-armv8a:rpserver + qemu-armv8a:rpproxy: PASS
     - [x] `uname -a` (server)
     - [x] `uname -a` (proxy)
     - [x] `rpmsg dump all` (server)
     - [x] `rpmsg ping all 10 1024 3 0` (server)
     - [x] `rpmsg ping all 10 1024 3 0` (proxy)
     - [x] `mount -t rpmsgfs -o cpu=server,fs=/proc /sp` (proxy)
     - [x] `cat /sp/version` (proxy)
   - qemu-armv8a:netnsh: PASS
     - [x] `dd if=/dev/random of=/dev/null bs=4096 count=16` (nsh)
     - [x] `hexdump /dev/random count=32` (nsh)
     - [x] `mkfatfs /dev/virtblk0` (nsh)
     - [x] `mount -t vfat /dev/virtblk0 /m0` (nsh)
     - [x] `dd if=/dev/random of=/m0/a bs=4096 count=64` (nsh)
     - [x] `dd if=/dev/random of=/m0/c bs=65536 count=4` (nsh)
     - [x] `cp /m0/a /m0/b` (nsh)
     - [x] `umount /m0` (nsh)
     - [x] `mount -t vfat /dev/virtblk0 /m0` (nsh)
     - [x] `if cmp /m0/a /m0/b; then echo SAME; fi` (nsh)
     - [x] `mkfatfs /dev/virtblk1` (nsh)
     - [x] `mount -t vfat /dev/virtblk1 /m1` (nsh)
     - [x] `cp /m0/c /m1/c` (nsh)
     - [x] `umount /m1` (nsh)
     - [x] `mount -t vfat /dev/virtblk1 /m1` (nsh)
     - [x] `if cmp /m0/c /m1/c; then echo SAME; fi` (nsh)
     - [x] `cp /m1/c /m0/d` (nsh)
     - [x] `if cmp /m1/c /m0/d; then echo SAME; fi` (nsh)
     - [x] `ping -c 3 10.0.2.2` (nsh)
     - [x] `ping -c 3 -s 1400 10.0.2.2` (nsh)
     - [x] `mount -t v9fs -o trans=virtio,tag=host /h` (nsh)
     - [x] `cat /h/f.txt` (nsh)
     - [x] `echo nuttx-9p > /h/w.txt` (nsh)
     - [x] `cat /h/w.txt` (nsh)
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] drivers/virtio,vhost: us... CV-Bowen (via GitHub) via commits

Reply via email to