Skip to content

Commit 7217cee

Browse files
YaXing-Guojoergroedel
authored andcommitted
iommu/riscv: Skip IRQ count check when using MSI interrupts
In RISC-V IOMMU platform devices that use MSI interrupts (indicated by the presence of 'msi-parent' in the device tree), there are no wired interrupt lines, so calling platform_get_irq_count() returns 0 or -ENXIO, causing the driver to fail during probe. However, MSI interrupts are allocated dynamically via the MSI subsystem and do not appear in the device tree 'interrupts' property. Therefore, the driver should not require a non-zero IRQ count when 'msi-parent' is present. This patch fixes the bug where probe fails when using MSI interrupts (which do not have an 'interrupts' property in the device tree).. Fixes: <d5f88acdd6ff> ("iommu/riscv: Add support for platform msi") Signed-off-by: Yaxing Guo <guoyaxing@bosc.ac.cn> Reviewed-by: Andrew Jones <andrew.jones@oss.qualcomm.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent f5c262b commit 7217cee

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

drivers/iommu/riscv/iommu-platform.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,7 @@ static int riscv_iommu_platform_probe(struct platform_device *pdev)
6868
iommu->caps = riscv_iommu_readq(iommu, RISCV_IOMMU_REG_CAPABILITIES);
6969
iommu->fctl = riscv_iommu_readl(iommu, RISCV_IOMMU_REG_FCTL);
7070

71-
iommu->irqs_count = platform_irq_count(pdev);
72-
if (iommu->irqs_count <= 0)
73-
return dev_err_probe(dev, -ENODEV,
74-
"no IRQ resources provided\n");
75-
if (iommu->irqs_count > RISCV_IOMMU_INTR_COUNT)
76-
iommu->irqs_count = RISCV_IOMMU_INTR_COUNT;
71+
iommu->irqs_count = RISCV_IOMMU_INTR_COUNT;
7772

7873
igs = FIELD_GET(RISCV_IOMMU_CAPABILITIES_IGS, iommu->caps);
7974
switch (igs) {
@@ -120,6 +115,13 @@ static int riscv_iommu_platform_probe(struct platform_device *pdev)
120115
fallthrough;
121116

122117
case RISCV_IOMMU_CAPABILITIES_IGS_WSI:
118+
iommu->irqs_count = platform_irq_count(pdev);
119+
if (iommu->irqs_count <= 0)
120+
return dev_err_probe(dev, -ENODEV,
121+
"no IRQ resources provided\n");
122+
if (iommu->irqs_count > RISCV_IOMMU_INTR_COUNT)
123+
iommu->irqs_count = RISCV_IOMMU_INTR_COUNT;
124+
123125
for (vec = 0; vec < iommu->irqs_count; vec++)
124126
iommu->irqs[vec] = platform_get_irq(pdev, vec);
125127

0 commit comments

Comments
 (0)