drm/etnaviv: exec and MMU state is lost when resetting the GPU
authorLucas Stach <l.stach@pengutronix.de>
Fri, 20 Aug 2021 20:18:27 +0000 (22:18 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Thu, 16 Sep 2021 08:35:24 +0000 (10:35 +0200)
When the GPU is reset both the current exec state, as well as all MMU
state is lost. Move the driver side state tracking into the reset function
to keep hardware and software state from diverging.

Cc: stable@vger.kernel.org # 5.4
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Michael Walle <michael@walle.cc>
Tested-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
drivers/gpu/drm/etnaviv/etnaviv_gpu.c

index 0757dcbe6913a719f82c5c46a02edfbdaee13fbd..3d64bc3cc6046a9f598020ca5e10a078771718cb 100644 (file)
@@ -570,6 +570,8 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
        etnaviv_gpu_update_clock(gpu);
 
        gpu->fe_running = false;
+       gpu->exec_state = -1;
+       gpu->mmu_context = NULL;
 
        return 0;
 }
@@ -836,7 +838,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
        /* Now program the hardware */
        mutex_lock(&gpu->lock);
        etnaviv_gpu_hw_init(gpu);
-       gpu->exec_state = -1;
        mutex_unlock(&gpu->lock);
 
        pm_runtime_mark_last_busy(gpu->dev);
@@ -1061,8 +1062,6 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
        spin_unlock(&gpu->event_spinlock);
 
        etnaviv_gpu_hw_init(gpu);
-       gpu->exec_state = -1;
-       gpu->mmu_context = NULL;
 
        mutex_unlock(&gpu->lock);
        pm_runtime_mark_last_busy(gpu->dev);