aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2015-12-11 08:39:05 -0500
committerAlex Deucher <alexander.deucher@amd.com>2015-12-18 17:29:45 -0500
commit3c0eea6c35d932c4d25070868067dc9cd9ceab91 (patch)
treeab641062a62fe4177378b74a3e3fec4374fd73c6
parent5b0112356cf9a735632b26ff5f3450e1716c8598 (diff)
drm/amdgpu: put VM page tables directly into duplicates list
They share the reservation object with the page directory anyway. 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>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c12
4 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index c3996e0e2e7e..dc3dab539e4c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -982,7 +982,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
982void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); 982void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
983struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev, 983struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
984 struct amdgpu_vm *vm, 984 struct amdgpu_vm *vm,
985 struct list_head *head); 985 struct list_head *validated,
986 struct list_head *duplicates);
986int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, 987int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
987 struct amdgpu_sync *sync); 988 struct amdgpu_sync *sync);
988void amdgpu_vm_flush(struct amdgpu_ring *ring, 989void amdgpu_vm_flush(struct amdgpu_ring *ring,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 1d44d508d4d4..9591c13781bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -386,13 +386,13 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p)
386 amdgpu_cs_buckets_get_list(&buckets, &p->validated); 386 amdgpu_cs_buckets_get_list(&buckets, &p->validated);
387 } 387 }
388 388
389 INIT_LIST_HEAD(&duplicates);
389 p->vm_bos = amdgpu_vm_get_bos(p->adev, &fpriv->vm, 390 p->vm_bos = amdgpu_vm_get_bos(p->adev, &fpriv->vm,
390 &p->validated); 391 &p->validated, &duplicates);
391 392
392 if (need_mmap_lock) 393 if (need_mmap_lock)
393 down_read(&current->mm->mmap_sem); 394 down_read(&current->mm->mmap_sem);
394 395
395 INIT_LIST_HEAD(&duplicates);
396 r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, &duplicates); 396 r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, &duplicates);
397 if (unlikely(r != 0)) 397 if (unlikely(r != 0))
398 goto error_reserve; 398 goto error_reserve;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index fc32fc01a64b..7fe7f8afa5ff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -460,7 +460,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
460 tv.shared = true; 460 tv.shared = true;
461 list_add(&tv.head, &list); 461 list_add(&tv.head, &list);
462 462
463 vm_bos = amdgpu_vm_get_bos(adev, bo_va->vm, &list); 463 vm_bos = amdgpu_vm_get_bos(adev, bo_va->vm, &list, &duplicates);
464 if (!vm_bos) 464 if (!vm_bos)
465 return; 465 return;
466 466
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index fce4c6d952c8..f6c1d6f0bf37 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -78,14 +78,16 @@ static unsigned amdgpu_vm_directory_size(struct amdgpu_device *adev)
78 * amdgpu_vm_get_bos - add the vm BOs to a validation list 78 * amdgpu_vm_get_bos - add the vm BOs to a validation list
79 * 79 *
80 * @vm: vm providing the BOs 80 * @vm: vm providing the BOs
81 * @head: head of validation list 81 * @validated: head of validation list
82 * @duplicates: head of duplicates list
82 * 83 *
83 * Add the page directory to the list of BOs to 84 * Add the page directory to the list of BOs to
84 * validate for command submission (cayman+). 85 * validate for command submission (cayman+).
85 */ 86 */
86struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev, 87struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
87 struct amdgpu_vm *vm, 88 struct amdgpu_vm *vm,
88 struct list_head *head) 89 struct list_head *validated,
90 struct list_head *duplicates)
89{ 91{
90 struct amdgpu_bo_list_entry *list; 92 struct amdgpu_bo_list_entry *list;
91 unsigned i, idx; 93 unsigned i, idx;
@@ -103,7 +105,7 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
103 list[0].priority = 0; 105 list[0].priority = 0;
104 list[0].tv.bo = &vm->page_directory->tbo; 106 list[0].tv.bo = &vm->page_directory->tbo;
105 list[0].tv.shared = true; 107 list[0].tv.shared = true;
106 list_add(&list[0].tv.head, head); 108 list_add(&list[0].tv.head, validated);
107 109
108 for (i = 0, idx = 1; i <= vm->max_pde_used; i++) { 110 for (i = 0, idx = 1; i <= vm->max_pde_used; i++) {
109 if (!vm->page_tables[i].bo) 111 if (!vm->page_tables[i].bo)
@@ -115,7 +117,7 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
115 list[idx].priority = 0; 117 list[idx].priority = 0;
116 list[idx].tv.bo = &list[idx].robj->tbo; 118 list[idx].tv.bo = &list[idx].robj->tbo;
117 list[idx].tv.shared = true; 119 list[idx].tv.shared = true;
118 list_add(&list[idx++].tv.head, head); 120 list_add(&list[idx++].tv.head, duplicates);
119 } 121 }
120 122
121 return list; 123 return list;