The function vc4_save_hang_state() reads V3D registers to capture the GPU state after a timeout, but it does so without holding a PM reference. Wrap the register reads with vc4_v3d_pm_get/put() to ensure the device is powered on while capturing hang state.
Signed-off-by: Maíra Canal <[email protected]> --- drivers/gpu/drm/vc4/vc4_gem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 1aa54c49b033ac0c85e49988d7fbe9cbaa37b000..856b30c6d8a70f4a3b515ff892ce9d7de7de02ab 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -207,6 +207,11 @@ vc4_save_hang_state(struct drm_device *dev) spin_unlock_irqrestore(&vc4->job_lock, irqflags); + if (vc4_v3d_pm_get(vc4)) { + vc4_free_hang_state(dev, kernel_state); + return; + } + state->ct0ca = V3D_READ(V3D_CTNCA(0)); state->ct0ea = V3D_READ(V3D_CTNEA(0)); @@ -233,6 +238,8 @@ vc4_save_hang_state(struct drm_device *dev) state->fdbgs = V3D_READ(V3D_FDBGS); state->errstat = V3D_READ(V3D_ERRSTAT); + vc4_v3d_pm_put(vc4); + /* We need to turn purgeable BOs into unpurgeable ones so that * userspace has a chance to dump the hang state before the kernel * decides to purge those BOs. -- 2.52.0
