[PATCH v2 01/11] drm/panfrost: Power the GPU up for a reset queued from the MMU code
From: Arun Iyengar via B4 Relay
Date: Thu Nov 12 2026 - 04:25:42 EST
From: Arun Iyengar <aiyengar1990@xxxxxxxxx>
panfrost_reset_work() calls panfrost_reset() without a runtime PM
reference. The work is queued by panfrost_device_schedule_reset(), which
wait_ready() calls when the AS_ACTIVE bit is stuck, from MMU operations
whose callers drop their own runtime PM reference right after. The work
shares the ordered reset workqueue with the scheduler timeout handlers, so
it can run well after it was queued. If the GPU has gone idle and been
runtime suspended in between, panfrost_reset() writes JOB_INT_MASK and the
job slot registers of a powered-off GPU, which is a synchronous external
abort on arm64.
Take a runtime PM reference in the work, resuming the GPU if needed, and
drop it after the reset. If the GPU cannot be resumed (runtime PM is
disabled during system sleep), no job is running on it and
panfrost_device_runtime_resume() resets it on the way back up, so just
clear the pending flag. Resuming instead of skipping the reset when the
GPU is suspended keeps jobs that a concurrent resume queued behind the
pending flag from waiting for a reset that never comes.
Found by code review only (Sashiko); not reproduced.
Fixes: f9ab9c66f080 ("drm/panfrost: Reset the GPU when the AS_ACTIVE bit is stuck")
Cc: stable@xxxxxxxxxxxxxxx
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/sashiko-outbox-206548@xxxxxxxxxx/
Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
---
drivers/gpu/drm/panfrost/panfrost_job.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 3a46dd61c..0c2fda80c 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -810,7 +810,21 @@ static void panfrost_reset_work(struct work_struct *work)
struct panfrost_device *pfdev;
pfdev = container_of(work, struct panfrost_device, reset.work);
+
+ /* The work can run long after it was queued, when the GPU has gone
+ * idle and been runtime suspended. Power it up for the reset: its
+ * registers are not accessible while it is suspended. If it cannot
+ * be resumed (runtime PM is disabled during system sleep), there is
+ * no job on it, and panfrost_device_runtime_resume() resets it when
+ * it comes back up.
+ */
+ if (pm_runtime_resume_and_get(pfdev->base.dev)) {
+ atomic_set(&pfdev->reset.pending, 0);
+ return;
+ }
+
panfrost_reset(pfdev, NULL);
+ pm_runtime_put_autosuspend(pfdev->base.dev);
}
static const struct drm_sched_backend_ops panfrost_sched_ops = {
--
2.55.0