Re: [PATCH RFC PREVIEW 0/6] iommu: enable user space iopfs in non-nested and non-svm cases
From: Jason Gunthorpe
Date: Mon Aug 26 2024 - 10:00:08 EST
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.
I definitely expect PRI to work outside PASID and SVA cases, so this
is going in a good direction
> Supplementary repositories supporting this patchset:
> 1. A user space library libvfn [1] which is used for testing and
> verification (see examples/iopf.c), and
That's pretty neat, I've been wanting to see some kind of IOMMU test
suite based around a capable widely available device. This is the
closest I've seen..
Jason