]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb
authorYunxiang Li <Yunxiang.Li@amd.com>
Fri, 24 May 2024 21:11:30 +0000 (17:11 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 20:15:59 +0000 (16:15 -0400)
We need to take the reset domain lock before flush hdp. We can't put the
lock inside amdgpu_device_flush_hdp itself because it is used during
reset where we already take the write side lock.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c

index eb172388d99eec115bec2910203ab3b1603ed2c1..256b95232de5419d91cfb60d6db1cc3f80795a8b 100644 (file)
@@ -34,6 +34,7 @@
 #include <asm/set_memory.h>
 #endif
 #include "amdgpu.h"
+#include "amdgpu_reset.h"
 #include <drm/drm_drv.h>
 #include <drm/ttm/ttm_tt.h>
 
@@ -405,7 +406,10 @@ void amdgpu_gart_invalidate_tlb(struct amdgpu_device *adev)
                return;
 
        mb();
-       amdgpu_device_flush_hdp(adev, NULL);
+       if (down_read_trylock(&adev->reset_domain->sem)) {
+               amdgpu_device_flush_hdp(adev, NULL);
+               up_read(&adev->reset_domain->sem);
+       }
        for_each_set_bit(i, adev->vmhubs_mask, AMDGPU_MAX_VMHUBS)
                amdgpu_gmc_flush_gpu_tlb(adev, 0, i, 0);
 }