diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index f5a960079705..92c34e4290a8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -338,6 +338,24 @@ static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base, | |||
338 | } | 338 | } |
339 | 339 | ||
340 | /** | 340 | /** |
341 | * amdgpu_vm_pt_parent - get the parent page directory | ||
342 | * | ||
343 | * @pt: child page table | ||
344 | * | ||
345 | * Helper to get the parent entry for the child page table. NULL if we are at | ||
346 | * the root page directory. | ||
347 | */ | ||
348 | static struct amdgpu_vm_pt *amdgpu_vm_pt_parent(struct amdgpu_vm_pt *pt) | ||
349 | { | ||
350 | struct amdgpu_bo *parent = pt->base.bo->parent; | ||
351 | |||
352 | if (!parent) | ||
353 | return NULL; | ||
354 | |||
355 | return list_first_entry(&parent->va, struct amdgpu_vm_pt, base.bo_list); | ||
356 | } | ||
357 | |||
358 | /** | ||
341 | * amdgpu_vm_get_pd_bo - add the VM PD to a validation list | 359 | * amdgpu_vm_get_pd_bo - add the VM PD to a validation list |
342 | * | 360 | * |
343 | * @vm: vm providing the BOs | 361 | * @vm: vm providing the BOs |
@@ -1206,24 +1224,16 @@ restart: | |||
1206 | } | 1224 | } |
1207 | 1225 | ||
1208 | while (!list_empty(&vm->relocated)) { | 1226 | while (!list_empty(&vm->relocated)) { |
1209 | struct amdgpu_vm_bo_base *bo_base, *parent; | ||
1210 | struct amdgpu_vm_pt *pt, *entry; | 1227 | struct amdgpu_vm_pt *pt, *entry; |
1211 | struct amdgpu_bo *bo; | ||
1212 | 1228 | ||
1213 | bo_base = list_first_entry(&vm->relocated, | 1229 | entry = list_first_entry(&vm->relocated, struct amdgpu_vm_pt, |
1214 | struct amdgpu_vm_bo_base, | 1230 | base.vm_status); |
1215 | vm_status); | 1231 | amdgpu_vm_bo_idle(&entry->base); |
1216 | amdgpu_vm_bo_idle(bo_base); | ||
1217 | 1232 | ||
1218 | bo = bo_base->bo->parent; | 1233 | pt = amdgpu_vm_pt_parent(entry); |
1219 | if (!bo) | 1234 | if (!pt) |
1220 | continue; | 1235 | continue; |
1221 | 1236 | ||
1222 | parent = list_first_entry(&bo->va, struct amdgpu_vm_bo_base, | ||
1223 | bo_list); | ||
1224 | pt = container_of(parent, struct amdgpu_vm_pt, base); | ||
1225 | entry = container_of(bo_base, struct amdgpu_vm_pt, base); | ||
1226 | |||
1227 | amdgpu_vm_update_pde(¶ms, vm, pt, entry); | 1237 | amdgpu_vm_update_pde(¶ms, vm, pt, entry); |
1228 | 1238 | ||
1229 | if (!vm->use_cpu_for_update && | 1239 | if (!vm->use_cpu_for_update && |