From: jsg Date: Mon, 9 Sep 2024 09:47:46 +0000 (+0000) Subject: drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f556b3f0f57c35df9d181b99eddecf955f164ab6;p=openbsd drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb From Yunxiang Li ddfe95f2e1fcefeb9ab70476753e1fd0a083f59b in linux-6.6.y/6.6.50 18f2525d31401e5142db95ff3a6ec0f4147be818 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_gart.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_gart.c index 00b8b491e08..822da9abe89 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_gart.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_gart.c @@ -34,6 +34,7 @@ #include #endif #include "amdgpu.h" +#include "amdgpu_reset.h" #include #include @@ -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); }