aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2015-12-11 09:16:32 -0500
committerAlex Deucher <alexander.deucher@amd.com>2015-12-18 17:29:45 -0500
commit56467ebfb254836dc30eb45d4ac8a46a400bfad6 (patch)
tree19629224afdc3328ede08e60ea46f0666c2d5ffe /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
parent3c0eea6c35d932c4d25070868067dc9cd9ceab91 (diff)
drm/amdgpu: split VM PD and PT handling during CS
This way we avoid the extra allocation for the page directory entry. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 7fe7f8afa5ff..ea0fe94e4b54 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -448,6 +448,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
448{ 448{
449 struct ttm_validate_buffer tv, *entry; 449 struct ttm_validate_buffer tv, *entry;
450 struct amdgpu_bo_list_entry *vm_bos; 450 struct amdgpu_bo_list_entry *vm_bos;
451 struct amdgpu_bo_list_entry vm_pd;
451 struct ww_acquire_ctx ticket; 452 struct ww_acquire_ctx ticket;
452 struct list_head list, duplicates; 453 struct list_head list, duplicates;
453 unsigned domain; 454 unsigned domain;
@@ -460,14 +461,18 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
460 tv.shared = true; 461 tv.shared = true;
461 list_add(&tv.head, &list); 462 list_add(&tv.head, &list);
462 463
463 vm_bos = amdgpu_vm_get_bos(adev, bo_va->vm, &list, &duplicates); 464 amdgpu_vm_get_pd_bo(bo_va->vm, &list, &vm_pd);
464 if (!vm_bos)
465 return;
466 465
467 /* Provide duplicates to avoid -EALREADY */ 466 /* Provide duplicates to avoid -EALREADY */
468 r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates); 467 r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates);
469 if (r) 468 if (r)
470 goto error_free; 469 goto error_print;
470
471 vm_bos = amdgpu_vm_get_pt_bos(bo_va->vm, &duplicates);
472 if (!vm_bos) {
473 r = -ENOMEM;
474 goto error_unreserve;
475 }
471 476
472 list_for_each_entry(entry, &list, head) { 477 list_for_each_entry(entry, &list, head) {
473 domain = amdgpu_mem_type_to_domain(entry->bo->mem.mem_type); 478 domain = amdgpu_mem_type_to_domain(entry->bo->mem.mem_type);
@@ -489,10 +494,9 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
489 494
490error_unreserve: 495error_unreserve:
491 ttm_eu_backoff_reservation(&ticket, &list); 496 ttm_eu_backoff_reservation(&ticket, &list);
492
493error_free:
494 drm_free_large(vm_bos); 497 drm_free_large(vm_bos);
495 498
499error_print:
496 if (r && r != -ERESTARTSYS) 500 if (r && r != -ERESTARTSYS)
497 DRM_ERROR("Couldn't update BO_VA (%d)\n", r); 501 DRM_ERROR("Couldn't update BO_VA (%d)\n", r);
498} 502}