Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/arm-smmu-v3: Support IOPF for masters with multiple StreamIDs
@ 2026-11-23 13:08 Amita Mishra
  0 siblings, 0 replies; only message in thread
From: Amita Mishra @ 2026-11-23 13:08 UTC (permalink / raw)
  To: Will Deacon
  Cc: Robin Murphy, Joerg Roedel, Jason Gunthorpe,
	Jean-Philippe Brucker, Mostafa Saleh, linux-arm-kernel, iommu,
	linux-kernel, Amita Mishra

Currently arm_smmu_enable_iopf() rejects stall-capable master devices
with more than one StreamID because arm_smmu_page_response() hardcodes
master->streams[0].id when issuing CMDQ_OP_RESUME instead of tracking
which stream originated the fault.

Save the faulting StreamID in fault_evt.fault.prm.private_data[0] in
arm_smmu_handle_event(), use it in arm_smmu_page_response() to target
CMDQ_OP_RESUME at the stalled stream, and drop the single-stream check
in arm_smmu_enable_iopf().

Signed-off-by: Amita Mishra <amitamishra@google.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 100b34f07032..53c396d3187a 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -954,10 +954,11 @@ static int arm_smmu_cmdq_batch_submit(struct arm_smmu_device *smmu,
 					   cmds->num, true);
 }
 
-static void arm_smmu_page_response(struct device *dev, struct iopf_fault *unused,
+static void arm_smmu_page_response(struct device *dev, struct iopf_fault *evt,
 				   struct iommu_page_response *resp)
 {
 	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
+	u32 sid = evt->fault.prm.private_data[0];
 	u8 resume_resp;
 
 	if (WARN_ON(!master->stall_enabled))
@@ -977,8 +978,7 @@ static void arm_smmu_page_response(struct device *dev, struct iopf_fault *unused
 	}
 
 	arm_smmu_cmdq_issue_cmd(master->smmu,
-				arm_smmu_make_cmd_resume(master->streams[0].id,
-							 resp->grpid,
+				arm_smmu_make_cmd_resume(sid, resp->grpid,
 							 resume_resp));
 	/*
 	 * Don't send a SYNC, it doesn't do anything for RESUME or PRI_RESP.
@@ -2164,6 +2164,7 @@ static int arm_smmu_handle_event(struct arm_smmu_device *smmu, u64 *evt,
 			.grpid = event->stag,
 			.perm = perm,
 			.addr = event->iova,
+			.private_data[0] = event->sid,
 		};
 
 		if (event->ssv) {
@@ -3313,10 +3314,6 @@ static int arm_smmu_enable_iopf(struct arm_smmu_master *master,
 	if (!master->stall_enabled)
 		return 0;
 
-	/* We're not keeping track of SIDs in fault events */
-	if (master->num_streams != 1)
-		return -EOPNOTSUPP;
-
 	if (master->iopf_refcount) {
 		master->iopf_refcount++;
 		master_domain->using_iopf = true;

base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
-- 
2.56.1.750.gf70dc682cf-goog



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23 13:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 13:08 [PATCH] iommu/arm-smmu-v3: Support IOPF for masters with multiple StreamIDs Amita Mishra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox