block/blkio: Add virtio-blk-vfio-pci BlockDriver
PATCH 1/1 block/blkio: Add virtio-blk-vfio-pci BlockDriver
libblkio 1.1.0 [1] introduces a virtio-blk-vfio-pci driver, which accesses a virtio-blk PCI device using VFIO. Add a corresponding BlockDriver.
[1] https://gitlab.com/libblkio/libblkio/-/tree/v1.1.0
---
This is dependent on a pending libblkio fix [2], so we may want to wait for a new libblkio release before queueing this.
[2] https://gitlab.com/libblkio/libblkio/-/merge_requests/140
block/blkio.c | 8 ++++++++ qapi/block-core.json | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+)
block/blkio.c +8 -0
@@ -25,6 +25,7 @@*/ #define DRIVER_IO_URING "io_uring"#define DRIVER_NVME_IO_URING "nvme-io_uring" +#define DRIVER_VIRTIO_BLK_VFIO_PCI "virtio-blk-vfio-pci"#define DRIVER_VIRTIO_BLK_VHOST_USER "virtio-blk-vhost-user"#define DRIVER_VIRTIO_BLK_VHOST_VDPA "virtio-blk-vhost-vdpa"
@@ -704,6 +705,8 @@ static int blkio_file_open(BlockDriverState *bs, QDict *options, int flags, ret =blkio_io_uring_open (bs, options, flags, errp); }else if (strcmp (blkio_driver,DRIVER_NVME_IO_URING ) ==0 ) { ret =blkio_nvme_io_uring (bs, options, flags, errp); + }else if (strcmp (blkio_driver,DRIVER_VIRTIO_BLK_VFIO_PCI ) ==0 ) { + ret =blkio_virtio_blk_common_open (bs, options, flags, errp); }else if (strcmp (blkio_driver,DRIVER_VIRTIO_BLK_VHOST_USER ) ==0 ) { ret =blkio_virtio_blk_common_open (bs, options, flags, errp); }else if (strcmp (blkio_driver,DRIVER_VIRTIO_BLK_VHOST_VDPA ) ==0 ) {
@@ -989,6 +992,10 @@ static BlockDriver bdrv_nvme_io_uring = BLKIO_DRIVER( .bdrv_needs_filename = true, ); +static BlockDriver bdrv_virtio_blk_vfio_pci =BLKIO_DRIVER ( +DRIVER_VIRTIO_BLK_VFIO_PCI +); +static BlockDriver bdrv_virtio_blk_vhost_user =BLKIO_DRIVER (DRIVER_VIRTIO_BLK_VHOST_USER );
@@ -1001,6 +1008,7 @@ static void bdrv_blkio_init(void) {bdrv_register (&bdrv_io_uring);bdrv_register (&bdrv_nvme_io_uring); +bdrv_register (&bdrv_virtio_blk_vfio_pci);bdrv_register (&bdrv_virtio_blk_vhost_user);bdrv_register (&bdrv_virtio_blk_vhost_vdpa); }
qapi/block-core.json +18 -0
@@ -2960,6 +2960,7 @@ 'raw', 'rbd', { 'name': 'replication', 'if': 'CONFIG_REPLICATION' }, 'ssh', 'throttle', 'vdi', 'vhdx', + { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' }, { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' }, { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' }, 'vmdk', 'vpc', 'vvfat' ] }
@@ -3711,6 +3712,20 @@ 'data': { 'filename': 'str' }, 'if': 'CONFIG_BLKIO' } +## +# @BlockdevOptionsVirtioBlkVfioPci: +# +# Driver specific block device options for the virtio-blk-vfio-pci backend. +# +# @path: path to the PCI device's sysfs directory (e.g. +# /sys/bus/pci/devices/0000:00:01.0). +# +# Since: 7.2 +## +{ 'struct': 'BlockdevOptionsVirtioBlkVfioPci', + 'data': { 'path': 'str' }, + 'if': 'CONFIG_BLKIO' } + ## # @BlockdevOptionsVirtioBlkVhostUser: #
@@ -4390,6 +4405,9 @@ 'throttle': 'BlockdevOptionsThrottle', 'vdi': 'BlockdevOptionsGenericFormat', 'vhdx': 'BlockdevOptionsGenericFormat', + 'virtio-blk-vfio-pci': + { 'type': 'BlockdevOptionsVirtioBlkVfioPci', + 'if': 'CONFIG_BLKIO' }, 'virtio-blk-vhost-user': { 'type': 'BlockdevOptionsVirtioBlkVhostUser', 'if': 'CONFIG_BLKIO' },
Signature · 1 line
2.37.3
Quoted 7 lines · Alberto Faria
libblkio 1.1.0 [1] introduces a virtio-blk-vfio-pci driver, which accesses a virtio-blk PCI device using VFIO. Add a corresponding BlockDriver.
[1] https://gitlab.com/libblkio/libblkio/-/tree/v1.1.0
Signed-off-by Alberto Faria <[email protected]>
I forgot to mention this is based on Stefan's block tree:
https://gitlab.com/stefanha/qemu/-/commits/block
Stefan Hajnoczi
AppliedQuoted 9 lines · Alberto Faria
libblkio 1.1.0 [1] introduces a virtio-blk-vfio-pci driver, which accesses a virtio-blk PCI device using VFIO. Add a corresponding BlockDriver.
[1] https://gitlab.com/libblkio/libblkio/-/tree/v1.1.0
Signed-off-by Alberto Faria <[email protected]>---
Quoted 8 lines
This is dependent on a pending libblkio fix [2], so we may want to wait for a new libblkio release before queueing this.
[2] https://gitlab.com/libblkio/libblkio/-/merge_requests/140
block/blkio.c | 8 ++++++++ qapi/block-core.json | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+)
Thanks, applied to my block tree:
https://gitlab.com/stefanha/qemu/commits/block
Stefan