diff options
author | Christian König <christian.koenig@amd.com> | 2017-03-30 10:56:20 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-04-28 17:32:19 -0400 |
commit | 87c910d806295df26069d0325f517ed72ce29d32 (patch) | |
tree | a52f4dcac5b8db5f386e0c2045713e869b7ba122 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 4789c463cb04d725170406873caaec5208c99eb9 (diff) |
drm/amdgpu: allow concurrent VM flushes
Enable concurrent VM flushes for Vega10.
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Andres Rodriguez <andresx7@gmail.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 | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b38a8d7714c7..4e6c1e4072ca 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -462,10 +462,11 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
462 | } | 462 | } |
463 | kfree(fences); | 463 | kfree(fences); |
464 | 464 | ||
465 | job->vm_needs_flush = true; | 465 | job->vm_needs_flush = false; |
466 | /* Check if we can use a VMID already assigned to this VM */ | 466 | /* Check if we can use a VMID already assigned to this VM */ |
467 | list_for_each_entry_reverse(id, &id_mgr->ids_lru, list) { | 467 | list_for_each_entry_reverse(id, &id_mgr->ids_lru, list) { |
468 | struct dma_fence *flushed; | 468 | struct dma_fence *flushed; |
469 | bool needs_flush = false; | ||
469 | 470 | ||
470 | /* Check all the prerequisites to using this VMID */ | 471 | /* Check all the prerequisites to using this VMID */ |
471 | if (amdgpu_vm_had_gpu_reset(adev, id)) | 472 | if (amdgpu_vm_had_gpu_reset(adev, id)) |
@@ -477,16 +478,17 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
477 | if (job->vm_pd_addr != id->pd_gpu_addr) | 478 | if (job->vm_pd_addr != id->pd_gpu_addr) |
478 | continue; | 479 | continue; |
479 | 480 | ||
480 | if (!id->last_flush) | 481 | if (!id->last_flush || |
481 | continue; | 482 | (id->last_flush->context != fence_context && |
482 | 483 | !dma_fence_is_signaled(id->last_flush))) | |
483 | if (id->last_flush->context != fence_context && | 484 | needs_flush = true; |
484 | !dma_fence_is_signaled(id->last_flush)) | ||
485 | continue; | ||
486 | 485 | ||
487 | flushed = id->flushed_updates; | 486 | flushed = id->flushed_updates; |
488 | if (updates && | 487 | if (updates && (!flushed || dma_fence_is_later(updates, flushed))) |
489 | (!flushed || dma_fence_is_later(updates, flushed))) | 488 | needs_flush = true; |
489 | |||
490 | /* Concurrent flushes are only possible starting with Vega10 */ | ||
491 | if (adev->asic_type < CHIP_VEGA10 && needs_flush) | ||
490 | continue; | 492 | continue; |
491 | 493 | ||
492 | /* Good we can use this VMID. Remember this submission as | 494 | /* Good we can use this VMID. Remember this submission as |
@@ -496,14 +498,15 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
496 | if (r) | 498 | if (r) |
497 | goto error; | 499 | goto error; |
498 | 500 | ||
499 | list_move_tail(&id->list, &id_mgr->ids_lru); | 501 | if (updates && (!flushed || dma_fence_is_later(updates, flushed))) { |
500 | 502 | dma_fence_put(id->flushed_updates); | |
501 | job->vm_id = id - id_mgr->ids; | 503 | id->flushed_updates = dma_fence_get(updates); |
502 | job->vm_needs_flush = false; | 504 | } |
503 | trace_amdgpu_vm_grab_id(vm, ring->idx, job); | ||
504 | 505 | ||
505 | mutex_unlock(&id_mgr->lock); | 506 | if (needs_flush) |
506 | return 0; | 507 | goto needs_flush; |
508 | else | ||
509 | goto no_flush_needed; | ||
507 | 510 | ||
508 | }; | 511 | }; |
509 | 512 | ||
@@ -515,17 +518,20 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
515 | if (r) | 518 | if (r) |
516 | goto error; | 519 | goto error; |
517 | 520 | ||
518 | dma_fence_put(id->last_flush); | 521 | id->pd_gpu_addr = job->vm_pd_addr; |
519 | id->last_flush = NULL; | ||
520 | |||
521 | dma_fence_put(id->flushed_updates); | 522 | dma_fence_put(id->flushed_updates); |
522 | id->flushed_updates = dma_fence_get(updates); | 523 | id->flushed_updates = dma_fence_get(updates); |
523 | |||
524 | id->pd_gpu_addr = job->vm_pd_addr; | ||
525 | id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter); | 524 | id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter); |
526 | list_move_tail(&id->list, &id_mgr->ids_lru); | ||
527 | atomic64_set(&id->owner, vm->client_id); | 525 | atomic64_set(&id->owner, vm->client_id); |
528 | 526 | ||
527 | needs_flush: | ||
528 | job->vm_needs_flush = true; | ||
529 | dma_fence_put(id->last_flush); | ||
530 | id->last_flush = NULL; | ||
531 | |||
532 | no_flush_needed: | ||
533 | list_move_tail(&id->list, &id_mgr->ids_lru); | ||
534 | |||
529 | job->vm_id = id - id_mgr->ids; | 535 | job->vm_id = id - id_mgr->ids; |
530 | trace_amdgpu_vm_grab_id(vm, ring->idx, job); | 536 | trace_amdgpu_vm_grab_id(vm, ring->idx, job); |
531 | 537 | ||