On Wed, Aug 25, 2021 at 06:19:08PM +0200, Christoph Hellwig wrote: > Reuse the logic in vfio_noiommu_group_alloc to allocate a fake > single-device iommu group for mediated devices. A new function is > exposed to create vfio_device for this emulated case and the noiommu > boolean field in struct vfio_group is replaced with a set of flags so > that devices with an emulated IOMMU can be distinguished from those > with no IOMMU at all. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > drivers/vfio/mdev/mdev_driver.c | 46 ++-------------------- > drivers/vfio/mdev/vfio_mdev.c | 2 +- > drivers/vfio/vfio.c | 70 +++++++++++++++++++++------------ > include/linux/vfio.h | 1 + > samples/vfio-mdev/mbochs.c | 2 +- > samples/vfio-mdev/mdpy.c | 2 +- > samples/vfio-mdev/mtty.c | 2 +- > 7 files changed, 53 insertions(+), 72 deletions(-) This conflicts with the AP mdev conversion, it will need to change to vfio_register_emulated_iommu_dev() like the samples did. Alex, I suggest you take this patch after the AP mdev patch and add the one line fix up. Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason