RE: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination

From: Tian, Kevin
Date: Thu Jun 23 2022 - 04:46:59 EST


> From: Alex Williamson <alex.williamson@xxxxxxxxxx>
> Sent: Thursday, June 23, 2022 6:17 AM
>
> >
> > ret = -EIO;
> > - domain->domain = iommu_domain_alloc(bus);
> > + domain->domain = iommu_domain_alloc(iommu_api_dev->dev-
> >bus);
>
> It makes sense to move away from a bus centric interface to iommu ops
> and I can see that having a device interface when we have device level
> address-ability within a group makes sense, but does it make sense to
> only have that device level interface? For example, if an iommu_group
> is going to remain an aspect of the iommu subsystem, shouldn't we be
> able to allocate a domain and test capabilities based on the group and
> the iommu driver should have enough embedded information reachable
> from
> the struct iommu_group to do those things? This "perform group level
> operations based on an arbitrary device in the group" is pretty klunky.
> Thanks,
>

This sounds a right thing to do.

btw another alternative which I'm thinking of is whether vfio_group
can record the bus info when the first device is added to it in
__vfio_register_dev(). Then we don't need a group interface from
iommu to test if vfio is the only user having such requirement.