diff options
| author | Christian König <christian.koenig@amd.com> | 2022-04-19 12:21:45 +0200 | 
|---|---|---|
| committer | Christian König <christian.koenig@amd.com> | 2023-07-12 14:14:26 +0200 | 
| commit | 8abc1eb2987aee449e62c72a498374a43b409261 (patch) | |
| tree | 1c49cb06e7c6633f706c5d733f6572bfb93c1628 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
| parent | 9710631cc8f367da04879760b892a8fc7aac9f45 (diff) | |
drm/amdkfd: switch over to using drm_exec v3
Avoids quite a bit of logic and kmalloc overhead.
v2: fix multiple problems pointed out by Felix
v3: two more nit picks from Felix fixed
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230711133122.3710-4-christian.koenig@amd.com
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 143d11afe0e5..c5c5f2eb76c5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -34,6 +34,7 @@  #include <drm/amdgpu_drm.h>  #include <drm/drm_drv.h>  #include <drm/ttm/ttm_tt.h> +#include <drm/drm_exec.h>  #include "amdgpu.h"  #include "amdgpu_trace.h"  #include "amdgpu_amdkfd.h" @@ -361,6 +362,23 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,  }  /** + * amdgpu_vm_lock_pd - lock PD in drm_exec + * + * @vm: vm providing the BOs + * @exec: drm execution context + * @num_fences: number of extra fences to reserve + * + * Lock the VM root PD in the DRM execution context. + */ +int amdgpu_vm_lock_pd(struct amdgpu_vm *vm, struct drm_exec *exec, +		      unsigned int num_fences) +{ +	/* We need at least two fences for the VM PD/PT updates */ +	return drm_exec_prepare_obj(exec, &vm->root.bo->tbo.base, +				    2 + num_fences); +} + +/**   * amdgpu_vm_move_to_lru_tail - move all BOs to the end of LRU   *   * @adev: amdgpu device pointer | 
