A lot of our vhost-user stubs are large chunks of boilerplate that do (mostly) the same thing. This series attempts to fix that by defining a new base class (vhost-user-base) which is used by a generic vhost-user-device implementation. Then the rng, gpio and i2c vhost-user devices become simple specialisations of the common base defining the ID, number of queues and potentially the config handling.
However as of v3 we go a bit further and introduce a new protocol feature called F_STANDALONE which adds some messages to vhost-user that allow the daemon to fully advertise its capabilities. Example ======= Using the vhost-device-rng built from this branch (draft PR): https://github.com/rust-vmm/vhost-device/pull/394 You can start QEMU with an even simpler command line: -chardev socket,id=vus,path=/tmp/vus.sock0 \ -device vhost-user-device-pci,chardev=vus \ -d trace:vhost_\*,trace:vhost_user\* which doesn't specify any queues or config space but gets it from the daemon as it starts up. This does involve a bit of shuffling around in the guts of the vhost code so currently it is RFC status. Anything for 8.1? ================= mst, I don't know if you want to cherry pick anything up to and including: hw/virtio: derive vhost-user-i2c from vhost-user-base which is at least a cleanup. However I'm on holiday for the next 3 or so weeks so it's perfectly ok to leave this as 8.2 material if you want. Alex. Alex Bennée (20): include: attempt to document device_class_set_props include/hw: document the device_class_set_parent_* fns hw/virtio: fix typo in VIRTIO_CONFIG_IRQ_IDX comments include/hw/virtio: document virtio_notify_config include/hw/virtio: add kerneldoc for virtio_init include/hw/virtio: document some more usage of notifiers virtio: add vhost-user-base and a generic vhost-user-device virtio: add PCI stub for vhost-user-device hw/virtio: derive vhost-user-rng from vhost-user-device hw/virtio: add config support to vhost-user-device hw/virtio: derive vhost-user-gpio from vhost-user-device hw/virtio: derive vhost-user-i2c from vhost-user-base docs/system: add a basic enumeration of vhost-user devices docs/interop: define STANDALONE protocol feature for vhost-user hw/virtio: move vhost_user_init earlier hw/virtio: move virtq initialisation into internal helper hw/virtio: push down allocation responsibility for vhost_dev->vqs hw/virtio: validate F_STANDALONE also supports other protocol features hw/virtio: probe backend for specs if it supports it hw/virtio: allow vhost-user-device to be driven by backend docs/interop/vhost-user.rst | 39 +++ docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 41 +++ include/hw/qdev-core.h | 36 +++ include/hw/virtio/vhost-user-blk.h | 1 - include/hw/virtio/vhost-user-device.h | 46 +++ include/hw/virtio/vhost-user-gpio.h | 23 +- include/hw/virtio/vhost-user-i2c.h | 18 +- include/hw/virtio/vhost-user-rng.h | 11 +- include/hw/virtio/vhost.h | 21 ++ include/hw/virtio/virtio.h | 21 ++ backends/vhost-user.c | 1 - hw/block/vhost-user-blk.c | 7 +- hw/display/vhost-user-gpu.c | 4 +- hw/net/virtio-net.c | 4 +- hw/scsi/vhost-scsi.c | 2 - hw/scsi/vhost-user-scsi.c | 6 - hw/virtio/vdpa-dev.c | 9 +- hw/virtio/vhost-user-device-pci.c | 71 +++++ hw/virtio/vhost-user-device.c | 396 ++++++++++++++++++++++++ hw/virtio/vhost-user-fs.c | 5 +- hw/virtio/vhost-user-gpio.c | 400 ++----------------------- hw/virtio/vhost-user-i2c.c | 271 +---------------- hw/virtio/vhost-user-rng.c | 277 ++--------------- hw/virtio/vhost-user.c | 84 ++++++ hw/virtio/vhost-vsock-common.c | 4 +- hw/virtio/vhost.c | 70 +++-- hw/virtio/virtio-crypto.c | 4 +- hw/virtio/meson.build | 20 +- 29 files changed, 898 insertions(+), 996 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c -- 2.39.2 _______________________________________________ Virtio-fs mailing list Virtio-fs@redhat.com https://listman.redhat.com/mailman/listinfo/virtio-fs