mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
drm/amdkfd: Import DMABufs for interop through DRM
Use drm_gem_prime_fd_to_handle to import DMABufs for interop. This ensures that a GEM handle is created on import and that obj->dma_buf will be set and remain set as long as the object is imported into KFD. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com> Reviewed-by: Xiaogang.Chen <Xiaogang.Chen@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
1819200166
commit
0188006d7c
@@ -1564,16 +1564,11 @@ static int kfd_ioctl_import_dmabuf(struct file *filep,
|
||||
{
|
||||
struct kfd_ioctl_import_dmabuf_args *args = data;
|
||||
struct kfd_process_device *pdd;
|
||||
struct dma_buf *dmabuf;
|
||||
int idr_handle;
|
||||
uint64_t size;
|
||||
void *mem;
|
||||
int r;
|
||||
|
||||
dmabuf = dma_buf_get(args->dmabuf_fd);
|
||||
if (IS_ERR(dmabuf))
|
||||
return PTR_ERR(dmabuf);
|
||||
|
||||
mutex_lock(&p->mutex);
|
||||
pdd = kfd_process_device_data_by_id(p, args->gpu_id);
|
||||
if (!pdd) {
|
||||
@@ -1587,10 +1582,10 @@ static int kfd_ioctl_import_dmabuf(struct file *filep,
|
||||
goto err_unlock;
|
||||
}
|
||||
|
||||
r = amdgpu_amdkfd_gpuvm_import_dmabuf(pdd->dev->adev, dmabuf,
|
||||
args->va_addr, pdd->drm_priv,
|
||||
(struct kgd_mem **)&mem, &size,
|
||||
NULL);
|
||||
r = amdgpu_amdkfd_gpuvm_import_dmabuf_fd(pdd->dev->adev, args->dmabuf_fd,
|
||||
args->va_addr, pdd->drm_priv,
|
||||
(struct kgd_mem **)&mem, &size,
|
||||
NULL);
|
||||
if (r)
|
||||
goto err_unlock;
|
||||
|
||||
@@ -1601,7 +1596,6 @@ static int kfd_ioctl_import_dmabuf(struct file *filep,
|
||||
}
|
||||
|
||||
mutex_unlock(&p->mutex);
|
||||
dma_buf_put(dmabuf);
|
||||
|
||||
args->handle = MAKE_HANDLE(args->gpu_id, idr_handle);
|
||||
|
||||
@@ -1612,7 +1606,6 @@ err_free:
|
||||
pdd->drm_priv, NULL);
|
||||
err_unlock:
|
||||
mutex_unlock(&p->mutex);
|
||||
dma_buf_put(dmabuf);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user