mbox series

[v5,0/6] virtio: cleanup vhost-user-generic and reduce c&p

Message ID 20231019095610.2818087-1-alex.bennee@linaro.org
Headers show
Series virtio: cleanup vhost-user-generic and reduce c&p | expand

Message

Alex Bennée Oct. 19, 2023, 9:56 a.m. UTC
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
-------

v5
  - addressing comments and tags
  - improved the docs

v4
  - dropped the F_TRANSPORT work for another series
  - added vhost-user-sound

Alex Bennée (5):
  virtio: split into vhost-user-base and vhost-user-device
  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

 docs/system/devices/vhost-user-rng.rst        |   2 +
 docs/system/devices/vhost-user.rst            |  60 ++-
 ...{vhost-user-device.h => vhost-user-base.h} |  21 +-
 include/hw/virtio/vhost-user-gpio.h           |  23 +-
 include/hw/virtio/vhost-user-i2c.h            |  14 +-
 include/hw/virtio/vhost-user-rng.h            |  11 +-
 include/hw/virtio/vhost-user-snd.h            |  26 ++
 hw/virtio/vhost-user-base.c                   | 345 +++++++++++++++
 hw/virtio/vhost-user-device-pci.c             |  10 +-
 hw/virtio/vhost-user-device.c                 | 335 +-------------
 hw/virtio/vhost-user-gpio.c                   | 407 +-----------------
 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 +-
 17 files changed, 683 insertions(+), 1291 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.c

Comments

Alex Bennée Oct. 24, 2023, 5:14 p.m. UTC | #1
Alex Bennée <alex.bennee@linaro.org> writes:

> 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.

Ping MST. Any more comments or happy to take as is?
Michael S. Tsirkin Oct. 24, 2023, 5:18 p.m. UTC | #2
On Tue, Oct 24, 2023 at 06:14:36PM +0100, Alex Bennée wrote:
> 
> Alex Bennée <alex.bennee@linaro.org> writes:
> 
> > 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.
> 
> Ping MST. Any more comments or happy to take as is?

It's tagged already.

> -- 
> Alex Bennée
> Virtualisation Tech Lead @ Linaro