[PATCH RFC v2 8/9] iommu/arm-smmu-v3: Add IRQ mapping -EPROBE_DEFER handling

Lorenzo Pieralisi lpieralisi at kernel.org
Mon Nov 30 00:54:40 PST 2026


With the advent of GICv5, IRQs mapping can fail if the interrupt
controller the wired SMMU interrupts are routed to has not probed
yet when the SMMU driver probes.

Handle -EPROBE_DEFER gracefully for IRQ mappings failures.

Signed-off-by: Lorenzo Pieralisi <lpieralisi at kernel.org>
---
Cc: Will Deacon <will at kernel.org>
Cc: Robin Murphy <robin.murphy at arm.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 +++++++++++++++++++----------
 1 file changed, 28 insertions(+), 15 deletions(-)

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 6d4520c47308..602a31ea3bd1 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -5779,13 +5779,26 @@ static struct arm_smmu_device *arm_smmu_impl_probe(struct arm_smmu_device *smmu)
 	return ERR_PTR(ret);
 }
 
+static int arm_smmu_get_irq(struct platform_device *pdev, const char *name,
+			    int *irq_out)
+{
+	int irq = platform_get_irq_byname_optional(pdev, name);
+
+	if (irq == -EPROBE_DEFER)
+		return dev_err_probe(&pdev->dev, irq, "failed to get %s IRQ\n", name);
+	if (irq > 0)
+		*irq_out = irq;
+
+	return 0;
+}
+
 static int arm_smmu_device_probe(struct platform_device *pdev)
 {
-	int irq, ret;
 	struct resource *res;
 	resource_size_t ioaddr;
 	struct arm_smmu_device *smmu;
 	struct device *dev = &pdev->dev;
+	int ret;
 
 	smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL);
 	if (!smmu)
@@ -5833,22 +5846,22 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 
 	/* Interrupt lines */
 
-	irq = platform_get_irq_byname_optional(pdev, "combined");
-	if (irq > 0)
-		smmu->combined_irq = irq;
-	else {
-		irq = platform_get_irq_byname_optional(pdev, "eventq");
-		if (irq > 0)
-			smmu->evtq.q.irq = irq;
+	ret = arm_smmu_get_irq(pdev, "combined", &smmu->combined_irq);
+	if (ret)
+		return ret;
 
-		irq = platform_get_irq_byname_optional(pdev, "priq");
-		if (irq > 0)
-			smmu->priq.q.irq = irq;
-
-		irq = platform_get_irq_byname_optional(pdev, "gerror");
-		if (irq > 0)
-			smmu->gerr_irq = irq;
+	if (!smmu->combined_irq) {
+		ret = arm_smmu_get_irq(pdev, "eventq", &smmu->evtq.q.irq);
+		if (ret)
+			return ret;
+		ret = arm_smmu_get_irq(pdev, "priq", &smmu->priq.q.irq);
+		if (ret)
+			return ret;
+		ret = arm_smmu_get_irq(pdev, "gerror", &smmu->gerr_irq);
+		if (ret)
+			return ret;
 	}
+
 	/* Probe the h/w */
 	ret = arm_smmu_device_hw_probe(smmu);
 	if (ret)

-- 
2.53.0




More information about the linux-arm-kernel mailing list