> From: Jason Gunthorpe <jgg@xxxxxxxx> > Sent: Friday, September 17, 2021 6:19 AM > > On Fri, Sep 17, 2021 at 01:25:59AM +0530, Kirti Wankhede wrote: > > > > > > On 9/13/2021 12:46 PM, Christoph Hellwig wrote: > > > Pass the group flags to ->attach_group and remove the messy check for > > > the bus type. > > > > > > > I like the way vfio_group_type is used in this patch, that removes messy > way > > to call symbol_get(mdev_bus_type). > > > > Any thoughts on how VFIO_IOMMU, i.e. IOMMU backed mdev, can be > implemented? > > > > For IOMMU backed mdev, mdev->dev->iommu_group should be same as > > mdev->type->parent->dev->iommu_group or in other words, parent device > would > > be DMA alias for the mdev device with the restriction - single mdev device > > can be created for the physical device. Is it possible to link iommu_group > > of these two devices some way? > > You just use the new style mdev API and directly call > vfio_register_group_dev and it will pick up the > parent->dev->iommu_group naturally like everything else using physical > iommu groups. > For above usage (wrap pdev into mdev), isn't the right way to directly add vendor vfio-pci driver since vfio-pci-core has been split out now? It's not necessary to fake a mdev just for adding some mediation in the r/w path... Another type of IOMMU-backed mdev is with pasid support. But for this case we discussed earlier that it doesn't have group and will follow the new /dev/iommu proposal instead. Thanks Kevin