Re: [PATCH RFC PREVIEW 0/6] iommu: enable user space iopfs in non-nested and non-svm cases

From: Joel Granados
Date: Mon Sep 02 2024 - 07:09:13 EST


On Mon, Sep 02, 2024 at 12:48:19PM +0200, Joel Granados wrote:
> On Mon, Aug 26, 2024 at 10:59:55AM -0300, Jason Gunthorpe wrote:
> > On Mon, Aug 26, 2024 at 01:40:26PM +0200, Klaus Jensen wrote:
> > > This is a Request for Comment series that will hopefully generate
> > > initial feedback on the use of the iommufd_hwpt_replace_device to
> > > execute non-nested and non-svm user space IOPFs. Our main motivation is
> > > to enable user-space driver driven device verification with default
> > > pasid and without nesting nor SVM.
> > >
> > > What?
> > > * Enable IO page fault handling in user space in a non-nested, non-svm
> > > and non-virtualised use case.
> > > * Removing the relation between IOPF and INTEL_IOMMU_SVM by allowing
> > > the user to (de)select the IOPF code through Kconfig.
> > > * Create a new file under iommu/intel (prq.c) that contains all the
> > > page request queue related logic and is not under intel/svm.c.
> > > * Add the IOMMU_HWPT_FAULT_ID_VALID to the valid flags used to create
> > > IOMMU_HWPT_ALLOC allocations.
> > > * Create a default (zero) pasid handle and insert it to the pasid
> > > array within the dev->iommu_group when replacing the old HWPT with
> > > an iopf enabled HWPT.
> > >
> > > Why?
> > > The PCI ATS Extended Capability allows peripheral devices to
> > > participate in the caching of translations when operating under an
> > > IOMMU. Further, the ATS Page Request Interface (PRI) Extension allows
> > > devices to handle missing mappings. Currently, PRI is mainly used in
> > > the context of Shared Virtual Addressing, requiring support for the
> > > Process Address Space Identifier (PASID) capability, but other use
> > > cases such as enabling user-space driver driven device verification
> > > and reducing memory pinning exists. This patchest sets out to enable
> > > these use cases.
> >
> Sorry for the late reply, Slowly getting through my backlog after PTO
>
> > I definitely expect PRI to work outside PASID and SVA cases, so this
> > is going in a good direction
> This touches on a detail (at least in Intel's vtd-io spec) that is not
> 100% clear to me. Second paragraph of section "3.4.3 Scalable Mode
> Address Translation" reads:
> "
> ... Scalable-mode context-entries support both requests-without-PASID
> and requests-with-PASID. However unlike legacy mode, in scalable-mode,
> requests-without-PASID obtain a PASID value from the RID_PASID field of
> the scalable-mode context- entry and are processed similarly to
> requests-with-PASID.Implementations not supporting RID_PASID capability
> (ECAP_REG.RPS is 0b), use a PASID value of 0 to perform address
> translation for requests without PASID.
> "
> This basically means that a default PASID is used even though the
> request is without PASID. Right? Therefore "outside PASID" means with
> the default PASID (at least in Intels case). Right?
This is something that is related to patches 5/6 and 6/6 of this set.
And maybe is more a question for Lu Baolu.

Best

--

Joel Granados