virtio: cleanup vhost-user-generic and reduce c&p + vhost-user-input
v9 cover virtio: cleanup vhost-user-generic and reduce c&p + vhost-user-input
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 and Leo's vhost-user-input stubs which are based on the same base.
Changes
-------
v9
- re-base and fix conflicts
- add Leo's vhost-user-input series
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
Leo Yan (4):
hw/virtio: Support set_config() callback in vhost-user-base docs/system: Add vhost-user-input documentation hw/virtio: Move vhost-user-input into virtio folder hw/virtio: derive vhost-user-input from vhost-user-base
Manos Pitsidianakis (1):
hw/virtio: add vhost-user-snd and virtio-snd-pci devices
MAINTAINERS | 16 +-
docs/system/device-emulation.rst | 1 +
docs/system/devices/vhost-user-input.rst | 45 ++
docs/system/devices/vhost-user-rng.rst | 2 +
docs/system/devices/vhost-user.rst | 72 +++-
...{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 ++
include/hw/virtio/virtio-input.h | 6 +-
hw/input/vhost-user-input.c | 136 ------
hw/virtio/vhost-user-base.c | 371 ++++++++++++++++
hw/virtio/vhost-user-device-pci.c | 13 +-
hw/virtio/vhost-user-device.c | 338 +--------------
hw/virtio/vhost-user-gpio.c | 407 +-----------------
hw/virtio/vhost-user-i2c.c | 272 +-----------
hw/virtio/vhost-user-input-pci.c | 3 -
hw/virtio/vhost-user-input.c | 58 +++
hw/virtio/vhost-user-rng.c | 294 +------------
hw/virtio/vhost-user-snd-pci.c | 75 ++++
hw/virtio/vhost-user-snd.c | 67 +++
hw/input/meson.build | 1 -
hw/virtio/Kconfig | 5 +
hw/virtio/meson.build | 27 +-
25 files changed, 850 insertions(+), 1456 deletions(-)
create mode 100644 docs/system/devices/vhost-user-input.rst
rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%)
create mode 100644 include/hw/virtio/vhost-user-snd.h
delete mode 100644 hw/input/vhost-user-input.c
create mode 100644 hw/virtio/vhost-user-base.c
create mode 100644 hw/virtio/vhost-user-input.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 v9 1/11 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
@@ -2304,6 +2304,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
Re: [PATCH v9 01/11] virtio: split into vhost-user-base and vhost-user-device
Quoted 30 lines · Alex Bennée
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_sizeproperty so the number of entries in a virtq can be defined.Signed-off-by Alex Bennée <[email protected]>---
v5
- s/parent/parent_obj/
- remove left overvhost-user-device.h
- useDEFINE_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 100644hw/virtio/vhost-user-base.c
hw/virtio/vhost-user-device.c static void vud_class_init(ObjectClass *klass, void *data) · line 46
Quoted 5 lines
hw/virtio/vhost-user-device.c +2
-0@@ -358,6 +42,9 @@ static void vud_class_init(ObjectClass *klass, void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +/* Reason: stop inexperienced users confusing themselves */ + dc->user_creatable = false;
What about making VHOST_USER_DEVICE_PCI and TYPE_VHOST_USER_DEVICE TypeInfos abstract instead?
Quoted 12 lines
hw/virtio/vhost-user-device.c +1
-2+device_class_set_props (dc, vud_properties); dc->vmsd = &vud_vmstate;set_bit (DEVICE_CATEGORY_INPUT , dc->categories);@@ -366,14 +53,11 @@ static void vud_class_init(ObjectClass *klass, void *data)static const TypeInfo vud_info = { .name =TYPE_VHOST_USER_DEVICE , .parent =TYPE_VHOST_USER_BASE , - .instance_size =sizeof (VHostUserBase), .class_init = vud_class_init, - .class_size =sizeof (VHostUserBaseClass), };
Re: [PATCH v9 01/11] virtio: split into vhost-user-base and vhost-user-device
Quoted 28 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Alex Bennée
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_sizeproperty so the number of entries in a virtq can be defined.Signed-off-by Alex Bennée <[email protected]>---
v5
- s/parent/parent_obj/
- remove left overvhost-user-device.h
- useDEFINE_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 100644hw/virtio/vhost-user-base.c
Quoted 9 lines
hw/virtio/vhost-user-device.c static void vud_class_init(ObjectClass *klass, void *data) · line 45
Quoted 5 lines
hw/virtio/vhost-user-device.c +1
-0@@ -358,6 +42,9 @@ static void vud_class_init(ObjectClass *klass, void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +/* Reason: stop inexperienced users confusing themselves */ + dc->user_creatable = false;What about making
VHOST_USER_DEVICE_PCIandTYPE_VHOST_USER_DEVICETypeInfos abstract instead?
I had in a previous iteration (v7) but AIUI abstract really means something different - the device can be instantiated but we just want to stop the user from creating it arbitrarily.
Quoted 13 lines
Quoted 13 lines
hw/virtio/vhost-user-device.c +1
-2+device_class_set_props (dc, vud_properties); dc->vmsd = &vud_vmstate;set_bit (DEVICE_CATEGORY_INPUT , dc->categories);@@ -366,14 +53,11 @@ static void vud_class_init(ObjectClass *klass, void *data)static const TypeInfo vud_info = { .name =TYPE_VHOST_USER_DEVICE , .parent =TYPE_VHOST_USER_BASE , - .instance_size =sizeof (VHostUserBase), .class_init = vud_class_init, - .class_size =sizeof (VHostUserBaseClass), };
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v9 2/11 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 v9 3/11 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/
v8
- fix merge conflict (idx == VIRTIO_CONFIG_IRQ_IDX not needed as base doesn't use notifiers)
--- include/hw/virtio/vhost-user-rng.h | 13 +- hw/virtio/vhost-user-rng.c | 294 +++-------------------------- hw/virtio/meson.build | 9 +- 3 files changed, 31 insertions(+), 285 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 -272
326 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 v9 4/11 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/
v8
- fix merge conflicts
--- include/hw/virtio/vhost-user-gpio.h | 25 +- hw/virtio/vhost-user-gpio.c | 407 ++-------------------------- hw/virtio/meson.build | 5 +- 3 files changed, 22 insertions(+), 415 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 -390
436 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 v9 5/11 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 v9 6/11 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
@@ -2327,6 +2327,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 v9 7/11 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
PATCH v9 8/11 hw/virtio: Support set_config() callback in vhost-user-base
In reply to Alex BennéeFrom: Leo Yan <[email protected]>
The Virtio input device invokes set_config() callback for retrieving the event configuration info, but the callback is not supported in vhost-user-base.
This patch adds support set_config() callback in vhost-user-base.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user-base.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
hw/virtio/vhost-user-base.c +17 -0
@@ -140,6 +140,22 @@ static void vub_get_config(VirtIODevice *vdev, uint8_t *config) } } +static void vub_set_config (VirtIODevice *vdev,const uint8_t *config_data) +{ +VHostUserBase *vub =VHOST_USER_BASE (vdev); +int ret; + +g_assert (vub->config_size && vub->vhost_user.supports_config == true); + + ret =vhost_dev_set_config (&vub->vhost_dev, config_data, +0 , vub->config_size, +VHOST_SET_CONFIG_TYPE_FRONTEND ); +if (ret) { +error_report ("vhost guest set device config space failed: %d" , ret); +return ; + } +} +/* * When the daemon signals an update to the config we just need to * signal the guest as we re-read the config on demand above.
@@ -337,6 +353,7 @@ static void vub_class_init(ObjectClass *klass, void *data) vdc->unrealize = vub_device_unrealize; vdc->get_features = vub_get_features; vdc->get_config = vub_get_config; + vdc->set_config = vub_set_config; vdc->set_status = vub_set_status; }
Signature · 1 line
2.39.2
PATCH v9 9/11 docs/system: Add vhost-user-input documentation
In reply to Alex BennéeFrom: Leo Yan <[email protected]>
This adds basic documentation for vhost-user-input.
Message-Id: <[email protected]>
--- MAINTAINERS | 1 + docs/system/device-emulation.rst | 1 + docs/system/devices/vhost-user-input.rst | 45 ++++++++++++++++++++++++ docs/system/devices/vhost-user.rst | 4 ++- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 docs/system/devices/vhost-user-input.rst
MAINTAINERS +1 -0
@@ -2274,6 +2274,7 @@ L: [email protected] virtio-input M: Gerd Hoffmann <[email protected]> S: Odd Fixes +F: docs/system/devices/vhost-user-input.rst F: hw/input/vhost-user-input.c F: hw/input/virtio-input*.c F: include/hw/virtio/virtio-input.h
docs/system/device-emulation.rst +1 -0
@@ -94,6 +94,7 @@ Emulated Devices devices/virtio-gpu.rst devices/virtio-pmem.rst devices/virtio-snd.rst + devices/vhost-user-input.rst devices/vhost-user-rng.rst devices/canokey.rst devices/usb-u2f.rst
docs/system/devices/vhost-user-input.rst new file +45 -0
45 lines not on this page · raw message
docs/system/devices/vhost-user.rst +3 -1
@@ -42,7 +42,7 @@ platform details for what sort of virtio bus to use. - See https://github.com/rust-vmm/vhost-device * - vhost-user-input - Generic input driver - - See contrib/vhost-user-input + - :ref:`vhost_user_input` * - vhost-user-rng - Entropy driver - :ref:`vhost_user_rng`
@@ -91,6 +91,8 @@ following the :ref:`vhost_user_proto`. There are a number of daemons that can be built when enabled by the project although any daemon that meets the specification for a given device can be used. +.. _shared_memory_object: + Shared memory object ====================
Signature · 1 line
2.39.2
PATCH v9 10/11 hw/virtio: Move vhost-user-input into virtio folder
In reply to Alex BennéeFrom: Leo Yan <[email protected]>
vhost-user-input is in the input folder. On the other hand, the folder 'hw/virtio' maintains other virtio stubs (e.g. I2C, RNG, GPIO, etc).
This patch moves vhost-user-input into the virtio folder for better code organization. No functionality change.
Message-Id: <[email protected]>
---
MAINTAINERS | 2 +-
hw/{input => virtio}/vhost-user-input.c | 0
hw/input/meson.build | 1 -
hw/virtio/meson.build | 4 +++-
4 files changed, 4 insertions(+), 3 deletions(-)
rename hw/{input => virtio}/vhost-user-input.c (100%)MAINTAINERS +1 -1
@@ -2275,8 +2275,8 @@ virtio-input M: Gerd Hoffmann <[email protected]> S: Odd Fixes F: docs/system/devices/vhost-user-input.rst -F: hw/input/vhost-user-input.c F: hw/input/virtio-input*.c +F: hw/virtio/vhost-user-input.c F: include/hw/virtio/virtio-input.h F: contrib/vhost-user-input/*
hw/virtio/vhost-user-input.c renamed from hw/input/vhost-user-input.c +0 -0
hw/input/meson.build +0 -1
@@ -11,7 +11,6 @@ system_ss.add(when: 'CONFIG_TSC2005', if_true: files('tsc2005.c')) system_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-input.c')) system_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-input-hid.c')) system_ss.add(when: 'CONFIG_VIRTIO_INPUT_HOST', if_true: files('virtio-input-host.c')) -system_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c')) system_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_keypad.c')) system_ss.add(when: 'CONFIG_TSC210X', if_true: files('tsc210x.c'))
hw/virtio/meson.build +3 -1
@@ -25,6 +25,7 @@ if have_vhost 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')) + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c')) # PCI Stubs system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c'))
@@ -36,6 +37,8 @@ if have_vhost 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')) + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_INPUT'], + if_true: files('vhost-user-input-pci.c')) endif if have_vhost_vdpa system_virtio_ss.add(files('vhost-vdpa.c'))
@@ -59,7 +62,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_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')) virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-pci.c'))
Signature · 1 line
2.39.2
PATCH v9 11/11 hw/virtio: derive vhost-user-input from vhost-user-base
In reply to Alex BennéeFrom: Leo Yan <[email protected]>
This patch derives vhost-user-input from vhost-user-base class, so make the input stub as a simpler boilerplate wrapper.
With the refactoring, vhost-user-input adds the property 'chardev', this leads to conflict with the vhost-user-input-pci adds the same property. To resolve the error, remove the duplicate property from vhost-user-input-pci.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-input.h | 6 +- hw/virtio/vhost-user-input-pci.c | 3 - hw/virtio/vhost-user-input.c | 114 +++++-------------------------- 3 files changed, 21 insertions(+), 102 deletions(-)
include/hw/virtio/virtio-input.h +3 -3
@@ -1,6 +1,8 @@#ifndef QEMU_VIRTIO_INPUT_H #define QEMU_VIRTIO_INPUT_H +#include "hw/virtio/vhost-user.h" +#include "hw/virtio/vhost-user-base.h" #include "ui/input.h" #include "sysemu/vhost-user-backend.h"
@@ -97,9 +99,7 @@ struct VirtIOInputHost { };struct VHostUserInput { -VirtIOInput parent_obj; - -VhostUserBackend *vhost; +VHostUserBase parent_obj; };void virtio_input_send (VirtIOInput *vinput,virtio_input_event *event);
hw/virtio/vhost-user-input-pci.c +0 -3
@@ -30,9 +30,6 @@ static void vhost_user_input_pci_instance_init(Object *obj)virtio_instance_init_common (obj, &dev->vhi,sizeof (dev->vhi),TYPE_VHOST_USER_INPUT ); - -object_property_add_alias (obj,"chardev" , -OBJECT (&dev->vhi),"chardev" ); }static const VirtioPCIDeviceTypeInfo vhost_user_input_pci_info = {
hw/virtio/vhost-user-input.c +18 -96
141 lines not on this page · raw message
Signature · 1 line
2.39.2
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 and Leo's vhost-user-input stubs which are based on the same base.
Ping MST,
Are you waiting for anything else before pulling this into your queue?
Quoted 79 lines
Changes
-------v9
- re-base and fix conflicts
- add Leo's vhost-user-input seriesv8
- scrubbed errant Message-Idv7
- 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 devicesLeo Yan (4):
hw/virtio: Supportset_config()callback in vhost-user-base docs/system: Add vhost-user-input documentation hw/virtio: Move vhost-user-input into virtio folder hw/virtio: derive vhost-user-input from vhost-user-baseManos Pitsidianakis (1):
hw/virtio: add vhost-user-snd and virtio-snd-pci devicesMAINTAINERS | 16 +- docs/system/device-emulation.rst | 1 + docs/system/devices/vhost-user-input.rst | 45 ++ docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 72 +++- ...{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 ++ include/hw/virtio/virtio-input.h | 6 +- hw/input/vhost-user-input.c | 136 ------ hw/virtio/vhost-user-base.c | 371 ++++++++++++++++ hw/virtio/vhost-user-device-pci.c | 13 +- hw/virtio/vhost-user-device.c | 338 +-------------- hw/virtio/vhost-user-gpio.c | 407 +----------------- hw/virtio/vhost-user-i2c.c | 272 +----------- hw/virtio/vhost-user-input-pci.c | 3 - hw/virtio/vhost-user-input.c | 58 +++ hw/virtio/vhost-user-rng.c | 294 +------------ hw/virtio/vhost-user-snd-pci.c | 75 ++++ hw/virtio/vhost-user-snd.c | 67 +++ hw/input/meson.build | 1 - hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 27 +- 25 files changed, 850 insertions(+), 1456 deletions(-) create mode 100644 docs/system/devices/vhost-user-input.rst rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%) create mode 100644 include/hw/virtio/vhost-user-snd.h delete mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-base.c create mode 100644 hw/virtio/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-snd-pci.c create mode 100644 hw/virtio/vhost-user-snd.c
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 9 lines · Alex Bennée
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 6 lines
Quoted 2 lines
I've also added Manos' vhost-user-sound and Leo's vhost-user-input stubs which are based on the same base.
Ping MST,
Are you waiting for anything else before pulling this into your queue?
Tagged, thanks!
Quoted 83 lines
Quoted 79 lines
Changes
-------v9
- re-base and fix conflicts
- add Leo's vhost-user-input seriesv8
- scrubbed errant Message-Idv7
- 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 devicesLeo Yan (4):
hw/virtio: Supportset_config()callback in vhost-user-base docs/system: Add vhost-user-input documentation hw/virtio: Move vhost-user-input into virtio folder hw/virtio: derive vhost-user-input from vhost-user-baseManos Pitsidianakis (1):
hw/virtio: add vhost-user-snd and virtio-snd-pci devicesMAINTAINERS | 16 +- docs/system/device-emulation.rst | 1 + docs/system/devices/vhost-user-input.rst | 45 ++ docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 72 +++- ...{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 ++ include/hw/virtio/virtio-input.h | 6 +- hw/input/vhost-user-input.c | 136 ------ hw/virtio/vhost-user-base.c | 371 ++++++++++++++++ hw/virtio/vhost-user-device-pci.c | 13 +- hw/virtio/vhost-user-device.c | 338 +-------------- hw/virtio/vhost-user-gpio.c | 407 +----------------- hw/virtio/vhost-user-i2c.c | 272 +----------- hw/virtio/vhost-user-input-pci.c | 3 - hw/virtio/vhost-user-input.c | 58 +++ hw/virtio/vhost-user-rng.c | 294 +------------ hw/virtio/vhost-user-snd-pci.c | 75 ++++ hw/virtio/vhost-user-snd.c | 67 +++ hw/input/meson.build | 1 - hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 27 +- 25 files changed, 850 insertions(+), 1456 deletions(-) create mode 100644 docs/system/devices/vhost-user-input.rst rename include/hw/virtio/{vhost-user-device.h => vhost-user-base.h} (71%) create mode 100644 include/hw/virtio/vhost-user-snd.h delete mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-base.c create mode 100644 hw/virtio/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-snd-pci.c create mode 100644 hw/virtio/vhost-user-snd.cSignature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro