We need to disallow gfxoff if we touch GC MMIO registers.
At the moment we use MES for TLB flushes so no intended
functional change. This just protects the MMIO access if
the MES is not available.

Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
index bee269a8877a5..f7aae39f2d1b9 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
@@ -256,6 +256,10 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device 
*adev, uint32_t vmid,
        /* This path is needed before KIQ/MES/GFXOFF are set up */
        hub_ip = (vmhub == AMDGPU_GFXHUB(0)) ? GC_HWIP : MMHUB_HWIP;
 
+       /* disabllow gfxoff when we invalidate */
+       if (hub_ip == GC_HWIP)
+               amdgpu_gfx_off_ctrl(adev, false);
+
        spin_lock(&adev->gmc.invalidate_lock);
        /*
         * It may lose gpuvm invalidate acknowldege state across power-gating
@@ -309,6 +313,9 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device 
*adev, uint32_t vmid,
 
        spin_unlock(&adev->gmc.invalidate_lock);
 
+       if (hub_ip == GC_HWIP)
+               amdgpu_gfx_off_ctrl(adev, true);
+
        if (i >= adev->usec_timeout)
                dev_err(adev->dev, "Timeout waiting for VM flush ACK!\n");
 }
-- 
2.55.0

Reply via email to