drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:47:46 +0000 (09:47 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:47:46 +0000 (09:47 +0000)
From Yunxiang Li
ddfe95f2e1fcefeb9ab70476753e1fd0a083f59b in linux-6.6.y/6.6.50
18f2525d31401e5142db95ff3a6ec0f4147be818 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_gart.c

index 00b8b49..822da9a 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>
 
@@ -404,7 +405,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);
 }