diff options
| author | Lang Yu <Lang.Yu@amd.com> | 2022-06-07 15:58:23 +0800 | 
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2022-07-05 16:09:55 -0400 | 
| commit | 4bdb9d6501763e83bacbf26846754c567773a1fb (patch) | |
| tree | 77fcec2153b7cdf4f50f52046282a64126ffa711 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
| parent | cfb979f71736361ec564d47d0a41f07e09983e32 (diff) | |
drm/amdkfd: simplify vm_validate_pt_pd_bos
We don't need to validate and map root PD specially here,
it would be validated and mapped by amdgpu_vm_validate_pt_bos
if it is evicted.
The special case is when turning a GFX VM to a compute VM,
if vm_update_mode changed, we should make sure root PD gets
mapped. So just map root PD after updating vm->update_funcs
in amdgpu_vm_make_compute whether the vm_update_mode changed
or not.
v3:
 - Add some comments suggested by Christian.
v2:
 - Don't rename vm_validate_pt_pd_bos and make it public.
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Acked-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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 8530befb2051..59cac347baa3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2168,6 +2168,14 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)  	} else {  		vm->update_funcs = &amdgpu_vm_sdma_funcs;  	} +	/* +	 * Make sure root PD gets mapped. As vm_update_mode could be changed +	 * when turning a GFX VM into a compute VM. +	 */ +	r = vm->update_funcs->map_table(to_amdgpu_bo_vm(vm->root.bo)); +	if (r) +		goto unreserve_bo; +  	dma_fence_put(vm->last_update);  	vm->last_update = NULL;  	vm->is_compute_context = true; | 
