[PATCH v4 06/15] iommu/arm-smmu-v3: Allocate IOPF queue without FEAT_SVA
From: Nicolin Chen <hidden>
Date: 2026-09-10 23:17:56
Also in:
linux-iommu, linux-pci, lkml
Subsystem:
arm smmu drivers, iommu subsystem, the rest · Maintainers:
Will Deacon, Joerg Roedel, Linus Torvalds
arm_smmu_init_queues() allocates the IOPF queue only for FEAT_SVA together
with FEAT_STALLS. This queue has no SVA dependency, and FEAT_STALLS alone
can produce events that need IOPF.
On HW with FEAT_STALLS but no FEAT_SVA, a master with the "dma-can-stall"
device-tree property has master->stall_enabled set at probe. Then also with
CONFIG_ARM_SMMU_V3_SVA=y, arm_smmu_enable_iopf() sees stall_enabled, calls
iopf_queue_add_device(NULL, ...) at fault-handling domain attach, which can
oops on mutex_lock(&queue->lock).
Allocate the queue whenever FEAT_STALLS is present. Also select IOMMU_IOPF
so iopf_queue_alloc() is always available without CONFIG_ARM_SMMU_V3_SVA.
Since IOPF does not depend on SVA, drop the SVA guards from its enable and
disable paths.
Fixes: 395ad89d11fd9 ("iommu/arm-smmu-v3: Add stall support for platform devices")
Cc: stable@vger.kernel.org # v5.14
Assisted-by: Claude:claude-opus-4-8
Reviewed-by: Jonathan Cameron <redacted>
Signed-off-by: Nicolin Chen <redacted>
---
drivers/iommu/arm/Kconfig | 1 +
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 +--------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/iommu/arm/Kconfig b/drivers/iommu/arm/Kconfig
index 5fac08b89deea..b848a4253677d 100644
--- a/drivers/iommu/arm/Kconfig
+++ b/drivers/iommu/arm/Kconfig@@ -78,6 +78,7 @@ config ARM_SMMU_V3 depends on ARM64 select IOMMU_API select IOMMU_IO_PGTABLE_LPAE + select IOMMU_IOPF select GENERIC_MSI_IRQ select IOMMUFD_DRIVER if IOMMUFD help
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 a915d8b0baf69..8b7d88d469198 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c@@ -3207,9 +3207,6 @@ static int arm_smmu_enable_iopf(struct arm_smmu_master *master, iommu_group_mutex_assert(master->dev); - if (!IS_ENABLED(CONFIG_ARM_SMMU_V3_SVA)) - return -EOPNOTSUPP; - /* * Drivers for devices supporting PRI or stall require iopf others have * device-specific fault handlers and don't need IOPF, so this is not a
@@ -3241,9 +3238,6 @@ static void arm_smmu_disable_iopf(struct arm_smmu_master *master, { iommu_group_mutex_assert(master->dev); - if (!IS_ENABLED(CONFIG_ARM_SMMU_V3_SVA)) - return; - if (!master_domain || !master_domain->using_iopf) return;
@@ -4659,8 +4653,7 @@ static int arm_smmu_init_queues(struct arm_smmu_device *smmu) if (ret) return ret; - if ((smmu->features & ARM_SMMU_FEAT_SVA) && - (smmu->features & ARM_SMMU_FEAT_STALLS)) { + if (smmu->features & ARM_SMMU_FEAT_STALLS) { smmu->evtq.iopf = iopf_queue_alloc(dev_name(smmu->dev)); if (!smmu->evtq.iopf) return -ENOMEM;
--
2.43.0