On Wed, Jun 09, 2021 at 09:39:19AM -0300, Jason Gunthorpe wrote: > On Wed, Jun 09, 2021 at 02:24:03PM +0200, Joerg Roedel wrote: > > On Mon, Jun 07, 2021 at 02:58:18AM +0000, Tian, Kevin wrote: > > > - Device-centric (Jason) vs. group-centric (David) uAPI. David is not fully > > > convinced yet. Based on discussion v2 will continue to have ioasid uAPI > > > being device-centric (but it's fine for vfio to be group-centric). A new > > > section will be added to elaborate this part; > > > > I would vote for group-centric here. Or do the reasons for which VFIO is > > group-centric not apply to IOASID? If so, why? > > VFIO being group centric has made it very ugly/difficult to inject > device driver specific knowledge into the scheme. > > The device driver is the only thing that knows to ask: > - I need a SW table for this ioasid because I am like a mdev > - I will issue TLPs with PASID > - I need a IOASID linked to a PASID > - I am a devices that uses ENQCMD and vPASID > - etc in future mdev drivers might know these, but shim drivers, like basic vfio-pci often won't. In that case only the userspace driver will know that for certain. The shim driver at best has a fairly loose bound on what the userspace driver *could* do. I still think you're having a tendency to partially conflate several meanings of "group": 1. the unavoidable hardware unit of non-isolation 2. the kernel internal concept and interface to it 3. the user visible fd and interface We can't avoid having (1) somewhere, (3) and to a lesser extent (2) are what you object to. > The current approach has the group try to guess the device driver > intention in the vfio type 1 code. I agree this has gotten ugly. What I'm not yet convinced of is that reworking groups to make this not-ugly necessarily requires totally minimizing the importance of groups. > I want to see this be clean and have the device driver directly tell > the iommu layer what kind of DMA it plans to do, and thus how it needs > the IOMMU and IOASID configured. > > This is the source of the ugly symbol_get and the very, very hacky 'if > you are a mdev *and* a iommu then you must want a single PASID' stuff > in type1. > > The group is causing all this mess because the group knows nothing > about what the device drivers contained in the group actually want. > > Further being group centric eliminates the possibility of working in > cases like !ACS. How do I use PASID functionality of a device behind a > !ACS switch if the uAPI forces all IOASID's to be linked to a group, > not a device? > > Device centric with an report that "all devices in the group must use > the same IOASID" covers all the new functionality, keep the old, and > has a better chance to keep going as a uAPI into the future. > > Jason > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature