diff options
| author | Pelloux-prayer, Pierre-eric <Pierre-eric.Pelloux-prayer@amd.com> | 2019-10-23 12:02:45 +0000 | 
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2019-10-25 16:47:07 -0400 | 
| commit | ee8bcc2333cc9e24e260e590131fa21c003e41ba (patch) | |
| tree | 5fa6daaccc6c6bfaa739709fac1f11f3ad04e3cc | |
| parent | 4ff17a1df7d550257972a838220a8af4611c8f2c (diff) | |
drm/amdgpu: call amdgpu_vm_prt_fini before deleting the root PD
amdgpu_vm_prt_fini uses "vm->root.base.bo" so it must still be valid when
we call it.
Fixes: b65709a92156 ("drm/amdgpu: reserve the root PD while freeing PASIDs")
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 19 | 
1 files changed, 10 insertions, 9 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index be10e4b9a94d..397bf5677ff2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2971,6 +2971,16 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)  		vm->pasid = 0;  	} +	list_for_each_entry_safe(mapping, tmp, &vm->freed, list) { +		if (mapping->flags & AMDGPU_PTE_PRT && prt_fini_needed) { +			amdgpu_vm_prt_fini(adev, vm); +			prt_fini_needed = false; +		} + +		list_del(&mapping->list); +		amdgpu_vm_free_mapping(adev, vm, mapping, NULL); +	} +  	amdgpu_vm_free_pts(adev, vm, NULL);  	amdgpu_bo_unreserve(root);  	amdgpu_bo_unref(&root); @@ -2990,15 +3000,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)  		list_del(&mapping->list);  		kfree(mapping);  	} -	list_for_each_entry_safe(mapping, tmp, &vm->freed, list) { -		if (mapping->flags & AMDGPU_PTE_PRT && prt_fini_needed) { -			amdgpu_vm_prt_fini(adev, vm); -			prt_fini_needed = false; -		} - -		list_del(&mapping->list); -		amdgpu_vm_free_mapping(adev, vm, mapping, NULL); -	}  	dma_fence_put(vm->last_update);  	for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) | 
