]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/v3d: Idle AXI transactions before disabling the clock on suspend
authorMaíra Canal <mcanal@igalia.com>
Sat, 18 Jul 2026 13:44:37 +0000 (10:44 -0300)
committerMaíra Canal <mcanal@igalia.com>
Wed, 22 Jul 2026 13:36:43 +0000 (10:36 -0300)
Currently, v3d_power_suspend() removes the GPU clock without first
quiescing the GPU's memory interface (AXI). If the clock is cut while the
core still has outstanding AXI transactions in flight, the hardware is
frozen mid-transaction. That corrupted state survives the power cycle, and
the first job submitted after the next resume will cause a GPU hang
accompanied by an L2T "pte invalid" MMU fault.

The hardware already provides a safe-powerdown sequence for this: request
the GMP to stop and wait for outstanding reads/writes to drain
(v3d_idle_axi()), plus the GCA safe shutdown on pre-4.1 HW
(v3d_idle_gca()). The driver implements both, but the runtime PM support
added later never invoked them when powering the GPU down.

Perform the safe-powerdown sequence in v3d_power_suspend() before
disabling the clock, while the core is still powered.

Link: https://github.com/raspberrypi/linux/issues/7443
Link: https://github.com/raspberrypi/linux/issues/7488
Fixes: 458f2a712ab4 ("drm/v3d: Introduce Runtime Power Management")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20260718-v3d-pm-axi-transactions-v1-2-4ecd7729ed70@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
drivers/gpu/drm/v3d/v3d_drv.h
drivers/gpu/drm/v3d/v3d_gem.c
drivers/gpu/drm/v3d/v3d_power.c

index 4ebe175a8c6b0016d087388ce02cd35a8ae65a13..423bcfe331a0141395da6fc32292c68f0bf47a1e 100644 (file)
@@ -571,6 +571,8 @@ extern bool super_pages;
 void v3d_init_hw_state(struct v3d_dev *v3d);
 int v3d_gem_init(struct drm_device *dev);
 void v3d_gem_destroy(struct drm_device *dev);
+void v3d_idle_axi(struct v3d_dev *v3d, int core);
+void v3d_idle_gca(struct v3d_dev *v3d);
 void v3d_reset_sms(struct v3d_dev *v3d);
 void v3d_reset(struct v3d_dev *v3d);
 void v3d_invalidate_caches(struct v3d_dev *v3d);
index bb0eec870794ca1a426142cef0d70805fd1d234d..23a0db9575a5da474d5229c81bae385f4c657208 100644 (file)
@@ -36,7 +36,7 @@ v3d_init_core(struct v3d_dev *v3d, int core)
        V3D_CORE_WRITE(core, V3D_CTL_L2TFLEND, ~0);
 }
 
-static void
+void
 v3d_idle_axi(struct v3d_dev *v3d, int core)
 {
        if (v3d->ver >= V3D_GEN_71) {
@@ -61,7 +61,7 @@ v3d_idle_axi(struct v3d_dev *v3d, int core)
        }
 }
 
-static void
+void
 v3d_idle_gca(struct v3d_dev *v3d)
 {
        if (v3d->ver >= V3D_GEN_41)
index f7df6393d38fe3a83a4aa3e517c6b7a6add3c481..c53146316079b258ab28009060f5ff2e586d866a 100644 (file)
@@ -54,8 +54,15 @@ int v3d_power_suspend(struct device *dev)
 
        v3d_clean_caches(v3d);
 
+       /* Wait until V3D has no active or pending AXI transactions. */
+       v3d_idle_axi(v3d, 0);
+       v3d_idle_gca(v3d);
+
        ret = v3d_suspend_sms(v3d);
        if (ret) {
+               /* Staying active: undo the GMP STOP_REQ from v3d_idle_axi(). */
+               V3D_WRITE(V3D_GMP_CFG(v3d->ver),
+                         V3D_READ(V3D_GMP_CFG(v3d->ver)) & ~V3D_GMP_CFG_STOP_REQ);
                v3d_irq_enable(v3d);
                return ret;
        }