Add stall support to the SMMUv3 driver, along with a common I/O Page Fault handler. Since v12 [1]: * Fixed failure path of arm_smmu_insert_master(), in patch 07 (Keqian Zhu) * In arm_smmu_handle_evt(), patch 10, don't report IPA field on stage-1 faults, and report accurate fault reason (Eric Auger) * Fix possible use-after-free in arm_smmu_handle_evt(), patch 10: if a master is removed while we handle its events, we could in theory dereference a freed master struct. Hold streams_mutex while using a master struct obtained with arm_smmu_find_master(). Future work regarding IOPF: * Keep stall disabled by default, only enable it per CD when drivers request it [2][3]. * Add PRI support to SMMUv3. * Route all recoverable faults through io-pgfault.c, so we can track partial faults better [4]. * Nested IOPF [5]. [1] https://lore.kernel.org/linux-iommu/20210127154322.3959196-1-jean-philippe@xxxxxxxxxx/ [2] https://lore.kernel.org/linux-iommu/22fa4120-eadf-20d5-0d0a-9935aa0f1fb5@xxxxxxxxxxxxx/ [3] https://lore.kernel.org/linux-iommu/YAhui7UOw7743shI@myrica/ [4] https://lore.kernel.org/kvm/YB0f5Yno9frihQq4@myrica/ [5] https://lore.kernel.org/linux-acpi/MWHPR11MB188653AF6EFA0E55DE17815F8CA40@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ Jean-Philippe Brucker (10): iommu: Fix comment for struct iommu_fwspec iommu/arm-smmu-v3: Use device properties for pasid-num-bits iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF uacce: Enable IOMMU_DEV_FEAT_IOPF iommu: Add a page fault handler iommu/arm-smmu-v3: Maintain a SID->device structure dt-bindings: document stall property for IOMMU masters ACPI/IORT: Enable stall support for platform devices iommu/arm-smmu-v3: Add stall support for platform devices drivers/iommu/Makefile | 1 + .../devicetree/bindings/iommu/iommu.txt | 18 + drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 56 ++- drivers/iommu/iommu-sva-lib.h | 53 ++ include/linux/iommu.h | 26 +- drivers/acpi/arm64/iort.c | 15 +- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 59 ++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 354 ++++++++++++-- drivers/iommu/intel/iommu.c | 11 +- drivers/iommu/io-pgfault.c | 461 ++++++++++++++++++ drivers/iommu/of_iommu.c | 5 - drivers/misc/uacce/uacce.c | 39 +- 12 files changed, 1024 insertions(+), 74 deletions(-) create mode 100644 drivers/iommu/io-pgfault.c -- 2.30.1