Re: [PATCH v5 10/15] iommu/arm-smmu-v3: Support PRI Page Request in arm_smmu_handle_ppr()

From: Jason Gunthorpe

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


> [ ... 60 lines skipped ... ]
> + mutex_lock(&smmu->streams_mutex);
> + master = arm_smmu_find_master(smmu, sid);
> + if (master && master->pri_enabled) {
> + struct iopf_fault iopf_fault = {};
> + struct iommu_fault *fault = &iopf_fault.fault;
> +
> + fault->type = IOMMU_FAULT_PAGE_REQ;
> + if (last)
> + fault->prm.flags |= IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE;
> + if (ssv) {
> + fault->prm.flags |=
> + IOMMU_FAULT_PAGE_REQUEST_PASID_VALID;
> + fault->prm.pasid = ssid;
> + }
> + fault->prm.grpid = grpid;
> + if (evt[0] & PRIQ_0_PERM_READ)
> + fault->prm.perm |= IOMMU_FAULT_PERM_READ;
> + if (evt[0] & PRIQ_0_PERM_WRITE)
> + fault->prm.perm |= IOMMU_FAULT_PERM_WRITE;
> + if (evt[0] & PRIQ_0_PERM_EXEC)
> + fault->prm.perm |= IOMMU_FAULT_PERM_EXEC;
> + if (evt[0] & PRIQ_0_PERM_PRIV)
> + fault->prm.perm |= IOMMU_FAULT_PERM_PRIV;
> + fault->prm.addr = FIELD_GET(PRIQ_1_ADDR_MASK, evt[1]) << 12;
> +
> + iommu_report_device_fault(master->dev, &iopf_fault);
> + mutex_unlock(&smmu->streams_mutex);

This doesn't need to hold this mutex when calling report, the irq
should be synchronized when the master is removed to keep dev stable.

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

--
Jason