Re: [PATCH v5 07/15] iommu/arm-smmu-v3: Submit CMDQ_OP_PRI_RESP for IOPF event

From: Jason Gunthorpe

Date: Wed Sep 23 2026 - 14:44:58 EST


> [ ... 66 lines skipped ... ]
> + /* IOPF is gated to num_streams == 1 in arm_smmu_enable_iopf() */
> + sid = master->streams[0].id;
> +
> + if (master->stall_enabled) {
> + u8 resume_resp;
> +
> + switch (resp->code) {
> + case IOMMU_PAGE_RESP_INVALID:
> + case IOMMU_PAGE_RESP_FAILURE:
> + resume_resp = CMDQ_RESUME_0_RESP_ABORT;
> + break;
> + case IOMMU_PAGE_RESP_SUCCESS:
> + resume_resp = CMDQ_RESUME_0_RESP_RETRY;
> + break;
> + default:
> + resume_resp = CMDQ_RESUME_0_RESP_TERM;
> + break;
> + }
> + cmd = arm_smmu_make_cmd_resume(sid, resp->grpid, resume_resp);
[Severity: Medium]
This is a pre-existing issue, but does hardcoding the SID to streams[0].id
cause the wrong stream to be resumed on multi-SID devices?

This seems right. Stall mode should encode the SID in the iopf_fault
event, maybe in the private data and recover it here.

> [ ... 20 lines skipped ... ]
> + default:
> + WARN_ON(true);
> + return;
> + }
> + ssv = !!(prm->flags & IOMMU_FAULT_PAGE_REQUEST_PASID_VALID);

No need for !! when asigning or casting through a bool type. Compiler
does it automatically.

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

--
Jason