Re: [PATCH v4 1/9] iommu: Introduce domain attachment handle
From: Jason Gunthorpe
Date: Tue Apr 09 2024 - 19:38:09 EST
On Tue, Apr 09, 2024 at 09:53:26AM +0800, Baolu Lu wrote:
> On 4/8/24 10:05 PM, Jason Gunthorpe wrote:
> > > void iommufd_fault_domain_detach_dev(struct iommufd_hw_pagetable *hwpt,
> > > struct iommufd_device *idev)
> > > {
> > > + struct iommufd_fault *fault = hwpt->fault;
> > > + struct iommu_attach_handle *handle;
> > > +
> > > if (WARN_ON(!hwpt->fault_capable))
> > > return;
> > >
> > > + handle = iommu_attach_handle_get(idev->igroup->group,
> > > IOMMU_NO_PASID);
> > > iommu_detach_group(hwpt->domain, idev->igroup->group);
> > > iommufd_fault_iopf_disable(idev);
> > But is this right? Couldn't there be PASID's doing PRI?
>
> As far as I can see, there are two types of user PASID.
>
> 1. When a device is assigned to userspace, the PASID table is managed by
> the userspace.
>
> Userspace doesn't need PASID attach/detach/replace uAPIs in this
> scenario. All I/O page faults are directed to userspace through the
> hw pagetable attached to the RID.
>
> If hw pagetable is detached from the RID, or a non-iopf-capable
> hw pagetable is attached the RID, the PRI for user PASID is already
> broken.
I would say in this case the special nesting HWPT should have an
indication if PRI should be supported or not when it is created and
that should drive the PRI enablement..
> The current code base doesn't yet support PASID attach/detach/replace
> uAPIs. Therefore, above code is safe and reasonable. However, we will
> need to revisit this code when those APIs become available.
Okay, I see.
Can we do the PASID iommufd stuff soon? What is the plan here?
Jason