A fully GPU reset is the only way to disable the MMUv2 and the
driver depends on the MMU being disabled after a reset to be able
to properly restart the GPU. Validate this assumption by checking
that the reset actually did disable the MMU.

Signed-off-by: Lucas Stach <[email protected]>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 34fff36af450..577fc8131976 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -601,6 +601,23 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
                        continue;
                }
 
+               /* try resetting again if MMUv2 is not disabled */
+               if (gpu->identity.minor_features1 & 
chipMinorFeatures1_MMU_VERSION) {
+                       if (gpu->sec_mode == ETNA_SEC_KERNEL) {
+                               if (gpu_read(gpu, VIVS_MMUv2_SEC_CONTROL) &
+                                   VIVS_MMUv2_SEC_CONTROL_ENABLE) {
+                                       dev_dbg(gpu->dev, "MMU is not 
disabled\n");
+                                       continue;
+                               }
+                       } else {
+                               if (gpu_read(gpu, VIVS_MMUv2_CONTROL) &
+                                   VIVS_MMUv2_CONTROL_ENABLE) {
+                                       dev_dbg(gpu->dev, "MMU is not 
disabled\n");
+                                       continue;
+                               }
+                       }
+               }
+
                /* enable debug register access */
                control &= ~VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS;
                gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, control);
-- 
2.47.3

Reply via email to