[PATCH v3 05/13] iommu/arm-smmu-v3: Allocate IOPF queue without FEAT_SVA
Nicolin Chen
nicolinc at nvidia.com
Mon Aug 31 17:33:30 PDT 2026
arm_smmu_init_queues() currently allocates smmu->evtq.iopf only when both
FEAT_SVA and FEAT_STALLS are advertised by the SMMU. The FEAT_SVA gate is
unnecessary: iopf_queue_alloc() is a plain workqueue allocator with 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 now
oopses on mutex_lock(&queue->lock).
Drop the FEAT_SVA term so the IOPF workqueue is allocated whenever the SMMU
can produce IOPF events, and select IOMMU_IOPF from ARM_SMMU_V3 as well, so
iopf_queue_alloc() has a real implementation instead of the NULL-returning
stub when CONFIG_ARM_SMMU_V3_SVA is unset.
IOPF is orthogonal to SVA anyway. So, drop the CONFIG_ARM_SMMU_V3_SVA gates
in arm_smmu_enable_iopf() and arm_smmu_disable_iopf().
Fixes: 395ad89d11fd9 ("iommu/arm-smmu-v3: Add stall support for platform devices")
Cc: stable at vger.kernel.org # v5.14
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>
---
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 1851ee7ec15b9..352c916b2a572 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -3204,9 +3204,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
@@ -3238,9 +3235,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
More information about the linux-arm-kernel
mailing list