aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f6c1d6f0bf37..592be6438a6c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -75,39 +75,50 @@ static unsigned amdgpu_vm_directory_size(struct amdgpu_device *adev)
75} 75}
76 76
77/** 77/**
78 * amdgpu_vm_get_bos - add the vm BOs to a validation list 78 * amdgpu_vm_get_pd_bo - add the VM PD to a validation list
79 * 79 *
80 * @vm: vm providing the BOs 80 * @vm: vm providing the BOs
81 * @validated: head of validation list 81 * @validated: head of validation list
82 * @entry: entry to add
83 *
84 * Add the page directory to the list of BOs to
85 * validate for command submission.
86 */
87void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
88 struct list_head *validated,
89 struct amdgpu_bo_list_entry *entry)
90{
91 entry->robj = vm->page_directory;
92 entry->prefered_domains = AMDGPU_GEM_DOMAIN_VRAM;
93 entry->allowed_domains = AMDGPU_GEM_DOMAIN_VRAM;
94 entry->priority = 0;
95 entry->tv.bo = &vm->page_directory->tbo;
96 entry->tv.shared = true;
97 list_add(&entry->tv.head, validated);
98}
99
100/**
101 * amdgpu_vm_get_bos - add the vm BOs to a validation list
102 *
103 * @vm: vm providing the BOs
82 * @duplicates: head of duplicates list 104 * @duplicates: head of duplicates list
83 * 105 *
84 * Add the page directory to the list of BOs to 106 * Add the page directory to the list of BOs to
85 * validate for command submission (cayman+). 107 * validate for command submission (cayman+).
86 */ 108 */
87struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev, 109struct amdgpu_bo_list_entry *amdgpu_vm_get_pt_bos(struct amdgpu_vm *vm,
88 struct amdgpu_vm *vm, 110 struct list_head *duplicates)
89 struct list_head *validated,
90 struct list_head *duplicates)
91{ 111{
92 struct amdgpu_bo_list_entry *list; 112 struct amdgpu_bo_list_entry *list;
93 unsigned i, idx; 113 unsigned i, idx;
94 114
95 list = drm_malloc_ab(vm->max_pde_used + 2, 115 list = drm_malloc_ab(vm->max_pde_used + 1,
96 sizeof(struct amdgpu_bo_list_entry)); 116 sizeof(struct amdgpu_bo_list_entry));
97 if (!list) { 117 if (!list)
98 return NULL; 118 return NULL;
99 }
100 119
101 /* add the vm page table to the list */ 120 /* add the vm page table to the list */
102 list[0].robj = vm->page_directory; 121 for (i = 0, idx = 0; i <= vm->max_pde_used; i++) {
103 list[0].prefered_domains = AMDGPU_GEM_DOMAIN_VRAM;
104 list[0].allowed_domains = AMDGPU_GEM_DOMAIN_VRAM;
105 list[0].priority = 0;
106 list[0].tv.bo = &vm->page_directory->tbo;
107 list[0].tv.shared = true;
108 list_add(&list[0].tv.head, validated);
109
110 for (i = 0, idx = 1; i <= vm->max_pde_used; i++) {
111 if (!vm->page_tables[i].bo) 122 if (!vm->page_tables[i].bo)
112 continue; 123 continue;
113 124