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

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

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 9a8a7921ce982..4f287e9118893 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -265,6 +265,10 @@ static void gmc_v10_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
@@ -313,6 +317,9 @@ static void gmc_v10_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 hub: %d!\n",
                        vmhub);
-- 
2.55.0

Reply via email to