virtio: cleanup vhost-user-generic and reduce c&p
v8 cover virtio: cleanup vhost-user-generic and reduce c&p
A lot of our vhost-user stubs are large chunks of boilerplate that do (mostly) the same thing. This series continues the cleanups by splitting the vhost-user-base and vhost-user-generic implementations. After adding a new vq_size property 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.
I've also added Manos' vhost-user-sound while I was at it.
Changes
-------
v8
- scrubbed errant Message-Id
v7
- various review comments
- move to async teardown (fixes CI failure)
v6
- re-base to current master
- make vhost-user-device abstract
- mention abstractness in docs
v5
- addressing comments and tags
- improved the docs
v4
- dropped the F_TRANSPORT work for another series
- added vhost-user-sound
Alex Bennée (6):
virtio: split into vhost-user-base and vhost-user-device hw/virtio: convert vhost-user-base to async shutdown hw/virtio: derive vhost-user-rng from vhost-user-base hw/virtio: derive vhost-user-gpio from vhost-user-base hw/virtio: derive vhost-user-i2c from vhost-user-base docs/system: add a basic enumeration of vhost-user devices
Manos Pitsidianakis (1):
hw/virtio: add vhost-user-snd and virtio-snd-pci devices
MAINTAINERS | 13 +
docs/system/devices/vhost-user-rng.rst | 2 +
docs/system/devices/vhost-user.rst | 70 ++-
...{vhost-user-device.h => vhost-user-base.h} | 21 +-
include/hw/virtio/vhost-user-gpio.h | 25 +-
include/hw/virtio/vhost-user-i2c.h | 14 +-
include/hw/virtio/vhost-user-rng.h | 13 +-
include/hw/virtio/vhost-user-snd.h | 24 ++
hw/virtio/vhost-user-base.c | 354 +++++++++++++++
hw/virtio/vhost-user-device-pci.c | 13 +-
hw/virtio/vhost-user-device.c | 338 +--------------
hw/virtio/vhost-user-gpio.c | 406 +-----------------
hw/virtio/vhost-user-i2c.c | 272 +-----------
hw/virtio/vhost-user-rng.c | 278 +-----------
hw/virtio/vhost-user-snd-pci.c | 75 ++++
hw/virtio/vhost-user-snd.c | 67 +++
hw/virtio/Kconfig | 5 +
hw/virtio/meson.build | 23 +-
18 files changed, 719 insertions(+), 1294 deletions(-)
rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
create mode 100644 include/hw/virtio/vhost-user-snd.h
create mode 100644 hw/virtio/vhost-user-base.c
create mode 100644 hw/virtio/vhost-user-snd-pci.c
create mode 100644 hw/virtio/vhost-user-snd.cSignature · 1 line
2.39.2
PATCH v8 1/7 virtio: split into vhost-user-base and vhost-user-device
Lets keep a cleaner split between the base class and the derived vhost-user-device which we can use for generic vhost-user stubs. This includes an update to introduce the vq_size property so the number of entries in a virtq can be defined.
---
v5
- s/parent/parent_obj/
- remove left over vhost-user-device.h
- use DEFINE_TYPES
v6
- rebase and set .abstract = true for vhost-user-device
v7
- checkpatch line length + MAINTAINERS
- s/abstract = true/dc->user_creatable = false/ for both mmio and pci
---
MAINTAINERS | 6 +
...{vhost-user-device.h => vhost-user-base.h} | 21 +-
hw/virtio/vhost-user-base.c | 346 ++++++++++++++++++
hw/virtio/vhost-user-device-pci.c | 13 +-
hw/virtio/vhost-user-device.c | 338 +----------------
hw/virtio/meson.build | 1 +
6 files changed, 383 insertions(+), 342 deletions(-)
rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
create mode 100644 hw/virtio/vhost-user-base.cMAINTAINERS +6 -0
@@ -2263,6 +2263,12 @@ F: include/sysemu/rng*.h F: backends/rng*.c F: tests/qtest/virtio-rng-test.c +vhost-user-stubs +M: Alex Bennée <[email protected]> +S: Maintained +F: hw/virtio/vhost-user-base.c +F: hw/virtio/vhost-user-device* + vhost-user-rng M: Mathieu Poirier <[email protected]> S: Supported
include/hw/virtio/vhost-user-base.h renamed from include/hw/virtio/vhost-user-device.h +12 -9
@@ -6,8 +6,8 @@* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef QEMU_VHOST_USER_DEVICE_H -#define QEMU_VHOST_USER_DEVICE_H +#ifndef QEMU_VHOST_USER_BASE_H +#define QEMU_VHOST_USER_BASE_H #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-user.h"
@@ -17,11 +17,13 @@ OBJECT_DECLARE_TYPE(VHostUserBase, VHostUserBaseClass, VHOST_USER_BASE)struct VHostUserBase { -VirtIODevice parent; +VirtIODevice parent_obj; +/* Properties */ CharBackend chardev;uint16_t virtio_id;uint32_t num_vqs; +uint32_t vq_size;/* can't exceed VIRTIO_QUEUE_MAX */ uint32_t config_size;/* State tracking */ VhostUserState vhost_user;
@@ -31,16 +33,17 @@ struct VHostUserBase { bool connected; }; -/* needed so we can use the base realize after specialisation -tweaks */ +/* +* Needed so we can use the base realize after specialisation +* tweaks +*/ struct VHostUserBaseClass { -/*< private >*/ VirtioDeviceClass parent_class; -/*< public >*/ +DeviceRealize parent_realize; }; -/* shared for the benefit of the derived pci class */ +#define TYPE_VHOST_USER_DEVICE "vhost-user-device" -#endif /* QEMU_VHOST_USER_DEVICE_H */ +#endif /* QEMU_VHOST_USER_BASE_H */
hw/virtio/vhost-user-base.c new file +346 -0
346 lines not on this page · raw message
hw/virtio/vhost-user-device-pci.c +7 -6
@@ -9,21 +9,18 @@#include "qemu/osdep.h" #include "hw/qdev-properties.h" -#include "hw/virtio/vhost-user-device.h" +#include "hw/virtio/vhost-user-base.h" #include "hw/virtio/virtio-pci.h" struct VHostUserDevicePCI {VirtIOPCIProxy parent_obj; +VHostUserBase vub; }; -typedef struct VHostUserDevicePCI VHostUserDevicePCI ; -#define TYPE_VHOST_USER_DEVICE_PCI "vhost-user-device-pci-base" -DECLARE_INSTANCE_CHECKER (VHostUserDevicePCI, -VHOST_USER_DEVICE_PCI , - TYPE_VHOST_USER_DEVICE_PCI) +OBJECT_DECLARE_SIMPLE_TYPE(VHostUserDevicePCI, VHOST_USER_DEVICE_PCI)static void vhost_user_device_pci_realize (VirtIOPCIProxy *vpci_dev,Error **errp) {
@@ -39,6 +36,10 @@ static void vhost_user_device_pci_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtioPCIClass *k =VIRTIO_PCI_CLASS (klass);PCIDeviceClass *pcidev_k =PCI_DEVICE_CLASS (klass); + +/* Reason: stop users confusing themselves */ + dc->user_creatable = false; + k->realize = vhost_user_device_pci_realize;set_bit (DEVICE_CATEGORY_INPUT , dc->categories); pcidev_k->vendor_id =PCI_VENDOR_ID_REDHAT_QUMRANET ;
hw/virtio/vhost-user-device.c +11 -327
373 lines not on this page · raw message
hw/virtio/meson.build +1 -0
@@ -17,6 +17,7 @@ if have_vhost if have_vhost_user # fixme - this really should be generic specific_virtio_ss.add(files('vhost-user.c')) + system_virtio_ss.add(files('vhost-user-base.c')) system_virtio_ss.add(files('vhost-user-device.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) endif
Signature · 1 line
2.39.2
PATCH v8 2/7 hw/virtio: convert vhost-user-base to async shutdown
In reply to Alex BennéeWe are about to convert at least one stubs which was using the async teardown so lets use it for all the cases.
--- hw/virtio/vhost-user-base.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
hw/virtio/vhost-user-base.c +12 -4
@@ -201,6 +201,8 @@ static int vub_connect(DeviceState *dev)return 0 ; } +static void vub_event (void *opaque,QEMUChrEvent event); +static void vub_disconnect (DeviceState *dev) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);
@@ -211,9 +213,13 @@ static void vub_disconnect(DeviceState *dev) } vub->connected = false; -if (vhost_dev_is_started (&vub->vhost_dev)) { -vub_stop (vdev); - } +vub_stop (vdev); +vhost_dev_cleanup (&vub->vhost_dev); + +/* Re-instate the event handler for new connections */ +qemu_chr_fe_set_handlers (&vub->chardev, +NULL ,NULL , vub_event, +NULL , dev,NULL , true); }static void vub_event (void *opaque,QEMUChrEvent event)
@@ -230,7 +236,9 @@ static void vub_event(void *opaque, QEMUChrEvent event) }break ;case CHR_EVENT_CLOSED : -vub_disconnect (dev); +/* defer close until later to avoid circular close */ +vhost_user_async_close (dev, &vub->chardev, &vub->vhost_dev, + vub_disconnect, vub_event);break ;case CHR_EVENT_BREAK :case CHR_EVENT_MUX_IN :
Signature · 1 line
2.39.2
PATCH v8 3/7 hw/virtio: derive vhost-user-rng from vhost-user-base
In reply to Alex BennéeNow we can take advantage of our new base class and make vhost-user-rng a much simpler boilerplate wrapper. Also as this doesn't require any target specific hacks we only need to build the stubs once.
---
v5
- don't remove the in-QEMU RNG emulation!
v7
- s/parent/parent_obj/
--- include/hw/virtio/vhost-user-rng.h | 13 +- hw/virtio/vhost-user-rng.c | 278 +++-------------------------- hw/virtio/meson.build | 9 +- 3 files changed, 31 insertions(+), 269 deletions(-)
include/hw/virtio/vhost-user-rng.h +2 -11
@@ -12,22 +12,13 @@#include "hw/virtio/virtio.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-user.h" -#include "chardev/char-fe.h" +#include "hw/virtio/vhost-user-base.h" #define TYPE_VHOST_USER_RNG "vhost-user-rng" OBJECT_DECLARE_SIMPLE_TYPE(VHostUserRNG, VHOST_USER_RNG)struct VHostUserRNG { -/*< private >*/ -VirtIODevice parent; -CharBackend chardev; -struct vhost_virtqueue *vhost_vq; -struct vhost_dev vhost_dev; -VhostUserState vhost_user; -VirtQueue *req_vq; -bool connected; - -/*< public >*/ +VHostUserBase parent_obj; };#endif /* QEMU_VHOST_USER_RNG_H */
hw/virtio/vhost-user-rng.c +22 -256
310 lines not on this page · raw message
hw/virtio/meson.build +7 -2
@@ -18,8 +18,15 @@ if have_vhost # fixme - this really should be generic specific_virtio_ss.add(files('vhost-user.c')) system_virtio_ss.add(files('vhost-user-base.c')) + + # MMIO Stubs system_virtio_ss.add(files('vhost-user-device.c')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) + + # PCI Stubs system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RNG'], + if_true: files('vhost-user-rng-pci.c')) endif if have_vhost_vdpa system_virtio_ss.add(files('vhost-vdpa.c'))
@@ -37,7 +44,6 @@ specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-us specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_true: files('vhost-user-gpio-pci.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vhost-user-scmi.c'))
@@ -49,7 +55,6 @@ virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vs virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input-pci.c')) -virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true: files('vhost-user-scsi-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-pci.c'))
Signature · 1 line
2.39.2
PATCH v8 4/7 hw/virtio: derive vhost-user-gpio from vhost-user-base
In reply to Alex BennéeNow the new base class supports config handling we can take advantage and make vhost-user-gpio a much simpler boilerplate wrapper. Also as this doesn't require any target specific hacks we only need to build the stubs once.
---
v7
- s/parent/parent_obj/
--- include/hw/virtio/vhost-user-gpio.h | 25 +- hw/virtio/vhost-user-gpio.c | 406 ++-------------------------- hw/virtio/meson.build | 5 +- 3 files changed, 22 insertions(+), 414 deletions(-)
include/hw/virtio/vhost-user-gpio.h +2 -23
@@ -12,34 +12,13 @@#include "hw/virtio/virtio.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-user.h" -#include "standard-headers/linux/virtio_gpio.h" -#include "chardev/char-fe.h" +#include "hw/virtio/vhost-user-base.h" #define TYPE_VHOST_USER_GPIO "vhost-user-gpio-device"OBJECT_DECLARE_SIMPLE_TYPE (VHostUserGPIO,VHOST_USER_GPIO );struct VHostUserGPIO { -/*< private >*/ -VirtIODevice parent_obj; -CharBackend chardev; -struct virtio_gpio_config config; -struct vhost_virtqueue *vhost_vqs; -struct vhost_dev vhost_dev; -VhostUserState vhost_user; -VirtQueue *command_vq; -VirtQueue *interrupt_vq; -/** -* There are at least two steps of initialization of the -* vhost-user device. The first is a "connect" step and -* second is a "start" step. Make a separation between -* those initialization phases by using two fields. -* -* @connected: see vu_gpio_connect()/vu_gpio_disconnect() -* @started_vu: see vu_gpio_start()/vu_gpio_stop() -*/ -bool connected; -bool started_vu; -/*< public >*/ +VHostUserBase parent_obj; };#endif /* _QEMU_VHOST_USER_GPIO_H */
hw/virtio/vhost-user-gpio.c +17 -389
435 lines not on this page · raw message
hw/virtio/meson.build +3 -2
@@ -21,10 +21,13 @@ if have_vhost # MMIO Stubs system_virtio_ss.add(files('vhost-user-device.c')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) # PCI Stubs system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], + if_true: files('vhost-user-gpio-pci.c')) system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RNG'], if_true: files('vhost-user-rng-pci.c')) endif
@@ -44,8 +47,6 @@ specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-us specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) -specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_true: files('vhost-user-gpio-pci.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vhost-user-scmi.c')) specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SCMI'], if_true: files('vhost-user-scmi-pci.c'))
Signature · 1 line
2.39.2
PATCH v8 5/7 hw/virtio: derive vhost-user-i2c from vhost-user-base
In reply to Alex BennéeNow we can take advantage of the new base class and make vhost-user-i2c a much simpler boilerplate wrapper. Also as this doesn't require any target specific hacks we only need to build the stubs once.
---
v7
- s/parent/parent_obj/
--- include/hw/virtio/vhost-user-i2c.h | 14 +- hw/virtio/vhost-user-i2c.c | 272 ++--------------------------- hw/virtio/meson.build | 5 +- 3 files changed, 23 insertions(+), 268 deletions(-)
include/hw/virtio/vhost-user-i2c.h +4 -10
@@ -9,23 +9,17 @@#ifndef QEMU_VHOST_USER_I2C_H #define QEMU_VHOST_USER_I2C_H +#include "hw/virtio/virtio.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-user.h" +#include "hw/virtio/vhost-user-base.h" #define TYPE_VHOST_USER_I2C "vhost-user-i2c-device" + OBJECT_DECLARE_SIMPLE_TYPE(VHostUserI2C, VHOST_USER_I2C)struct VHostUserI2C { -VirtIODevice parent; -CharBackend chardev; -struct vhost_virtqueue *vhost_vq; -struct vhost_dev vhost_dev; -VhostUserState vhost_user; -VirtQueue *vq; -bool connected; +VHostUserBase parent_obj; }; -/* Virtio Feature bits */ -#define VIRTIO_I2C_F_ZERO_LENGTH_REQUEST 0 -#endif /* QEMU_VHOST_USER_I2C_H */
hw/virtio/vhost-user-i2c.c +16 -256
299 lines not on this page · raw message
hw/virtio/meson.build +3 -2
@@ -22,12 +22,15 @@ if have_vhost # MMIO Stubs system_virtio_ss.add(files('vhost-user-device.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) # PCI Stubs system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_true: files('vhost-user-gpio-pci.c')) + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], + if_true: files('vhost-user-i2c-pci.c')) system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RNG'], if_true: files('vhost-user-rng-pci.c')) endif
@@ -46,7 +49,6 @@ specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c')) specific_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_SCMI', if_true: files('vhost-user-scmi.c')) specific_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SCMI'], if_true: files('vhost-user-scmi-pci.c'))
@@ -54,7 +56,6 @@ virtio_pci_ss = ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk-pci.c')) -virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true: files('vhost-user-scsi-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-pci.c'))
Signature · 1 line
2.39.2
PATCH v8 6/7 hw/virtio: add vhost-user-snd and virtio-snd-pci devices
In reply to Alex BennéeFrom: Manos Pitsidianakis <[email protected]>
Tested with rust-vmm vhost-user-sound daemon:
RUST_LOG=trace cargo run --bin vhost-user-sound -- --socket /tmp/snd.sock --backend null
Invocation:
qemu-system-x86_64 \
-qmp unix:./qmp-sock,server,wait=off \
-m 4096 \
-numa node,memdev=mem \
-object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \
-D qemu.log \
-d guest_errors,trace:\*snd\*,trace:\*sound\*,trace:\*vhost\* \
-chardev socket,id=vsnd,path=/tmp/snd.sock \
-device vhost-user-snd-pci,chardev=vsnd,id=snd \
/path/to/disk[AJB: imported from https://github.com/epilys/qemu-virtio-snd/commit/54ae1cdd15fef2d88e9e387a175f099a38c636f4.patch]
---
v7
- s/parent/parent_obj/
- add MAINTAINERS
- add missing s-o-b
--- MAINTAINERS | 7 +++ include/hw/virtio/vhost-user-snd.h | 24 ++++++++++ hw/virtio/vhost-user-snd-pci.c | 75 ++++++++++++++++++++++++++++++ hw/virtio/vhost-user-snd.c | 67 ++++++++++++++++++++++++++ hw/virtio/Kconfig | 5 ++ hw/virtio/meson.build | 3 ++ 6 files changed, 181 insertions(+) create mode 100644 include/hw/virtio/vhost-user-snd.h create mode 100644 hw/virtio/vhost-user-snd-pci.c create mode 100644 hw/virtio/vhost-user-snd.c
MAINTAINERS +7 -0
@@ -2286,6 +2286,13 @@ F: hw/virtio/vhost-user-gpio* F: include/hw/virtio/vhost-user-gpio.h F: tests/qtest/libqos/virtio-gpio.* +vhost-user-snd +M: Alex Bennée <[email protected]> +R: Manos Pitsidianakis <[email protected]> +S: Maintained +F: hw/virtio/vhost-user-snd* +F: include/hw/virtio/vhost-user-snd.h + vhost-user-scmi R: [email protected] S: Supported
include/hw/virtio/vhost-user-snd.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Vhost-user Sound virtio device +* +* Copyright (c) 2021 Mathieu Poirier <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef QEMU_VHOST_USER_SND_H +#define QEMU_VHOST_USER_SND_H + +#include "hw/virtio/virtio.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-user.h" +#include "hw/virtio/vhost-user-base.h" + +#define TYPE_VHOST_USER_SND "vhost-user-snd" +OBJECT_DECLARE_SIMPLE_TYPE(VHostUserSound, VHOST_USER_SND) + +struct VHostUserSound { +VHostUserBase parent_obj; +}; + +#endif /* QEMU_VHOST_USER_SND_H */
hw/virtio/vhost-user-snd-pci.c new file +75 -0
75 lines not on this page · raw message
hw/virtio/vhost-user-snd.c new file +67 -0
67 lines not on this page · raw message
hw/virtio/Kconfig +5 -0
@@ -101,6 +101,11 @@ config VHOST_VDPA_DEV default y depends on VIRTIO && VHOST_VDPA && LINUX +config VHOST_USER_SND + bool + default y + depends on VIRTIO && VHOST_USER + config VHOST_USER_SCMI bool default y
hw/virtio/meson.build +3 -0
@@ -24,6 +24,7 @@ if have_vhost system_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SND', if_true: files('vhost-user-snd.c')) # PCI Stubs system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c'))
@@ -33,6 +34,8 @@ if have_vhost if_true: files('vhost-user-i2c-pci.c')) system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RNG'], if_true: files('vhost-user-rng-pci.c')) + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SND'], + if_true: files('vhost-user-snd-pci.c')) endif if have_vhost_vdpa system_virtio_ss.add(files('vhost-vdpa.c'))
Signature · 1 line
2.39.2
PATCH v8 7/7 docs/system: add a basic enumeration of vhost-user devices
In reply to Alex BennéeMake it clear the vhost-user-device is intended for expert use only.
---
v5
- split vhost-user-device out of the table
- sort the table alphabetically
- add sound and scmi devices
v6
- add note re vhost-user-device
v7
- fix patching description
--- docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 70 +++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-)
docs/system/devices/vhost-user-rng.rst +2 -0
@@ -1,3 +1,5 @@ +.. _vhost_user_rng: + QEMU vhost-user-rng - RNG emulation ===================================
docs/system/devices/vhost-user.rst +69 -1
82 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [PATCH v8 7/7] docs/system: add a basic enumeration of vhost-user devices
Quoted 13 lines · Alex Bennée
Make it clear the vhost-user-device is intended for expert use only.
Signed-off-by Alex Bennée <[email protected]>---
v5
- split vhost-user-device out of the table
- sort the table alphabetically
- add sound and scmi devices
v6
- add note re vhost-user-device
v7
- fix patching description
Quoted 4 lines
--- docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 70 +++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-)
Quoted 7 lines · Alex Bennée
A lot of our vhost-user stubs are large chunks of boilerplate that do (mostly) the same thing. This series continues the cleanups by splitting the vhost-user-base and vhost-user-generic implementations. After adding a new
vq_sizeproperty 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.
Quoted 7 lines
I've also added Manos' vhost-user-sound while I was at it.
Changes
-------v8
- scrubbed errant Message-Id
did you pass this by checkpatch btw? there were some warnings on v6.
Quoted 55 lines
v7
- various review comments
- move to async teardown (fixes CI failure)v6
- re-base to current master
- make vhost-user-device abstract
- mention abstractness in docsv5
- addressing comments and tags
- improved the docsv4
- dropped theF_TRANSPORTwork for another series
- added vhost-user-soundAlex Bennée (6):
virtio: split into vhost-user-base and vhost-user-device hw/virtio: convert vhost-user-base to async shutdown hw/virtio: derive vhost-user-rng from vhost-user-base hw/virtio: derive vhost-user-gpio from vhost-user-base hw/virtio: derive vhost-user-i2c from vhost-user-base docs/system: add a basic enumeration of vhost-user devicesManos Pitsidianakis (1):
hw/virtio: add vhost-user-snd and virtio-snd-pci devicesMAINTAINERS | 13 + docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 70 ++- ...{vhost-user-device.h => vhost-user-base.h} | 21 +- include/hw/virtio/vhost-user-gpio.h | 25 +- include/hw/virtio/vhost-user-i2c.h | 14 +- include/hw/virtio/vhost-user-rng.h | 13 +- include/hw/virtio/vhost-user-snd.h | 24 ++ hw/virtio/vhost-user-base.c | 354 +++++++++++++++ hw/virtio/vhost-user-device-pci.c | 13 +- hw/virtio/vhost-user-device.c | 338 +-------------- hw/virtio/vhost-user-gpio.c | 406 +----------------- hw/virtio/vhost-user-i2c.c | 272 +----------- hw/virtio/vhost-user-rng.c | 278 +----------- hw/virtio/vhost-user-snd-pci.c | 75 ++++ hw/virtio/vhost-user-snd.c | 67 +++ hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 23 +- 18 files changed, 719 insertions(+), 1294 deletions(-) rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%) create mode 100644 include/hw/virtio/vhost-user-snd.h create mode 100644 hw/virtio/vhost-user-base.c create mode 100644 hw/virtio/vhost-user-snd-pci.c create mode 100644 hw/virtio/vhost-user-snd.cSignature · 1 line
2.39.2
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Alex Bennée
A lot of our vhost-user stubs are large chunks of boilerplate that do (mostly) the same thing. This series continues the cleanups by splitting the vhost-user-base and vhost-user-generic implementations. After adding a new
vq_sizeproperty 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.I've also added Manos' vhost-user-sound while I was at it.
Quoted 7 lines
Quoted 5 lines
Changes
-------v8
- scrubbed errant Message-Iddid you pass this by checkpatch btw? there were some warnings on v6.
yes - its checkpatch clean:
https://gitlab.com/stsquad/qemu/-/jobs/5480800819
Quoted 56 lines
Quoted 56 lines
v7
- various review comments
- move to async teardown (fixes CI failure)v6
- re-base to current master
- make vhost-user-device abstract
- mention abstractness in docsv5
- addressing comments and tags
- improved the docsv4
- dropped theF_TRANSPORTwork for another series
- added vhost-user-soundAlex Bennée (6):
virtio: split into vhost-user-base and vhost-user-device hw/virtio: convert vhost-user-base to async shutdown hw/virtio: derive vhost-user-rng from vhost-user-base hw/virtio: derive vhost-user-gpio from vhost-user-base hw/virtio: derive vhost-user-i2c from vhost-user-base docs/system: add a basic enumeration of vhost-user devicesManos Pitsidianakis (1):
hw/virtio: add vhost-user-snd and virtio-snd-pci devicesMAINTAINERS | 13 + docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 70 ++- ...{vhost-user-device.h => vhost-user-base.h} | 21 +- include/hw/virtio/vhost-user-gpio.h | 25 +- include/hw/virtio/vhost-user-i2c.h | 14 +- include/hw/virtio/vhost-user-rng.h | 13 +- include/hw/virtio/vhost-user-snd.h | 24 ++ hw/virtio/vhost-user-base.c | 354 +++++++++++++++ hw/virtio/vhost-user-device-pci.c | 13 +- hw/virtio/vhost-user-device.c | 338 +-------------- hw/virtio/vhost-user-gpio.c | 406 +----------------- hw/virtio/vhost-user-i2c.c | 272 +----------- hw/virtio/vhost-user-rng.c | 278 +----------- hw/virtio/vhost-user-snd-pci.c | 75 ++++ hw/virtio/vhost-user-snd.c | 67 +++ hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 23 +- 18 files changed, 719 insertions(+), 1294 deletions(-) rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%) create mode 100644 include/hw/virtio/vhost-user-snd.h create mode 100644 hw/virtio/vhost-user-base.c create mode 100644 hw/virtio/vhost-user-snd-pci.c create mode 100644 hw/virtio/vhost-user-snd.cSignature · 1 line
2.39.2
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro