diff options
author | Christian König <christian.koenig@amd.com> | 2017-04-03 07:59:25 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-04-04 23:34:03 -0400 |
commit | 641e94008970ef7dba764a3c672ec8bd40b9a533 (patch) | |
tree | a4069eacffcfaefdc6e146403ea990358ef48e28 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 6332ab906aa21ebeec710f3c14025b7af425d0f2 (diff) |
drm/amdgpu: coding style of amdgpu_vm_is_gpu_reset
The name is a bit confusing and the extra "? true : false" is superflous.
Additional to that remove setting the reset counter directly after checking it.
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b465166ba38f..5bedba30b434 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -375,11 +375,19 @@ int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, | |||
375 | return amdgpu_vm_alloc_levels(adev, vm, &vm->root, saddr, eaddr, 0); | 375 | return amdgpu_vm_alloc_levels(adev, vm, &vm->root, saddr, eaddr, 0); |
376 | } | 376 | } |
377 | 377 | ||
378 | static bool amdgpu_vm_is_gpu_reset(struct amdgpu_device *adev, | 378 | /** |
379 | struct amdgpu_vm_id *id) | 379 | * amdgpu_vm_had_gpu_reset - check if reset occured since last use |
380 | * | ||
381 | * @adev: amdgpu_device pointer | ||
382 | * @id: VMID structure | ||
383 | * | ||
384 | * Check if GPU reset occured since last use of the VMID. | ||
385 | */ | ||
386 | static bool amdgpu_vm_had_gpu_reset(struct amdgpu_device *adev, | ||
387 | struct amdgpu_vm_id *id) | ||
380 | { | 388 | { |
381 | return id->current_gpu_reset_count != | 389 | return id->current_gpu_reset_count != |
382 | atomic_read(&adev->gpu_reset_counter) ? true : false; | 390 | atomic_read(&adev->gpu_reset_counter); |
383 | } | 391 | } |
384 | 392 | ||
385 | /** | 393 | /** |
@@ -465,7 +473,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
465 | /* Check all the prerequisites to using this VMID */ | 473 | /* Check all the prerequisites to using this VMID */ |
466 | if (!id) | 474 | if (!id) |
467 | continue; | 475 | continue; |
468 | if (amdgpu_vm_is_gpu_reset(adev, id)) | 476 | if (amdgpu_vm_had_gpu_reset(adev, id)) |
469 | continue; | 477 | continue; |
470 | 478 | ||
471 | if (atomic64_read(&id->owner) != vm->client_id) | 479 | if (atomic64_read(&id->owner) != vm->client_id) |
@@ -493,7 +501,6 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
493 | if (r) | 501 | if (r) |
494 | goto error; | 502 | goto error; |
495 | 503 | ||
496 | id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter); | ||
497 | list_move_tail(&id->list, &adev->vm_manager.ids_lru); | 504 | list_move_tail(&id->list, &adev->vm_manager.ids_lru); |
498 | vm->ids[ring->idx] = id; | 505 | vm->ids[ring->idx] = id; |
499 | 506 | ||
@@ -593,7 +600,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job) | |||
593 | int r; | 600 | int r; |
594 | 601 | ||
595 | if (job->vm_needs_flush || gds_switch_needed || | 602 | if (job->vm_needs_flush || gds_switch_needed || |
596 | amdgpu_vm_is_gpu_reset(adev, id) || | 603 | amdgpu_vm_had_gpu_reset(adev, id) || |
597 | amdgpu_vm_ring_has_compute_vm_bug(ring)) { | 604 | amdgpu_vm_ring_has_compute_vm_bug(ring)) { |
598 | unsigned patch_offset = 0; | 605 | unsigned patch_offset = 0; |
599 | 606 | ||
@@ -606,7 +613,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job) | |||
606 | amdgpu_ring_emit_pipeline_sync(ring); | 613 | amdgpu_ring_emit_pipeline_sync(ring); |
607 | 614 | ||
608 | if (ring->funcs->emit_vm_flush && (job->vm_needs_flush || | 615 | if (ring->funcs->emit_vm_flush && (job->vm_needs_flush || |
609 | amdgpu_vm_is_gpu_reset(adev, id))) { | 616 | amdgpu_vm_had_gpu_reset(adev, id))) { |
610 | struct dma_fence *fence; | 617 | struct dma_fence *fence; |
611 | u64 pd_addr = amdgpu_vm_adjust_mc_addr(adev, job->vm_pd_addr); | 618 | u64 pd_addr = amdgpu_vm_adjust_mc_addr(adev, job->vm_pd_addr); |
612 | 619 | ||