Re: [PATCH v7 3/4] iommu/vt-d: Add set_dev_pasid callback for dma domain
From: Jason Gunthorpe
Date: Tue May 30 2023 - 13:08:46 EST
> > + /*
> > + * The SVA implementation needs to stop mm notification, drain the
> > + * pending page fault requests before tearing down the pasid entry.
> > + * The VT-d spec (section 6.2.3.1) also recommends that software
> > + * could use a reserved domain id for all first-only and pass-through
> > + * translations. Hence there's no need to call
> > domain_detach_iommu()
> > + * in the sva domain case.
> > + */
>
> It's probably clearer to say:
Is this what is going on ??
> /*
> * SVA domain requires special treatment before tearing down the pasid
> * entry:
> * 1) pasid is stored in mm instead of in dev_pasid;
Why? The mm pasid should not be used by any driver code, the PASID the
SVA is hooked to does NOT have to be the mm PASID.
> * 2) all SVA domains share a reserved domain id per recommendation
> * from VT-d spec (section 6.2.3.1) so domain_detach_iommu() is
> * not required;
The DID should be managed and allocated for the S2 pointer and the
flushing logic should work genericly by tracking the S2's being used
and flushing their DIDs when all the S2s fall out of use. The special
identity S2 just gets a static DID that never falls out of use.
Jason