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

From: Alex Williamson
Date: Thu Jun 23 2022 - 16:36:01 EST


On Thu, 23 Jun 2022 08:46:45 +0000
"Tian, Kevin" <kevin.tian@xxxxxxxxx> wrote:

> > 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.

That might be more simple, but it's just another variation on vfio
picking an arbitrary device from a group to satisfy the iommu interface
rather than operating on an iommu subsystem provided object. Thanks,

Alex