From 147b5983bb9b942af1f1d8d9e05d93f97cca312c Mon Sep 17 00:00:00 2001 From: Monk Liu Date: Wed, 25 Jan 2017 15:48:01 +0800 Subject: 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 Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c') 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) struct amdgpu_ring *ring; struct dma_fence *fence = NULL, *next = NULL; + mutex_lock(&adev->virt.lock_reset); atomic_inc(&adev->gpu_reset_counter); /* block TTM */ @@ -2436,6 +2437,7 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, bool voluntary) dev_info(adev->dev, "GPU reset failed\n"); } + mutex_unlock(&adev->virt.lock_reset); return r; } -- cgit