[PATCH 12/35] drm/amdgpu: export vm update mapping interface

Christian König ckoenig.leichtzumerken at gmail.com
Thu Jan 7 10:54:04 UTC 2021


Am 07.01.21 um 04:01 schrieb Felix Kuehling:
> From: Philip Yang <Philip.Yang at amd.com>
>
> It will be used by kfd to map svm range to GPU, because svm range does
> not have amdgpu_bo and bo_va, cannot use amdgpu_bo_update interface, use
> amdgpu vm update interface directly.
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 ++++++++---------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 10 ++++++++++
>   2 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index fdbe7d4e8b8b..9c557e8bf0e5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1589,15 +1589,14 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params,
>    * Returns:
>    * 0 for success, -EINVAL for failure.
>    */
> -static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
> -				       struct amdgpu_device *bo_adev,
> -				       struct amdgpu_vm *vm, bool immediate,
> -				       bool unlocked, struct dma_resv *resv,
> -				       uint64_t start, uint64_t last,
> -				       uint64_t flags, uint64_t offset,
> -				       struct drm_mm_node *nodes,
> -				       dma_addr_t *pages_addr,
> -				       struct dma_fence **fence)
> +int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
> +				struct amdgpu_device *bo_adev,
> +				struct amdgpu_vm *vm, bool immediate,
> +				bool unlocked, struct dma_resv *resv,
> +				uint64_t start, uint64_t last, uint64_t flags,
> +				uint64_t offset, struct drm_mm_node *nodes,
> +				dma_addr_t *pages_addr,
> +				struct dma_fence **fence)
>   {
>   	struct amdgpu_vm_update_params params;
>   	enum amdgpu_sync_mode sync_mode;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 2bf4ef5fb3e1..73ca630520fd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -366,6 +366,8 @@ struct amdgpu_vm_manager {
>   	spinlock_t				pasid_lock;
>   };
>   
> +struct amdgpu_bo_va_mapping;
> +
>   #define amdgpu_vm_copy_pte(adev, ib, pe, src, count) ((adev)->vm_manager.vm_pte_funcs->copy_pte((ib), (pe), (src), (count)))
>   #define amdgpu_vm_write_pte(adev, ib, pe, value, count, incr) ((adev)->vm_manager.vm_pte_funcs->write_pte((ib), (pe), (value), (count), (incr)))
>   #define amdgpu_vm_set_pte_pde(adev, ib, pe, addr, count, incr, flags) ((adev)->vm_manager.vm_pte_funcs->set_pte_pde((ib), (pe), (addr), (count), (incr), (flags)))
> @@ -397,6 +399,14 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
>   			  struct dma_fence **fence);
>   int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
>   			   struct amdgpu_vm *vm);
> +int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
> +				struct amdgpu_device *bo_adev,
> +				struct amdgpu_vm *vm, bool immediate,
> +				bool unlocked, struct dma_resv *resv,
> +				uint64_t start, uint64_t last, uint64_t flags,
> +				uint64_t offset, struct drm_mm_node *nodes,
> +				dma_addr_t *pages_addr,
> +				struct dma_fence **fence);
>   int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>   			struct amdgpu_bo_va *bo_va,
>   			bool clear);



More information about the amd-gfx mailing list