[libvirt PATCH 2/5] qemu: add virtio-blk-vhost-vdpa capability

Jonathon Jongsma posted 5 patches 2 years, 8 months ago
There is a newer version of this series
[libvirt PATCH 2/5] qemu: add virtio-blk-vhost-vdpa capability
Posted by Jonathon Jongsma 2 years, 8 months ago
Check whether the qemu binary supports the vdpa block driver. We can't
rely simply on the existence of the virtio-blk-vhost-vdpa block driver
since the first releases of qemu didn't support fd-passing for this
driver. So we have to check for the 'fdset' feature on the driver
object. This feature will be present in the qemu 8.1.0 release and was
merged to qemu in commit 98b126f5.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
 src/qemu/qemu_capabilities.c | 2 ++
 src/qemu/qemu_capabilities.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index cf85d42198..11d5ecd622 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -693,6 +693,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "virtio-gpu.blob", /* QEMU_CAPS_VIRTIO_GPU_BLOB */
               "rbd-encryption-layering", /* QEMU_CAPS_RBD_ENCRYPTION_LAYERING */
               "rbd-encryption-luks-any", /* QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY */
+              "virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA */
     );
 
 
@@ -1560,6 +1561,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
     { "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX },
     { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKED_REASONS },
     { "screendump/arg-type/format/^png", QEMU_CAPS_SCREENSHOT_FORMAT_PNG },
+    { "blockdev-add/arg-type/+virtio-blk-vhost-vdpa/$fdset", QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA},
 };
 
 typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 3b55aed07a..6feaa81bbf 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -672,6 +672,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_VIRTIO_GPU_BLOB, /* -device virtio-gpu-*.blob= */
     QEMU_CAPS_RBD_ENCRYPTION_LAYERING, /* layered encryption support for Ceph RBD */
     QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY, /* luks-any (LUKS and LUKS2) encryption format for Ceph RBD */
+    QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA, /* -device virtio-blk-vhost-vdpa */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
-- 
2.40.1
Re: [libvirt PATCH 2/5] qemu: add virtio-blk-vhost-vdpa capability
Posted by Peter Krempa 2 years, 8 months ago
On Tue, Jun 06, 2023 at 16:11:01 -0500, Jonathon Jongsma wrote:
> Check whether the qemu binary supports the vdpa block driver. We can't
> rely simply on the existence of the virtio-blk-vhost-vdpa block driver
> since the first releases of qemu didn't support fd-passing for this
> driver. So we have to check for the 'fdset' feature on the driver
> object. This feature will be present in the qemu 8.1.0 release and was
> merged to qemu in commit 98b126f5.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 2 ++
>  src/qemu/qemu_capabilities.h | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index cf85d42198..11d5ecd622 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -693,6 +693,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
>                "virtio-gpu.blob", /* QEMU_CAPS_VIRTIO_GPU_BLOB */
>                "rbd-encryption-layering", /* QEMU_CAPS_RBD_ENCRYPTION_LAYERING */
>                "rbd-encryption-luks-any", /* QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY */
> +              "virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA */
>      );
>  
>  
> @@ -1560,6 +1561,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
>      { "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX },
>      { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKED_REASONS },
>      { "screendump/arg-type/format/^png", QEMU_CAPS_SCREENSHOT_FORMAT_PNG },
> +    { "blockdev-add/arg-type/+virtio-blk-vhost-vdpa/$fdset", QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA},

Please order this together with other 'blockdev-add' queries at the top
and add a space before }.

Also, since I've updated capabilities now, this feature should be
detected with the 8.1 dump, so please regenerate the output as the flag
will be present now.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Re: [libvirt PATCH 2/5] qemu: add virtio-blk-vhost-vdpa capability
Posted by Peter Krempa 2 years, 8 months ago
On Thu, Jun 08, 2023 at 11:00:03 +0200, Peter Krempa wrote:
> On Tue, Jun 06, 2023 at 16:11:01 -0500, Jonathon Jongsma wrote:
> > Check whether the qemu binary supports the vdpa block driver. We can't
> > rely simply on the existence of the virtio-blk-vhost-vdpa block driver
> > since the first releases of qemu didn't support fd-passing for this
> > driver. So we have to check for the 'fdset' feature on the driver
> > object. This feature will be present in the qemu 8.1.0 release and was
> > merged to qemu in commit 98b126f5.
> > 
> > Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
> > ---
> >  src/qemu/qemu_capabilities.c | 2 ++
> >  src/qemu/qemu_capabilities.h | 1 +
> >  2 files changed, 3 insertions(+)
> > 
> > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> > index cf85d42198..11d5ecd622 100644
> > --- a/src/qemu/qemu_capabilities.c
> > +++ b/src/qemu/qemu_capabilities.c
> > @@ -693,6 +693,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
> >                "virtio-gpu.blob", /* QEMU_CAPS_VIRTIO_GPU_BLOB */
> >                "rbd-encryption-layering", /* QEMU_CAPS_RBD_ENCRYPTION_LAYERING */
> >                "rbd-encryption-luks-any", /* QEMU_CAPS_RBD_ENCRYPTION_LUKS_ANY */
> > +              "virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA */
> >      );
> >  
> >  
> > @@ -1560,6 +1561,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
> >      { "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX },
> >      { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKED_REASONS },
> >      { "screendump/arg-type/format/^png", QEMU_CAPS_SCREENSHOT_FORMAT_PNG },
> > +    { "blockdev-add/arg-type/+virtio-blk-vhost-vdpa/$fdset", QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA},
> 
> Please order this together with other 'blockdev-add' queries at the top
> and add a space before }.
> 
> Also, since I've updated capabilities now, this feature should be
> detected with the 8.1 dump, so please regenerate the output as the flag
> will be present now.

Ah, actually the caps were generated with older libblkio which doesn't
have the FD passing feature yet. I'll update and re-generate them.