Skip to content

Commit 1aa55ca

Browse files
Marc Zyngierolofj
authored andcommitted
iommu/rockchip: Move irq request past pm_runtime_enable
Enabling the interrupt early, before power has been applied to the device, can result in an interrupt being delivered too early if: - the IOMMU shares an interrupt with a VOP - the VOP has a pending interrupt (after a kexec, for example) In these conditions, we end-up taking the interrupt without the IOMMU being ready to handle the interrupt (not powered on). Moving the interrupt request past the pm_runtime_enable() call makes sure we can at least access the IOMMU registers. Note that this is only a partial fix, and that the VOP interrupt will still be screaming until the VOP driver kicks in, which advocates for a more synchronized interrupt enabling/disabling approach. Fixes: 0f181d3 ("iommu/rockchip: Add runtime PM support") Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Olof Johansson <olof@lixom.net>
1 parent 3fc7c5c commit 1aa55ca

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

drivers/iommu/rockchip-iommu.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,17 +1161,6 @@ static int rk_iommu_probe(struct platform_device *pdev)
11611161
if (iommu->num_mmu == 0)
11621162
return PTR_ERR(iommu->bases[0]);
11631163

1164-
i = 0;
1165-
while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) {
1166-
if (irq < 0)
1167-
return irq;
1168-
1169-
err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
1170-
IRQF_SHARED, dev_name(dev), iommu);
1171-
if (err)
1172-
return err;
1173-
}
1174-
11751164
iommu->reset_disabled = device_property_read_bool(dev,
11761165
"rockchip,disable-mmu-reset");
11771166

@@ -1228,6 +1217,19 @@ static int rk_iommu_probe(struct platform_device *pdev)
12281217

12291218
pm_runtime_enable(dev);
12301219

1220+
i = 0;
1221+
while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) {
1222+
if (irq < 0)
1223+
return irq;
1224+
1225+
err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
1226+
IRQF_SHARED, dev_name(dev), iommu);
1227+
if (err) {
1228+
pm_runtime_disable(dev);
1229+
goto err_remove_sysfs;
1230+
}
1231+
}
1232+
12311233
return 0;
12321234
err_remove_sysfs:
12331235
iommu_device_sysfs_remove(&iommu->iommu);

0 commit comments

Comments
 (0)