aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAlberto Faria <afaria@redhat.com>2022-10-28 14:16:35 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2022-10-31 14:24:33 -0400
commit03d9e4c0dba9d1b5d0c532ac3518415466ebdf8f (patch)
tree259e6344bce6381709ee5d3456b43a4b7846933d /block
parent7208429223963c405c62fa2611398f1aa8033593 (diff)
downloadqemu-03d9e4c0dba9d1b5d0c532ac3518415466ebdf8f.zip
qemu-03d9e4c0dba9d1b5d0c532ac3518415466ebdf8f.tar.gz
qemu-03d9e4c0dba9d1b5d0c532ac3518415466ebdf8f.tar.bz2
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 Signed-off-by: Alberto Faria <afaria@redhat.com> Message-id: 20221028131635.710267-1-afaria@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/blkio.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/blkio.c b/block/blkio.c
index 82f26ee..f55eb77 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -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);
}