diff options
author | Christian König <christian.koenig@amd.com> | 2023-09-04 17:58:45 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2023-09-26 23:55:09 +0300 |
commit | e2e3788850b9e250d6b3dee36e37ee5c73ae024c (patch) | |
tree | f0ec6ee1076dde413a0385af80316c0c531c09ef /drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | |
parent | 3983c9fd2d8b5aa254f5f467604d30f977bb1a04 (diff) | |
download | linux-e2e3788850b9e250d6b3dee36e37ee5c73ae024c.tar.xz |
drm/amdgpu: rework lock handling for flush_tlb v2
Instead of each implementation doing this more or less correctly
move taking the reset lock at a higher level.
v2: fix typo
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c index 13917908b04b..230f06ad5298 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c @@ -596,8 +596,17 @@ void amdgpu_gmc_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, !adev->mman.buffer_funcs_enabled || !adev->ib_pool_ready || amdgpu_in_reset(adev) || !ring->sched.ready) { + + /* + * A GPU reset should flush all TLBs anyway, so no need to do + * this while one is ongoing. + */ + if (!down_read_trylock(&adev->reset_domain->sem)) + return; + adev->gmc.gmc_funcs->flush_gpu_tlb(adev, vmid, vmhub, flush_type); + up_read(&adev->reset_domain->sem); return; } |