[Cc +Tony] On Thu, 26 Aug 2021 15:34:17 +0200 Christoph Hellwig <hch@xxxxxx> 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> > Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > drivers/vfio/mdev/mdev_driver.c | 46 ++---------------- > drivers/vfio/mdev/vfio_mdev.c | 2 +- > drivers/vfio/vfio.c | 82 ++++++++++++++++++++++----------- > 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, 65 insertions(+), 72 deletions(-) As Jason suggested, I'll apply this after 0-v4-0203a4ab0596+f7-vfio_ap_jgg@xxxxxxxxxx and roll in the following: diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 2347808fa3e4..f04fe1278f99 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -350,7 +350,7 @@ static int vfio_ap_mdev_probe(struct mdev_device *mdev) list_add(&matrix_mdev->node, &matrix_dev->mdev_list); mutex_unlock(&matrix_dev->lock); - ret = vfio_register_group_dev(&matrix_mdev->vdev); + ret = vfio_register_emulated_iommu_dev(&matrix_mdev->vdev); if (ret) goto err_list; dev_set_drvdata(&mdev->dev, matrix_mdev); Shout if this is incorrect. Thanks, Alex