[PATCH v1 0/4] Implement IOMMU SVA page fault processing error notifiers

Sergey Temerkhanov posted 4 patches 2 months, 4 weeks ago
drivers/iommu/intel/prq.c  |  1 +
drivers/iommu/io-pgfault.c | 53 ++++++++++++++++++++++++++++++++++++++
drivers/iommu/iommu-priv.h | 11 ++++++++
drivers/iommu/iommu-sva.c  | 19 +++++++++++++-
drivers/iommu/iommu.c      | 21 +++++++++++++++
include/linux/iommu.h      | 19 ++++++++++++++
6 files changed, 123 insertions(+), 1 deletion(-)
[PATCH v1 0/4] Implement IOMMU SVA page fault processing error notifiers
Posted by Sergey Temerkhanov 2 months, 4 weeks ago
This series introduces a facility of notifying endpoint device
drivers of failing IOMMU page faults occurring for specific
Requester IDs.

According to the PCIe spec chapter "Page Request Group Response Message",
in case of Page Request processing failure (e.g., detecting attempt to
access pages with insufficient permissions, like writing to RO pages)
the system responds to the requester with a message containing a non-zero
response code. The requester device is then supposed to process that
response in implementation dependent way.

However, some endpoint hardware supporting SVA does not provide insight
on failed IO page faults, being limited to generic error reporting
(via interrupts and/or few register bits).

These series contain changes that provide endpoint device drivers
with the ability to retrieve information about page fault processing
errors (the most relevant being PASID and IOVA PFN).

Endpoint device drivers are able to set a callback functions
which will be called when a failing page fault (such as accessing pages
with mismatching attributes - e.g. writing to RO pages) occurs.

Normal processing path (i.e., swapping in or allocating backing physical
memory for non-present pages) is unaffected by these changes.

The endpoint driver code can then take appropriate actions, such as
fault reporting and recovery, sending signals to affected processes etc,
using the fault context provided in the fault parameter structure.


Sergey Temerkhanov (4):
  iommu: Pass the Requester ID in the fault parameter structure
  iommu: Add rid_notifier array to the dev_iommu structure
  iommu: Implement iommu_set_rid_fault_notifier()
  iommu: Notify requesters of IOMMU fault failures

 drivers/iommu/intel/prq.c  |  1 +
 drivers/iommu/io-pgfault.c | 53 ++++++++++++++++++++++++++++++++++++++
 drivers/iommu/iommu-priv.h | 11 ++++++++
 drivers/iommu/iommu-sva.c  | 19 +++++++++++++-
 drivers/iommu/iommu.c      | 21 +++++++++++++++
 include/linux/iommu.h      | 19 ++++++++++++++
 6 files changed, 123 insertions(+), 1 deletion(-)

-- 
2.43.0
Re: [PATCH v1 0/4] Implement IOMMU SVA page fault processing error notifiers
Posted by Jason Gunthorpe 2 months, 3 weeks ago
On Thu, Jul 10, 2025 at 01:42:11PM +0000, Sergey Temerkhanov wrote:
> These series contain changes that provide endpoint device drivers
> with the ability to retrieve information about page fault processing
> errors (the most relevant being PASID and IOVA PFN).

You need to come with a driver using this as well.

Jason
RE: [PATCH v1 0/4] Implement IOMMU SVA page fault processing error notifiers
Posted by Temerkhanov, Sergey 2 months, 3 weeks ago
> -----Original Message-----
> From: Jason Gunthorpe <jgg@ziepe.ca>
> 
> You need to come with a driver using this as well.
> 

There is an OOT driver which would use this facility do report and handle possible invalid accesses (e.g. mismatched VMA permissions) during the SVA operation
https://www.intel.com/content/www/us/en/download/858019/intel-media-transcode-accelerator.html

Regards,
Sergey
Re: [PATCH v1 0/4] Implement IOMMU SVA page fault processing error notifiers
Posted by Jason Gunthorpe 2 months, 3 weeks ago
On Wed, Jul 16, 2025 at 11:07:50AM +0000, Temerkhanov, Sergey wrote:
> > -----Original Message-----
> > From: Jason Gunthorpe <jgg@ziepe.ca>
> > 
> > You need to come with a driver using this as well.
> > 
> 
> There is an OOT driver which would use this facility do report and
> handle possible invalid accesses (e.g. mismatched VMA permissions)
> during the SVA operation

Upstream a basic driver first then ask for iommu changes to enhance
it.

This is normal stuff, we don't change the kernel to accomodate OOT
drivers.

Jason