Re: [RFC v2] /dev/iommu uAPI proposal
From: Jason Gunthorpe
Date: Thu Jul 15 2021 - 14:13:33 EST
On Thu, Jul 15, 2021 at 11:05:45AM -0700, Raj, Ashok wrote:
> On Thu, Jul 15, 2021 at 02:53:36PM -0300, Jason Gunthorpe wrote:
> > On Thu, Jul 15, 2021 at 10:48:36AM -0700, Raj, Ashok wrote:
> >
> > > > > Do we have any isolation requirements here? its the same process. So if the
> > > > > page-request it sent to guest and even if you report it for mdev1, after
> > > > > the PRQ is resolved by guest, the request from mdev2 from the same guest
> > > > > should simply work?
> > > >
> > > > I think we already talked about this and said it should not be done.
> > >
> > > I get the should not be done, I'm wondering where should that be
> > > implemented?
> >
> > The iommu layer cannot have ambiguity. Every RID or RID,PASID slot
> > must have only one device attached to it. Attempting to connect two
> > devices to the same slot fails on the iommu layer.
>
> I guess we are talking about two different things. I was referring to SVM
> side of things. Maybe you are referring to the mdev.
I'm talking about in the hypervisor.
As I've said already, the vIOMMU interface is the problem here. The
guest VM should be able to know that it cannot use PASID 1 with two
devices, like the hypervisor knows. At the very least it should be
able to know that the PASID binding has failed and relay that failure
back to the process.
Ideally the guest would know it should allocate another PASID for
these cases.
But yes, if mdevs are going to be modeled with RIDs in the guest then
with the current vIOMMU we cannot cause a single hypervisor RID to
show up as two RIDs in the guest without breaking the vIOMMU model.
Jason