CV-Bowen opened a new pull request, #22552:
URL: https://github.com/apache/nuttx/pull/22552
## Summary
Fixes and small improvements in drivers/vhost, in commit order:
- `drivers/vhost/vhost-can: fix the build`: vhost-can does not build on
master:
```
vhost-can.c:547:33: error: passing argument 2 of 'psock_poll' from
incompatible pointer type [-Werror=incompatible-pointer-types]
vhost-can.c:801:25: error: 'struct pollfd' has no member named 'arg'
vhost-can.c:881:25: error: 'struct net_driver_s' has no member named
'd_ifindex'
```
and then fails to link on `psock_setsockopt`. Use `struct pollfd_s`, and
select `NETDEV_IFINDEX` and `NET_CAN_SOCK_OPTS`.
- `drivers/vhost/vhost-blk: implement the dump callback`: path, worker pid
and block geometry.
- `drivers/vhost: use _emerg() instead of syslog(LOG_EMERG)` in
`vhost_dump()`, as the virtio side does.
- `drivers/vhost/vhost-i2c: clear the callback of the decoded message`: the
`struct i2c_msg_s` is on the stack and `virtio_i2c_decode()` never sets
`callback`/`arg`; a non-NULL `callback` asks the I2C master for an
asynchronous transfer.
- `drivers/vhost/vhost-rpmb: implement the dump callback`: path and worker
pid.
- `drivers/vhost/vhost-can: keep the driver per CPU in BMP mode, enable CAN
FD`: the other vhost drivers use `DEFINE_PER_CPU_BMP()` for their
`struct vhost_driver`; vhost-can was missed. It also sets
`CAN_RAW_FD_FRAMES`, which needs `NET_CAN_CANFD`, so select
`NET_CAN_HAVE_CANFD`.
## Impact
`DRIVERS_VHOST_CAN` now selects `NETDEV_IFINDEX`, `NET_CAN_SOCK_OPTS` and
`NET_CAN_HAVE_CANFD`; it did not build before. No API change. `vhost dump`
prints more for vhost-blk and vhost-rpmb.
## 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
**Build, each commit.** qemu-armv8a:rpproxy + `CONFIG_NET_CAN=y
CONFIG_DRIVERS_VHOST_CAN=y CONFIG_I2C=y CONFIG_I2C_DRIVER=y
CONFIG_DRIVERS_VHOST_I2C=y CONFIG_DRIVERS_VHOST_RPMB=y
CONFIG_DRIVERS_VHOST_BLK=y`: 0 warnings at every commit. On master the
same configuration fails with the errors above.
**vhost-blk dump.** sim:rpserver (+`DRIVERS_VIRTIO_BLK`) and sim:rpproxy
(+`DRIVERS_VHOST_BLK`), both with `CONFIG_BCH=y CONFIG_FS_BLOCK_DRIVER=y`.
Test-only, not in this PR: a blk vdev in the sim rptun resource table,
backed by a 128-sector RAM disk `/dev/ram8` on the proxy.
`dd if=/dev/zero of=/dev/virtblk0 bs=512 count=4` on the server, then
`vhost dump all` on the proxy:
```
master: [Block] id=2 hdev=... driver=... priv=...
this PR: [Block] id=2 hdev=... driver=... priv=...
vhost_blk_dump: path=/dev/ram8 pid=10
vhost_blk_dump: nsectors=128 sectorsize=512
```
**vhost-rpmb dump.** qemu-armv8a:rpserver (+`DRIVERS_VIRTIO_RPMB`) and
qemu-armv8a:rpproxy (+`DRIVERS_VHOST_RPMB`) over rptun_ivshmem, with a
test-only fake `/dev/mmcsd0rpmb` on the proxy. `vhost dump all` on the
proxy:
```
master: [unknown] id=28 hdev=... driver=... priv=...
this PR: [unknown] id=28 hdev=... driver=... priv=...
vhost_rpmb_dump: path=/dev/mmcsd0rpmb pid=8
```
**vhost-i2c.** qemu-armv8a:rpserver (+`DRIVERS_VIRTIO_I2C`,
`SYSTEM_I2CTOOL`) and qemu-armv8a:rpproxy (+`DRIVERS_VHOST_I2C`), both with
`CONFIG_I2C=y CONFIG_I2C_DRIVER=y`; test-only I2C register file at 0x50 on
the proxy's `/dev/i2c0`. `i2c set -b 0 -a 50 -r 10 -s a5`,
`... -r 11 -s 3c`, then `i2c get` of both: a5 and 3c read back on master and
with this PR. The test bus ignores `callback`, so the stale value on master
does not show here.
vhost-can: build only. There is no VirtIO CAN frontend in the tree to run
it against.
**Baseline.** No regression in rpmsg: sim:rpserver/rpproxy and
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping,
rpmsgfs; 15/15). No regression in virtio: qemu-armv8a:netnsh boot and pass the
fixed virtio cases (rng, blk on mmio and pci, net, 9p; 24/24). 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. checkpatch
passes.
--
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]