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

Alex Bennée posted 6 patches 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231009095937.195728-1-alex.bennee@linaro.org
Maintainers: Mathieu Poirier <mathieu.poirier@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Viresh Kumar <viresh.kumar@linaro.org>
There is a newer version of this series
docs/system/devices/vhost-user-rng.rst |   2 +
docs/system/devices/vhost-user.rst     |  41 +++
include/hw/virtio/vhost-user-base.h    |  49 +++
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            | 348 +++++++++++++++++++++
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                  |  25 +-
17 files changed, 705 insertions(+), 1283 deletions(-)
create mode 100644 include/hw/virtio/vhost-user-base.h
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
[PATCH v4 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Alex Bennée 7 months, 1 week ago
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
-------

I've dropped the F_TRANSPORT work from this series to keep this small
and ready to merge. The changes for F_TRANSPORT are a bit more
invasive and still need a bit of debugging but I wanted to get this
stuff merged now.

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     |  41 +++
 include/hw/virtio/vhost-user-base.h    |  49 +++
 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            | 348 +++++++++++++++++++++
 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                  |  25 +-
 17 files changed, 705 insertions(+), 1283 deletions(-)
 create mode 100644 include/hw/virtio/vhost-user-base.h
 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

-- 
2.39.2


Re: [PATCH v4 0/6] virtio: cleanup vhost-user-generic and reduce c&p
Posted by Mark Cave-Ayland 7 months ago
On 09/10/2023 10:59, Alex Bennée wrote:

> 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
> -------
> 
> I've dropped the F_TRANSPORT work from this series to keep this small
> and ready to merge. The changes for F_TRANSPORT are a bit more
> invasive and still need a bit of debugging but I wanted to get this
> stuff merged now.
> 
> 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     |  41 +++
>   include/hw/virtio/vhost-user-base.h    |  49 +++
>   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            | 348 +++++++++++++++++++++
>   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                  |  25 +-
>   17 files changed, 705 insertions(+), 1283 deletions(-)
>   create mode 100644 include/hw/virtio/vhost-user-base.h
>   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

Hi Alex,

 From a quick skim the QOM modelling looks good to me. The only thing I've noticed is 
that the parent object for VHostUserBase derived classes is sometimes named as 
"VHostUserBase parent" instead of "VHostUserBase parent_obj" as per the QOM naming 
guidelines.


ATB,

Mark.