From: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: David Woodhouse <dwmw2@infradead.org>,
Lu Baolu <baolu.lu@linux.intel.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Sergey Temerkhanov <sergey.temerkhanov@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 4/4] iommu: Notify requesters of IOMMU fault failures
Date: Thu, 10 Jul 2025 13:42:15 +0000 [thread overview]
Message-ID: <20250710134215.97840-5-sergey.temerkhanov@intel.com> (raw)
In-Reply-To: <20250710134215.97840-1-sergey.temerkhanov@intel.com>
Call the notifier callbacks installed by the device drivers when
failing IOMMU page faults occur during the SVA mode operation.
Signed-off-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/iommu/iommu-sva.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c
index 1a51cfd82808..18b6d9b02899 100644
--- a/drivers/iommu/iommu-sva.c
+++ b/drivers/iommu/iommu-sva.c
@@ -256,11 +256,19 @@ iommu_sva_handle_mm(struct iommu_fault *fault, struct mm_struct *mm)
return status;
}
+static struct iommu_rid_notifier *iommu_get_rid_notifier(struct device *dev, u32 rid)
+{
+ struct dev_iommu *param = dev->iommu;
+
+ return xa_load(¶m->rid_notifiers, rid);
+}
+
static void iommu_sva_handle_iopf(struct work_struct *work)
{
struct iopf_fault *iopf;
struct iopf_group *group;
enum iommu_page_response_code status = IOMMU_PAGE_RESP_SUCCESS;
+ struct iommu_rid_notifier *rid_notifier;
group = container_of(work, struct iopf_group, work);
list_for_each_entry(iopf, &group->faults, list) {
@@ -268,8 +276,17 @@ static void iommu_sva_handle_iopf(struct work_struct *work)
* For the moment, errors are sticky: don't handle subsequent
* faults in the group if there is an error.
*/
- if (status != IOMMU_PAGE_RESP_SUCCESS)
+ if (status != IOMMU_PAGE_RESP_SUCCESS) {
+ /* Notify the requester of a failure. */
+ rid_notifier = iommu_get_rid_notifier(group->fault_param->dev,
+ iopf->fault.prm.rid);
+
+ if (rid_notifier && rid_notifier->notifier)
+ rid_notifier->notifier(rid_notifier->dev, &iopf->fault,
+ status, rid_notifier->data);
+
break;
+ }
status = iommu_sva_handle_mm(&iopf->fault,
group->attach_handle->domain->mm);
--
2.43.0
next prev parent reply other threads:[~2025-07-10 13:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 13:42 [PATCH v1 0/4] Implement IOMMU SVA page fault processing error notifiers Sergey Temerkhanov
2025-07-10 13:42 ` [PATCH v1 1/4] iommu: Pass the Requester ID in the fault parameter structure Sergey Temerkhanov
2025-07-10 13:42 ` [PATCH v1 2/4] iommu: Add rid_notifier array to the dev_iommu structure Sergey Temerkhanov
2025-07-10 13:42 ` [PATCH v1 3/4] iommu: Implement iommu_set_rid_fault_notifier() Sergey Temerkhanov
2025-07-10 13:42 ` Sergey Temerkhanov [this message]
2025-07-14 15:00 ` [PATCH v1 4/4] iommu: Notify requesters of IOMMU fault failures Jason Gunthorpe
2025-07-16 11:20 ` Temerkhanov, Sergey
2025-07-14 14:56 ` [PATCH v1 0/4] Implement IOMMU SVA page fault processing error notifiers Jason Gunthorpe
2025-07-16 11:07 ` Temerkhanov, Sergey
2025-07-16 12:10 ` Jason Gunthorpe
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=20250710134215.97840-5-sergey.temerkhanov@intel.com \
--to=sergey.temerkhanov@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®