]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdkfd: Use drm_priv to pass VM from KFD to amdgpu
authorFelix Kuehling <Felix.Kuehling@amd.com>
Wed, 7 Apr 2021 22:19:58 +0000 (18:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Apr 2022 12:15:07 +0000 (14:15 +0200)
commit b40a6ab2cf9213923bf8e821ce7fa7f6a0a26990 upstream.

amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu needs the drm_priv to allow mmap
to access the BO through the corresponding file descriptor. The VM can
also be extracted from drm_priv, so drm_priv can replace the vm parameter
in the kfd2kgd interface.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Philip Yang <philip.yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[ This is a partial cherry-pick of the commit. ]
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

index f92597c292fe5352e35bc6e6fa09865cff6ca292..4488aad64643bbe1635e00e063b68415e8e39f5d 100644 (file)
@@ -1044,11 +1044,15 @@ int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
                                           struct dma_fence **ef)
 {
        struct amdgpu_device *adev = get_amdgpu_device(kgd);
-       struct drm_file *drm_priv = filp->private_data;
-       struct amdgpu_fpriv *drv_priv = drm_priv->driver_priv;
-       struct amdgpu_vm *avm = &drv_priv->vm;
+       struct amdgpu_fpriv *drv_priv;
+       struct amdgpu_vm *avm;
        int ret;
 
+       ret = amdgpu_file_to_fpriv(filp, &drv_priv);
+       if (ret)
+               return ret;
+       avm = &drv_priv->vm;
+
        /* Already a compute VM? */
        if (avm->process_info)
                return -EINVAL;