Skip to content

drm/v3d: Idle AXI transactions before disabling the clock on suspend#7503

Open
mairacanal wants to merge 2 commits into
raspberrypi:rpi-6.18.yfrom
mairacanal:v3d/fix-race-pm
Open

drm/v3d: Idle AXI transactions before disabling the clock on suspend#7503
mairacanal wants to merge 2 commits into
raspberrypi:rpi-6.18.yfrom
mairacanal:v3d/fix-race-pm

Conversation

@mairacanal

Copy link
Copy Markdown
Contributor

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 cores (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

Closes #7488

@nbuchwitz

Copy link
Copy Markdown
Contributor

Thanks, Maíra. I will pick the patches for our tree and will test it.

@mairacanal mairacanal marked this pull request as draft July 15, 2026 21:36
v3d_idle_axi() drains the GPU's memory interface for a safe powerdown by
using the V3D_GMP_CFG register. It reached both registers with V3D_CORE_READ
and V3D_CORE_WRITE.

On V3D 7.x the GMP is no longer a per-core block; it lives in the hub
register region. Reaching it through the per-core window there addresses
the wrong region.

Select the hub accessors (V3D_{READ,WRITE}) for the GMP on V3D 7.x and
keep the per-core path for earlier generations.

Cc: stable@vger.kernel.org
Fixes: 0ad5bc1 ("drm/v3d: fix up register addresses for V3D 7.x")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
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 cores
(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.

Cc: stable@vger.kernel.org
Link: raspberrypi#7443
Link: raspberrypi#7488
Fixes: 17af1d14deaf ("drm/v3d: Introduce Runtime Power Management")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
@mairacanal mairacanal marked this pull request as ready for review July 15, 2026 22:18
@mairacanal

Copy link
Copy Markdown
Contributor Author

I updated the PR to add proper GMP register access on V3D 7.1 (RPi 5). Now, the solution is validated in both Pi's without issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

X11 crashes on Pi 4 with Trixie and a viewer connected to RealVNC server

2 participants