]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/etnaviv: stop abusing mmu_context as FE running marker
authorLucas Stach <l.stach@pengutronix.de>
Fri, 20 Aug 2021 20:18:25 +0000 (22:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:39 +0000 (12:26 +0200)
commit 23e0f5a57d0ecec86e1fc82194acd94aede21a46 upstream.

While the DMA frontend can only be active when the MMU context is set, the
reverse isn't necessarily true, as the frontend can be stopped while the
MMU state is kept. Stop treating mmu_context being set as a indication that
the frontend is running and instead add a explicit property.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
drivers/gpu/drm/etnaviv/etnaviv_gpu.h

index fc90ea6973b2d1eb774d30cbc29b3d9599a6a5af..60410c2fd2be2318b7dd00e84ed7ce4299e3fdf7 100644 (file)
@@ -545,6 +545,8 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
        /* We rely on the GPU running, so program the clock */
        etnaviv_gpu_update_clock(gpu);
 
+       gpu->fe_running = false;
+
        return 0;
 }
 
@@ -607,6 +609,8 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch)
                          VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE |
                          VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch));
        }
+
+       gpu->fe_running = true;
 }
 
 static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu)
@@ -1306,7 +1310,7 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit)
                goto out_unlock;
        }
 
-       if (!gpu->mmu_context) {
+       if (!gpu->fe_running) {
                gpu->mmu_context = etnaviv_iommu_context_get(submit->mmu_context);
                etnaviv_gpu_start_fe_idleloop(gpu);
        } else {
@@ -1530,7 +1534,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms)
 
 static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
 {
-       if (gpu->initialized && gpu->mmu_context) {
+       if (gpu->initialized && gpu->fe_running) {
                /* Replace the last WAIT with END */
                mutex_lock(&gpu->lock);
                etnaviv_buffer_end(gpu);
@@ -1545,6 +1549,8 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
 
                etnaviv_iommu_context_put(gpu->mmu_context);
                gpu->mmu_context = NULL;
+
+               gpu->fe_running = false;
        }
 
        gpu->exec_state = -1;
index 8f9bd4edc96a539d2e5f3471d577f3447ab1e510..02478c75f8968fe9672f0f2597ca7a2eafb1d407 100644 (file)
@@ -101,6 +101,7 @@ struct etnaviv_gpu {
        struct workqueue_struct *wq;
        struct drm_gpu_scheduler sched;
        bool initialized;
+       bool fe_running;
 
        /* 'ring'-buffer: */
        struct etnaviv_cmdbuf buffer;