On Fri, 17 Sep 2021 09:53:01 -0300 Jason Gunthorpe <jgg@xxxxxxxx> wrote: > On Fri, Sep 17, 2021 at 12:21:07PM +0530, Kirti Wankhede wrote: > > > > > > On 9/17/2021 10:35 AM, Christoph Hellwig wrote: > > > On Fri, Sep 17, 2021 at 04:49:41AM +0000, Tian, Kevin wrote: > > > > > 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. > > > > > > > > > > > > > Directly calling vfio_register_group_dev() doesn't work without linking > > mdev->dev->iommu_group to mdev->type->parent->dev->iommu_group. > > You pass the PCI device, not the mdev to vfio_register_group_dev(). > > > > > 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... > > > > > > Exactly. > > > > vfio-pci doesn't provide way to configure the device as mdev framework > > provide using mdev_types. > > The linux standard is for a PCI PF driver to configure it's VFs, not a > mdev or vfio. Hi Jason, I'm only aware that the PF driver enables basic SR-IOV configuration of VFs, ie. the number of enabled VFs. The mdev interface enables not only management of the number of child devices, but the flavor of each child, for example the non-homogeneous slice of resources allocated per child device. I think that's the sort of configuration Kirti is asking about here and I'm not aware of any standard mechanism for a PF driver to apply a configuration per VF. A mediated path to a physical device isn't exclusive to providing features like migration, it can also be used to create these sorts device flavors. For example, we might expose NIC VFs and administrative configuration should restrict VF1 to a 1Gbit interface while VF2 gets 10Gbit. Are we left to driver specific sysfs attributes to achieve this or can we create some form of standardization like mdev provides? Thanks, Alex