aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2017-01-25 02:48:01 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-03-29 23:52:46 -0400
commit147b5983bb9b942af1f1d8d9e05d93f97cca312c (patch)
tree12c0d32e7187e3de058a9d799421b988f476cd0e
parented17c71b3a89d5ef4d8c8053a29a78fa709bb458 (diff)
drm/amdgpu:add lock_reset for SRIOV
this lock is used for sriov_gpu_reset, only get this mutex can run into sriov_gpu_reset. we have couple source triggers gpu_reset for SRIOV: 1) submit timedout and trigger reset voluntarily 2) invalid instruction detected by ENGINE and trigger reset voluntarily 2) hypervisor found world switch hang and trigger flr and notify guest to do reset. all need take care and we need a mutex to protect the consistency of reset routine. Signed-off-by: Monk Liu <Monk.Liu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h1
3 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 66cdd89982c9..94547bd3bfce 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2351,6 +2351,7 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, bool voluntary)
2351 struct amdgpu_ring *ring; 2351 struct amdgpu_ring *ring;
2352 struct dma_fence *fence = NULL, *next = NULL; 2352 struct dma_fence *fence = NULL, *next = NULL;
2353 2353
2354 mutex_lock(&adev->virt.lock_reset);
2354 atomic_inc(&adev->gpu_reset_counter); 2355 atomic_inc(&adev->gpu_reset_counter);
2355 2356
2356 /* block TTM */ 2357 /* block TTM */
@@ -2436,6 +2437,7 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, bool voluntary)
2436 dev_info(adev->dev, "GPU reset failed\n"); 2437 dev_info(adev->dev, "GPU reset failed\n");
2437 } 2438 }
2438 2439
2440 mutex_unlock(&adev->virt.lock_reset);
2439 return r; 2441 return r;
2440} 2442}
2441 2443
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 1fc48e1690ff..2feb9aa3b1f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -98,6 +98,7 @@ void amdgpu_virt_init_setting(struct amdgpu_device *adev)
98 adev->enable_virtual_display = true; 98 adev->enable_virtual_display = true;
99 99
100 mutex_init(&adev->virt.lock_kiq); 100 mutex_init(&adev->virt.lock_kiq);
101 mutex_init(&adev->virt.lock_reset);
101} 102}
102 103
103uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg) 104uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index 7020ff22b9b5..4b05568bff00 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
@@ -47,6 +47,7 @@ struct amdgpu_virt {
47 bool chained_ib_support; 47 bool chained_ib_support;
48 uint32_t reg_val_offs; 48 uint32_t reg_val_offs;
49 struct mutex lock_kiq; 49 struct mutex lock_kiq;
50 struct mutex lock_reset;
50 struct amdgpu_irq_src ack_irq; 51 struct amdgpu_irq_src ack_irq;
51 struct amdgpu_irq_src rcv_irq; 52 struct amdgpu_irq_src rcv_irq;
52 struct delayed_work flr_work; 53 struct delayed_work flr_work;