summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>2020-10-27 15:26:52 -0400
committerAndrey Grodzovsky <andrey.grodzovsky@amd.com>2020-10-27 15:26:52 -0400
commit28b4f57e80710b67c2fc6f8c411be593968212ac (patch)
tree691ffd7d1021e34854c65ea299756936e36fcbd5
parente17ff4817094c6b111ebae89d4b89084c2e057fe (diff)
drm/amdgpu: Fix a bunch of sdma code crash post device unplugamd-staging-drm-next-device-unplug
We can't allocate and submit IBs post device unplug. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index c08b76f4042a..062c1ac9cd12 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -31,6 +31,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"
@@ -1597,7 +1598,10 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
{
struct amdgpu_vm_update_params params;
enum amdgpu_sync_mode sync_mode;
- int r;
+ int r, idx;
+
+ if (!drm_dev_enter(&adev->ddev, &idx))
+ return -ENOENT;
memset(&params, 0, sizeof(params));
params.adev = adev;
@@ -1640,6 +1644,8 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
error_unlock:
amdgpu_vm_eviction_unlock(vm);
+
+ drm_dev_exit(idx);
return r;
}