aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-01-31 05:17:56 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-02-19 14:19:15 -0500
commit102374488dd608a9dd3fda962b9bb725848f8c3b (patch)
tree7d4a3121e083488bf2f2583556a2465495437a31 /drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
parent3a80e92b6eca179aab145ae997df0c424d8851ba (diff)
drm/amdgpu: make VMID owner none atomic v2
The variable is protected by the VMID mutex anyway. v2: grab the mutex while resetting the VMID as well Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
index fbe958f7cb5b..ac31740d1cd3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
@@ -267,7 +267,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,
267 267
268 flushed = id->flushed_updates; 268 flushed = id->flushed_updates;
269 if ((amdgpu_vmid_had_gpu_reset(adev, id)) || 269 if ((amdgpu_vmid_had_gpu_reset(adev, id)) ||
270 (atomic64_read(&id->owner) != vm->entity.fence_context) || 270 (id->owner != vm->entity.fence_context) ||
271 (job->vm_pd_addr != id->pd_gpu_addr) || 271 (job->vm_pd_addr != id->pd_gpu_addr) ||
272 (updates && (!flushed || updates->context != flushed->context || 272 (updates && (!flushed || updates->context != flushed->context ||
273 dma_fence_is_later(updates, flushed))) || 273 dma_fence_is_later(updates, flushed))) ||
@@ -296,7 +296,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,
296 id->flushed_updates = dma_fence_get(updates); 296 id->flushed_updates = dma_fence_get(updates);
297 } 297 }
298 id->pd_gpu_addr = job->vm_pd_addr; 298 id->pd_gpu_addr = job->vm_pd_addr;
299 atomic64_set(&id->owner, vm->entity.fence_context); 299 id->owner = vm->entity.fence_context;
300 job->vm_needs_flush = needs_flush; 300 job->vm_needs_flush = needs_flush;
301 if (needs_flush) { 301 if (needs_flush) {
302 dma_fence_put(id->last_flush); 302 dma_fence_put(id->last_flush);
@@ -353,7 +353,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
353 if (amdgpu_vmid_had_gpu_reset(adev, id)) 353 if (amdgpu_vmid_had_gpu_reset(adev, id))
354 continue; 354 continue;
355 355
356 if (atomic64_read(&id->owner) != vm->entity.fence_context) 356 if (id->owner != vm->entity.fence_context)
357 continue; 357 continue;
358 358
359 if (job->vm_pd_addr != id->pd_gpu_addr) 359 if (job->vm_pd_addr != id->pd_gpu_addr)
@@ -402,7 +402,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
402 id->pd_gpu_addr = job->vm_pd_addr; 402 id->pd_gpu_addr = job->vm_pd_addr;
403 dma_fence_put(id->flushed_updates); 403 dma_fence_put(id->flushed_updates);
404 id->flushed_updates = dma_fence_get(updates); 404 id->flushed_updates = dma_fence_get(updates);
405 atomic64_set(&id->owner, vm->entity.fence_context); 405 id->owner = vm->entity.fence_context;
406 406
407needs_flush: 407needs_flush:
408 job->vm_needs_flush = true; 408 job->vm_needs_flush = true;
@@ -482,13 +482,15 @@ void amdgpu_vmid_reset(struct amdgpu_device *adev, unsigned vmhub,
482 struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub]; 482 struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];
483 struct amdgpu_vmid *id = &id_mgr->ids[vmid]; 483 struct amdgpu_vmid *id = &id_mgr->ids[vmid];
484 484
485 atomic64_set(&id->owner, 0); 485 mutex_lock(&id_mgr->lock);
486 id->owner = 0;
486 id->gds_base = 0; 487 id->gds_base = 0;
487 id->gds_size = 0; 488 id->gds_size = 0;
488 id->gws_base = 0; 489 id->gws_base = 0;
489 id->gws_size = 0; 490 id->gws_size = 0;
490 id->oa_base = 0; 491 id->oa_base = 0;
491 id->oa_size = 0; 492 id->oa_size = 0;
493 mutex_unlock(&id_mgr->lock);
492} 494}
493 495
494/** 496/**