diff options
author | Christian König <christian.koenig@amd.com> | 2018-08-30 04:31:52 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-09-10 23:40:09 -0400 |
commit | c460f8a6f5918c2a8a2354a60b03a71310b943aa (patch) | |
tree | b562a196f7d295612dff53b883dd373fb68be0f5 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 9a412063f0940d23a5ef393c2607ca9ae9f8f0b7 (diff) |
drm/amdgpu: move size calculations to the front of the file again
amdgpu_vm_bo_* functions should come much later.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@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 | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index d59222fb5931..a9275a99d793 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -134,51 +134,6 @@ struct amdgpu_prt_cb { | |||
134 | }; | 134 | }; |
135 | 135 | ||
136 | /** | 136 | /** |
137 | * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm | ||
138 | * | ||
139 | * @base: base structure for tracking BO usage in a VM | ||
140 | * @vm: vm to which bo is to be added | ||
141 | * @bo: amdgpu buffer object | ||
142 | * | ||
143 | * Initialize a bo_va_base structure and add it to the appropriate lists | ||
144 | * | ||
145 | */ | ||
146 | static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base, | ||
147 | struct amdgpu_vm *vm, | ||
148 | struct amdgpu_bo *bo) | ||
149 | { | ||
150 | base->vm = vm; | ||
151 | base->bo = bo; | ||
152 | INIT_LIST_HEAD(&base->bo_list); | ||
153 | INIT_LIST_HEAD(&base->vm_status); | ||
154 | |||
155 | if (!bo) | ||
156 | return; | ||
157 | list_add_tail(&base->bo_list, &bo->va); | ||
158 | |||
159 | if (bo->tbo.resv != vm->root.base.bo->tbo.resv) | ||
160 | return; | ||
161 | |||
162 | vm->bulk_moveable = false; | ||
163 | if (bo->tbo.type == ttm_bo_type_kernel) | ||
164 | list_move(&base->vm_status, &vm->relocated); | ||
165 | else | ||
166 | list_move(&base->vm_status, &vm->idle); | ||
167 | |||
168 | if (bo->preferred_domains & | ||
169 | amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type)) | ||
170 | return; | ||
171 | |||
172 | /* | ||
173 | * we checked all the prerequisites, but it looks like this per vm bo | ||
174 | * is currently evicted. add the bo to the evicted list to make sure it | ||
175 | * is validated on next vm use to avoid fault. | ||
176 | * */ | ||
177 | list_move_tail(&base->vm_status, &vm->evicted); | ||
178 | base->moved = true; | ||
179 | } | ||
180 | |||
181 | /** | ||
182 | * amdgpu_vm_level_shift - return the addr shift for each level | 137 | * amdgpu_vm_level_shift - return the addr shift for each level |
183 | * | 138 | * |
184 | * @adev: amdgpu_device pointer | 139 | * @adev: amdgpu_device pointer |
@@ -250,6 +205,51 @@ static unsigned amdgpu_vm_bo_size(struct amdgpu_device *adev, unsigned level) | |||
250 | } | 205 | } |
251 | 206 | ||
252 | /** | 207 | /** |
208 | * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm | ||
209 | * | ||
210 | * @base: base structure for tracking BO usage in a VM | ||
211 | * @vm: vm to which bo is to be added | ||
212 | * @bo: amdgpu buffer object | ||
213 | * | ||
214 | * Initialize a bo_va_base structure and add it to the appropriate lists | ||
215 | * | ||
216 | */ | ||
217 | static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base, | ||
218 | struct amdgpu_vm *vm, | ||
219 | struct amdgpu_bo *bo) | ||
220 | { | ||
221 | base->vm = vm; | ||
222 | base->bo = bo; | ||
223 | INIT_LIST_HEAD(&base->bo_list); | ||
224 | INIT_LIST_HEAD(&base->vm_status); | ||
225 | |||
226 | if (!bo) | ||
227 | return; | ||
228 | list_add_tail(&base->bo_list, &bo->va); | ||
229 | |||
230 | if (bo->tbo.resv != vm->root.base.bo->tbo.resv) | ||
231 | return; | ||
232 | |||
233 | vm->bulk_moveable = false; | ||
234 | if (bo->tbo.type == ttm_bo_type_kernel) | ||
235 | list_move(&base->vm_status, &vm->relocated); | ||
236 | else | ||
237 | list_move(&base->vm_status, &vm->idle); | ||
238 | |||
239 | if (bo->preferred_domains & | ||
240 | amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type)) | ||
241 | return; | ||
242 | |||
243 | /* | ||
244 | * we checked all the prerequisites, but it looks like this per vm bo | ||
245 | * is currently evicted. add the bo to the evicted list to make sure it | ||
246 | * is validated on next vm use to avoid fault. | ||
247 | * */ | ||
248 | list_move_tail(&base->vm_status, &vm->evicted); | ||
249 | base->moved = true; | ||
250 | } | ||
251 | |||
252 | /** | ||
253 | * amdgpu_vm_get_pd_bo - add the VM PD to a validation list | 253 | * amdgpu_vm_get_pd_bo - add the VM PD to a validation list |
254 | * | 254 | * |
255 | * @vm: vm providing the BOs | 255 | * @vm: vm providing the BOs |