[Why] Enable users to determine the use and sequencing of these services. Not all uses of pinning need to be followed by building of sg_table [How] Rename and refactor the implementaions of gpuvm_pin_get_sgtable() and gpuvm_unpin_put_sgtable() apis in gpuvm.c Signed-off-by: Ramesh Errabolu <Ramesh.Errabolu@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 12 ++++++---- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 23 ++++--------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h index 8013470d7c8d..92860b16c14b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h @@ -249,11 +249,13 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *process_info, int amdgpu_amdkfd_gpuvm_get_vm_fault_info(struct kgd_dev *kgd, struct kfd_vm_fault_info *info); -int amdgpu_amdkfd_gpuvm_pin_get_sg_table(struct kgd_dev *kgd, - struct kgd_mem *mem, uint64_t offset, - uint64_t size, struct sg_table **ret_sg); -void amdgpu_amdkfd_gpuvm_unpin_put_sg_table( - struct kgd_mem *mem, struct sg_table *sg); +int amdgpu_amdkfd_gpuvm_pin_bo(struct kgd_mem *mem); +void amdgpu_amdkfd_gpuvm_unpin_bo(struct kgd_mem *mem); + +int amdgpu_amdkfd_gpuvm_get_sg_table(struct kgd_dev *kgd, struct kgd_mem *mem, + uint64_t offset, uint64_t size, struct sg_table **ret_sg); +void amdgpu_amdkfd_gpuvm_put_sg_table(struct sg_table *sg); + int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, struct dma_buf *dmabuf, struct kfd_ipc_obj *ipc_obj, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 702cad576728..0d1984357451 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1726,7 +1726,7 @@ int amdgpu_amdkfd_gpuvm_get_vm_fault_info(struct kgd_dev *kgd, return 0; } -static int pin_bo_wo_map(struct kgd_mem *mem) +int amdgpu_amdkfd_gpuvm_pin_bo(struct kgd_mem *mem) { struct amdgpu_bo *bo = mem->bo; int ret = 0; @@ -1742,7 +1742,7 @@ static int pin_bo_wo_map(struct kgd_mem *mem) return ret; } -static void unpin_bo_wo_map(struct kgd_mem *mem) +void amdgpu_amdkfd_gpuvm_unpin_bo(struct kgd_mem *mem) { struct amdgpu_bo *bo = mem->bo; int ret = 0; @@ -1852,33 +1852,20 @@ static int get_sg_table(struct amdgpu_device *adev, return ret; } -int amdgpu_amdkfd_gpuvm_pin_get_sg_table(struct kgd_dev *kgd, +int amdgpu_amdkfd_gpuvm_get_sg_table(struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t offset, uint64_t size, struct sg_table **ret_sg) { - int ret; struct amdgpu_device *adev; - ret = pin_bo_wo_map(mem); - if (unlikely(ret)) - return ret; - adev = get_amdgpu_device(kgd); - - ret = get_sg_table(adev, mem, offset, size, ret_sg); - if (ret) - unpin_bo_wo_map(mem); - - return ret; + return get_sg_table(adev, mem, offset, size, ret_sg); } -void amdgpu_amdkfd_gpuvm_unpin_put_sg_table( - struct kgd_mem *mem, struct sg_table *sg) +void amdgpu_amdkfd_gpuvm_put_sg_table(struct sg_table *sg) { sg_free_table(sg); kfree(sg); - - unpin_bo_wo_map(mem); } int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, -- 2.29.2 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx