Skip to content

Commit 1e29303

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: clear PDs/PTs only after initializing them
Clear the VM PDs/PTs only after initializing all the structures. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 672e78c commit 1e29303

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -945,10 +945,6 @@ int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
945945
if (r)
946946
return r;
947947

948-
r = amdgpu_vm_clear_bo(adev, vm, pt, cursor.level, ats);
949-
if (r)
950-
goto error_free_pt;
951-
952948
if (vm->use_cpu_for_update) {
953949
r = amdgpu_bo_kmap(pt, NULL);
954950
if (r)
@@ -961,6 +957,10 @@ int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
961957
pt->parent = amdgpu_bo_ref(cursor.parent->base.bo);
962958

963959
amdgpu_vm_bo_base_init(&entry->base, vm, pt);
960+
961+
r = amdgpu_vm_clear_bo(adev, vm, pt, cursor.level, ats);
962+
if (r)
963+
goto error_free_pt;
964964
}
965965

966966
return 0;
@@ -3031,13 +3031,14 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
30313031
if (r)
30323032
goto error_unreserve;
30333033

3034+
amdgpu_vm_bo_base_init(&vm->root.base, vm, root);
3035+
30343036
r = amdgpu_vm_clear_bo(adev, vm, root,
30353037
adev->vm_manager.root_level,
30363038
vm->pte_support_ats);
30373039
if (r)
30383040
goto error_unreserve;
30393041

3040-
amdgpu_vm_bo_base_init(&vm->root.base, vm, root);
30413042
amdgpu_bo_unreserve(vm->root.base.bo);
30423043

30433044
if (pasid) {

0 commit comments

Comments
 (0)