[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240902104819.a2jto6l3tv2h5wvq@joelS2.panther.com>
Date: Mon, 2 Sep 2024 12:48:19 +0200
From: Joel Granados <j.granados@...sung.com>
To: Jason Gunthorpe <jgg@...pe.ca>
CC: Klaus Jensen <its@...elevant.dk>, David Woodhouse <dwmw2@...radead.org>,
Lu Baolu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>, "Will
Deacon" <will@...nel.org>, Robin Murphy <robin.murphy@....com>, Kevin Tian
<kevin.tian@...el.com>, Minwoo Im <minwoo.im@...sung.com>,
<linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>, Klaus Jensen
<k.jensen@...sung.com>
Subject: Re: [PATCH RFC PREVIEW 0/6] iommu: enable user space iopfs in
non-nested and non-svm cases
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?
>
> > 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..
Yes! This is an obvious application of libvfn. Do you see it as a
something that can be included in tools/selftests/iommu?
Best
--
Joel Granados
Powered by blists - more mailing lists