From: Jason Gunthorpe <jgg@nvidia.com>
To: Yi Liu <yi.l.liu@intel.com>
Cc: Baolu Lu <baolu.lu@linux.intel.com>,
joro@8bytes.org, kevin.tian@intel.com, eric.auger@redhat.com,
nicolinc@nvidia.com, chao.p.peng@linux.intel.com,
iommu@lists.linux.dev, vasant.hegde@amd.com, will@kernel.org
Subject: Re: [PATCH] iommufd: Deal with IOMMU_HWPT_FAULT_ID_VALID in iommufd core
Date: Tue, 10 Dec 2024 09:57:40 -0400 [thread overview]
Message-ID: <20241210135740.GH2347147@nvidia.com> (raw)
In-Reply-To: <95a85b9b-a17b-4df5-a1ac-7a0880950960@intel.com>
On Tue, Dec 10, 2024 at 01:52:28PM +0800, Yi Liu wrote:
> On 2024/12/9 23:05, Jason Gunthorpe wrote:
> > On Mon, Dec 09, 2024 at 10:51:51AM +0800, Yi Liu wrote:
> > > On 2024/12/9 09:08, Baolu Lu wrote:
> > > > On 12/7/24 20:01, Yi Liu wrote:
> > > > > IOMMU_HWPT_FAULT_ID_VALID is used to mark if the fault_id field of
> > > > > iommu_hwp_alloc is valid or not. As the fault_id field is handled in
> > > > > the iommufd core, so it makes sense to sanitize the
> > > > > IOMMU_HWPT_FAULT_ID_VALID flag in the iommufd core, and mask it out
> > > > > before passing the user flags to the iommu drivers.
> > > >
> > > > Is it a valid use case for an iommu driver to intercept the
> > > > IOMMU_HWPT_FAULT_ID_VALID flag as an indication that user space requests
> > > > an iopf-capable domain?
> >
> > For now we have no use case, so we can drop it from drivers, I think.
> >
> > PRI support or not is decided when the domain is attached based on the
> > fault_handler in the struct iommu_domain.
>
> hmmm. It sounds reasonable. But I failed to see such checks in iommu
> drivers.
It would not surprise me, but also we are deliberately being very lax
on fault support to allow devices with internal fault queues.
> So attaching a non-fault capable domain to a device that has
> enabled PRI can succeed.
Yes
> But the PRQs from this device will be responded as bad PRQ.
The core code should be doing this in the fault handler when it
fails to find an appropriate domain to deliver the fault to.
Inside iommu_report_device_fault() find_fault_handler() will fail:
if (!attach_handle->domain->iopf_handler)
return NULL;
Which should permanently abort the PRI to the device.
> yes, iommu driver should be able to fail such attempts in attach phase.
> So I may keep this patch as it is since IOMMU_HWPT_FAULT_ID_VALID is not
> supposed to be used by iommu drivers.
It makes sense
IMHO we don't have a clear set of rules when the iommu driver should
permit a fault capable domain to be attached. We don't have any API to
tell if the device will handle faults internally or if the device
requires PRI.
A device that can do internal faults only requires ATS support from
the iommu. Otherwise you need PRI enabled at the device and PRI
support in the iommu HW.
Then there is the special ARM stall mode too..
For now I would leave this as is.
Jason
next prev parent reply other threads:[~2024-12-10 13:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-07 12:01 [PATCH] iommufd: Deal with IOMMU_HWPT_FAULT_ID_VALID in iommufd core Yi Liu
2024-12-09 1:08 ` Baolu Lu
2024-12-09 2:51 ` Yi Liu
2024-12-09 15:05 ` Jason Gunthorpe
2024-12-10 5:52 ` Yi Liu
2024-12-10 13:57 ` Jason Gunthorpe [this message]
2024-12-11 8:58 ` Tian, Kevin
2024-12-11 9:16 ` Yi Liu
2024-12-11 8:59 ` Tian, Kevin
2024-12-11 20:02 ` Jason Gunthorpe
2024-12-12 2:22 ` Yi Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241210135740.GH2347147@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=chao.p.peng@linux.intel.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=nicolinc@nvidia.com \
--cc=vasant.hegde@amd.com \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.