summaryrefslogtreecommitdiff
path: root/samples/vfio-mdev
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-09-24 18:56:57 +0300
committerAlex Williamson <alex.williamson@redhat.com>2021-09-30 21:46:44 +0300
commitc68ea0d00ad82428154aed890ec9f793e460fa1c (patch)
tree663fb526e33c3322c770c9a16097d26351d69534 /samples/vfio-mdev
parentc04ac34078a4d7c08e1218b548e0a6b197f01582 (diff)
downloadlinux-c68ea0d00ad82428154aed890ec9f793e460fa1c.tar.xz
vfio: simplify iommu group allocation for mediated devices
Reuse the logic in vfio_noiommu_group_alloc to allocate a fake single-device iommu group for mediated devices by factoring out a common function, and replacing the noiommu boolean field in struct vfio_group with an enum to distinguish the three different kinds of groups. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20210924155705.4258-8-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'samples/vfio-mdev')
-rw-r--r--samples/vfio-mdev/mbochs.c2
-rw-r--r--samples/vfio-mdev/mdpy.c2
-rw-r--r--samples/vfio-mdev/mtty.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index c313ab4d1f4e..cd41bec5fdeb 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -553,7 +553,7 @@ static int mbochs_probe(struct mdev_device *mdev)
mbochs_create_config_space(mdev_state);
mbochs_reset(mdev_state);
- ret = vfio_register_group_dev(&mdev_state->vdev);
+ ret = vfio_register_emulated_iommu_dev(&mdev_state->vdev);
if (ret)
goto err_mem;
dev_set_drvdata(&mdev->dev, mdev_state);
diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c
index 8d1a80a0722a..fe5d43e797b6 100644
--- a/samples/vfio-mdev/mdpy.c
+++ b/samples/vfio-mdev/mdpy.c
@@ -258,7 +258,7 @@ static int mdpy_probe(struct mdev_device *mdev)
mdpy_count++;
- ret = vfio_register_group_dev(&mdev_state->vdev);
+ ret = vfio_register_emulated_iommu_dev(&mdev_state->vdev);
if (ret)
goto err_mem;
dev_set_drvdata(&mdev->dev, mdev_state);
diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
index 5983cdb16e3d..a0e1a469bd47 100644
--- a/samples/vfio-mdev/mtty.c
+++ b/samples/vfio-mdev/mtty.c
@@ -741,7 +741,7 @@ static int mtty_probe(struct mdev_device *mdev)
mtty_create_config_space(mdev_state);
- ret = vfio_register_group_dev(&mdev_state->vdev);
+ ret = vfio_register_emulated_iommu_dev(&mdev_state->vdev);
if (ret)
goto err_vconfig;
dev_set_drvdata(&mdev->dev, mdev_state);