drm/amdkfd: Access gpuvm_export_dmabuf() api
Subsystems (3)
PATCH 1/1 drm/amdkfd: Access gpuvm_export_dmabuf() api
Call KFD api to get Dmabuf instead of calling GEM Prime API
Signed-off-by Ramesh Errabolu <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +4 -4
@@ -1852,13 +1852,13 @@ static uint32_t get_process_num_bos(struct kfd_process *p)return num_of_bos; } -static int criu_get_prime_handle (struct drm_gem_object *gobj,int flags, +static int criu_get_prime_handle (struct kgd_mem *mem,int flags,u32 *shared_fd) {struct dma_buf *dmabuf;int ret; - dmabuf =amdgpu_gem_prime_export (gobj, flags); + ret =amdgpu_amdkfd_gpuvm_export_dmabuf (mem, &dmabuf);if (IS_ERR (dmabuf)) { ret =PTR_ERR (dmabuf);pr_err ("dmabuf export failed for the BO\n" );
@@ -1940,7 +1940,7 @@ static int criu_checkpoint_bos(struct kfd_process *p, }if (bo_bucket->alloc_flags & (KFD_IOC_ALLOC_MEM_FLAGS_VRAM |KFD_IOC_ALLOC_MEM_FLAGS_GTT )) { - ret =criu_get_prime_handle (&dumper_bo->tbo.base, + ret =criu_get_prime_handle (kgd_mem, bo_bucket->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE ?DRM_RDWR :0 , &bo_bucket->dmabuf_fd);
@@ -2402,7 +2402,7 @@ static int criu_restore_bo(struct kfd_process *p,/* create the dmabuf object and export the bo */ if (bo_bucket->alloc_flags & (KFD_IOC_ALLOC_MEM_FLAGS_VRAM |KFD_IOC_ALLOC_MEM_FLAGS_GTT )) { - ret =criu_get_prime_handle (&kgd_mem->bo->tbo.base,DRM_RDWR , + ret =criu_get_prime_handle (kgd_mem,DRM_RDWR , &bo_bucket->dmabuf_fd);if (ret)return ret;
Signature · 1 line
2.25.1
Felix Kuehling
maintainerAm 2023-06-20 um 22:11 schrieb Ramesh Errabolu:
Quoted 15 lines
Call KFD api to get Dmabuf instead of calling GEM Prime API
Signed-off-by Ramesh Errabolu <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0@@ -1852,13 +1852,13 @@ static uint32_t get_process_num_bos(struct kfd_process *p)return num_of_bos; }
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static uint32_t get_process_num_bos(struct kfd_process *p) · line 1862
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-2-static int criu_get_prime_handle (struct drm_gem_object *gobj,int flags, +static int criu_get_prime_handle (struct kgd_mem *mem,int flags,u32 *shared_fd) {struct dma_buf *dmabuf;int ret; - dmabuf =amdgpu_gem_prime_export (gobj, flags); + ret =amdgpu_amdkfd_gpuvm_export_dmabuf (mem, &dmabuf);if (IS_ERR (dmabuf)) {
I think you need to check ret here instead of IS_ERR(dmabuf). Please also check with Rajneesh. I think he ran into this before and I discussed this fix with him.
Otherwise the patch looks reasonable to me.
Thanks,
Felix
Quoted 20 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-2ret =PTR_ERR (dmabuf);pr_err ("dmabuf export failed for the BO\n" );@@ -1940,7 +1940,7 @@ static int criu_checkpoint_bos(struct kfd_process *p, }if (bo_bucket->alloc_flags & (KFD_IOC_ALLOC_MEM_FLAGS_VRAM |KFD_IOC_ALLOC_MEM_FLAGS_GTT )) { - ret =criu_get_prime_handle (&dumper_bo->tbo.base, + ret =criu_get_prime_handle (kgd_mem, bo_bucket->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE ?DRM_RDWR :0 , &bo_bucket->dmabuf_fd);@@ -2402,7 +2402,7 @@ static int criu_restore_bo(struct kfd_process *p,/* create the dmabuf object and export the bo */ if (bo_bucket->alloc_flags & (KFD_IOC_ALLOC_MEM_FLAGS_VRAM |KFD_IOC_ALLOC_MEM_FLAGS_GTT )) { - ret =criu_get_prime_handle (&kgd_mem->bo->tbo.base,DRM_RDWR , + ret =criu_get_prime_handle (kgd_mem,DRM_RDWR , &bo_bucket->dmabuf_fd);if (ret)return ret;