[PATCH v3 07/13] drm/panfrost: Sync with IRQ before MMU disable and reset

From: Adrián Larumbe

Date: Thu Jul 23 2026 - 20:02:49 EST


There was a pitfall of the MMU threaded IRQ handler accessing HW
registers after a spurious interrupt at the same time the device is
being premature taking down because of a failed probe sequence.

Let's make sure MMU IRQ's are marked suspended and synchronised with
before unwinding further.

Also, during a device reset, make sure we also sync with the MMU IRQ
handler so that AS aren't clobbered while a map operation is ongoing.

Signed-off-by: Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index bb6c1614964b..f067bcd360a8 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -347,6 +347,7 @@ void panfrost_mmu_reset(struct panfrost_device *pfdev)
struct panfrost_mmu *mmu, *mmu_tmp;

clear_bit(PANFROST_COMP_BIT_MMU, pfdev->is_suspended);
+ synchronize_irq(pfdev->mmu_irq);

spin_lock(&pfdev->as_lock);

@@ -980,11 +981,6 @@ int panfrost_mmu_init(struct panfrost_device *pfdev)
return 0;
}

-void panfrost_mmu_fini(struct panfrost_device *pfdev)
-{
- mmu_write(pfdev, MMU_INT_MASK, 0);
-}
-
void panfrost_mmu_suspend_irq(struct panfrost_device *pfdev)
{
set_bit(PANFROST_COMP_BIT_MMU, pfdev->is_suspended);
@@ -992,3 +988,8 @@ void panfrost_mmu_suspend_irq(struct panfrost_device *pfdev)
mmu_write(pfdev, MMU_INT_MASK, 0);
synchronize_irq(pfdev->mmu_irq);
}
+
+void panfrost_mmu_fini(struct panfrost_device *pfdev)
+{
+ panfrost_mmu_suspend_irq(pfdev);
+}

--
2.55.0