diff options
author | Christian König <christian.koenig@amd.com> | 2023-09-01 15:20:39 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2023-09-26 16:55:09 -0400 |
commit | 0c525aa406490a779541025df83890fc54e78094 (patch) | |
tree | 698337ad0ba8fd6bd1a51b6f872541c659cddd3a /drivers/gpu/drm | |
parent | fb4c52db69746ee0429cedee562ce861f5392e73 (diff) | |
download | linux-stable-0c525aa406490a779541025df83890fc54e78094.tar.gz linux-stable-0c525aa406490a779541025df83890fc54e78094.tar.bz2 linux-stable-0c525aa406490a779541025df83890fc54e78094.zip |
drm/amdgpu: fix and cleanup gmc_v8_0_flush_gpu_tlb_pasid
Testing for reset is pointless since the reset can start right after the
test. Grab the reset semaphore instead.
The same PASID can be used by more than once VMID, build a mask of VMIDs
to invalidate instead of just restting the first one.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 5af235202513..eed37d826f0c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -31,6 +31,7 @@ #include "amdgpu_ucode.h" #include "amdgpu_amdkfd.h" #include "amdgpu_gem.h" +#include "amdgpu_reset.h" #include "gmc/gmc_8_1_d.h" #include "gmc/gmc_8_1_sh_mask.h" @@ -616,25 +617,24 @@ static int gmc_v8_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid, uint32_t flush_type, bool all_hub, uint32_t inst) { + u32 mask = 0x0; int vmid; - unsigned int tmp; - if (amdgpu_in_reset(adev)) - return -EIO; + if (!down_read_trylock(&adev->reset_domain->sem)) + return 0; for (vmid = 1; vmid < 16; vmid++) { + u32 tmp = RREG32(mmATC_VMID0_PASID_MAPPING + vmid); - tmp = RREG32(mmATC_VMID0_PASID_MAPPING + vmid); if ((tmp & ATC_VMID0_PASID_MAPPING__VALID_MASK) && - (tmp & ATC_VMID0_PASID_MAPPING__PASID_MASK) == pasid) { - WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid); - RREG32(mmVM_INVALIDATE_RESPONSE); - break; - } + (tmp & ATC_VMID0_PASID_MAPPING__PASID_MASK) == pasid) + mask |= 1 << vmid; } + WREG32(mmVM_INVALIDATE_REQUEST, mask); + RREG32(mmVM_INVALIDATE_RESPONSE); + up_read(&adev->reset_domain->sem); return 0; - } /* |