[PATCH 1/7] drm/etnaviv: Don't set up a GPU on resume that is not initialized

From: Christian Gmeiner

Date: Fri Nov 20 2026 - 05:40:46 EST


From: Christian Gmeiner <cgmeiner@xxxxxxxxxx>

etnaviv_gpu_init(..) can fail, for example for a VG core with FE2.0,
which is ignored on purpose. The device stays bound and is runtime
suspended and resumed later.

etnaviv_gpu_rpm_suspend(..) sets the state to identified without
looking at the old state. So the next resume programs the clock and
runs etnaviv_gpu_hw_init(..) on a GPU that is not initialized. An
unbound GPU keeps the identified state as well, so the next bind sets
it up before it is reset.

Go back to the unknown state when etnaviv_gpu_init(..) fails and in
etnaviv_gpu_unbind(..), and keep it in etnaviv_gpu_rpm_suspend(..).

Seen on an i.MX6Q with its ignored GC355, and with its GC320 on every
bind after the first.

Fixes: 647d817d8071 ("drm/etnaviv: better track GPU state")
Cc: stable@xxxxxxxxxxxxxxx # 6.6+
Signed-off-by: Christian Gmeiner <cgmeiner@xxxxxxxxxx>
---
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 6a4aab75ebba..2a15ae6135f5 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -951,6 +951,8 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
return 0;

fail:
+ /* the GPU is not used, a resume must not set it up */
+ gpu->state = ETNA_GPU_STATE_UNKNOWN;
pm_runtime_mark_last_busy(gpu->dev);
pm_put:
pm_runtime_put_autosuspend(gpu->dev);
@@ -1874,6 +1876,9 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
etnaviv_gpu_clk_disable(gpu);
}

+ /* the GPU is not initialized any more, a resume must not set it up */
+ gpu->state = ETNA_GPU_STATE_UNKNOWN;
+
if (gpu->mmu_context)
etnaviv_iommu_context_put(gpu->mmu_context);

@@ -2019,7 +2024,8 @@ static int etnaviv_gpu_rpm_suspend(struct device *dev)

etnaviv_gpu_hw_suspend(gpu);

- gpu->state = ETNA_GPU_STATE_IDENTIFIED;
+ if (gpu->state != ETNA_GPU_STATE_UNKNOWN)
+ gpu->state = ETNA_GPU_STATE_IDENTIFIED;

return etnaviv_gpu_clk_disable(gpu);
}

--
2.56.0