vfio: simplify iommu group allocation for mediated devices
authorChristoph Hellwig <hch@lst.de>
Fri, 24 Sep 2021 15:56:57 +0000 (17:56 +0200)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 30 Sep 2021 18:46:44 +0000 (12:46 -0600)
commitc68ea0d00ad82428154aed890ec9f793e460fa1c
tree663fb526e33c3322c770c9a16097d26351d69534
parentc04ac34078a4d7c08e1218b548e0a6b197f01582
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>
drivers/s390/crypto/vfio_ap_ops.c
drivers/vfio/mdev/mdev_driver.c
drivers/vfio/mdev/vfio_mdev.c
drivers/vfio/vfio.c
include/linux/vfio.h
samples/vfio-mdev/mbochs.c
samples/vfio-mdev/mdpy.c
samples/vfio-mdev/mtty.c