Merge tag 'amd-drm-next-5.14-2021-06-02' of https://gitlab.freedesktop.org/agd5f...
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_vm.c
index 1923f03..8d218c5 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/dma-buf.h>
 
 #include <drm/amdgpu_drm.h>
+#include <drm/drm_drv.h>
 #include "amdgpu.h"
 #include "amdgpu_trace.h"
 #include "amdgpu_amdkfd.h"
@@ -1673,7 +1674,10 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
        struct amdgpu_vm_update_params params;
        struct amdgpu_res_cursor cursor;
        enum amdgpu_sync_mode sync_mode;
-       int r;
+       int r, idx;
+
+       if (!drm_dev_enter(&adev->ddev, &idx))
+               return -ENODEV;
 
        memset(&params, 0, sizeof(params));
        params.adev = adev;
@@ -1768,6 +1772,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 
 error_unlock:
        amdgpu_vm_eviction_unlock(vm);
+       drm_dev_exit(idx);
        return r;
 }