diff options
author | Roger.He <Hongbo.He@amd.com> | 2017-05-05 01:27:10 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-05-24 17:40:31 -0400 |
commit | 738f64ccc237f80b7673a6cc43051916eb90dc27 (patch) | |
tree | 6eb7dc7516db9f9cdf7c463643b9ec9bcf091ac7 /drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | |
parent | 455a7bc27c2118c7e0531b7502dedc80ed2f9d40 (diff) |
drm/amdgpu: extend lock range for race condition when gpu reset
to cover below case:
1. A task gart bind/unbind but not add to adev->gtt_list yet
2. at this time gpu reset, gtt only recover those gtt in adev->gtt_list
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Roger.He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index 902e6015abca..a57abc1a25fb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | |||
@@ -224,8 +224,9 @@ void amdgpu_gart_table_vram_free(struct amdgpu_device *adev) | |||
224 | * | 224 | * |
225 | * Unbinds the requested pages from the gart page table and | 225 | * Unbinds the requested pages from the gart page table and |
226 | * replaces them with the dummy page (all asics). | 226 | * replaces them with the dummy page (all asics). |
227 | * Returns 0 for success, -EINVAL for failure. | ||
227 | */ | 228 | */ |
228 | void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, | 229 | int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, |
229 | int pages) | 230 | int pages) |
230 | { | 231 | { |
231 | unsigned t; | 232 | unsigned t; |
@@ -237,7 +238,7 @@ void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, | |||
237 | 238 | ||
238 | if (!adev->gart.ready) { | 239 | if (!adev->gart.ready) { |
239 | WARN(1, "trying to unbind memory from uninitialized GART !\n"); | 240 | WARN(1, "trying to unbind memory from uninitialized GART !\n"); |
240 | return; | 241 | return -EINVAL; |
241 | } | 242 | } |
242 | 243 | ||
243 | t = offset / AMDGPU_GPU_PAGE_SIZE; | 244 | t = offset / AMDGPU_GPU_PAGE_SIZE; |
@@ -258,6 +259,7 @@ void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, | |||
258 | } | 259 | } |
259 | mb(); | 260 | mb(); |
260 | amdgpu_gart_flush_gpu_tlb(adev, 0); | 261 | amdgpu_gart_flush_gpu_tlb(adev, 0); |
262 | return 0; | ||
261 | } | 263 | } |
262 | 264 | ||
263 | /** | 265 | /** |