On Tue, Aug 24, 2021 at 04:46:42PM +0200, Christoph Hellwig wrote: > +int vfio_register_group_dev(struct vfio_device *device) > +{ > + return __vfio_register_dev(device, > + vfio_group_find_or_alloc(device->dev)); > +} > EXPORT_SYMBOL_GPL(vfio_register_group_dev); > > +int vfio_register_mediated_dev(struct vfio_device *device) > +{ > + return __vfio_register_dev(device, > + vfio_noiommu_group_alloc(device->dev, VFIO_MEDIATED)); > +} > +EXPORT_SYMBOL_GPL(vfio_register_mediated_dev); The mechanism looks fine, but I think the core code is much clearer if the name is not 'mediated' but 'sw_iommu' or something that implies the group is running with a software page table. mediated has become so overloaded in this code. Really what this flag is doing is putting the group into a state where the vfio_*pin_pages APIs are available once the vfio_device is opened. So it really becomes an API family where a driver will call vfio_regsiter_sw_iommu_dev(), then use the vfio_pin/unpin_pages API set. Jason