mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
committed by
Alex Williamson
parent
c04ac34078
commit
c68ea0d00a
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user