summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2018-03-05 14:26:36 +0300
committerAlex Deucher <alexander.deucher@amd.com>2018-03-08 00:10:13 +0300
commitdccf1eff352a8803eea4a8785ed3eb7e962d196f (patch)
tree1fa231e52b00e2f07171a0535588a8bdd8b18f09 /drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
parent59dd47728625e6f8e77f888d00596c9fb7057540 (diff)
downloadlinux-dccf1eff352a8803eea4a8785ed3eb7e962d196f.tar.xz
drm/amdgpu: give warning before sleep in kiq_r/wreg
to catch error that may schedule in atomic context early on Signed-off-by: Monk Liu <Monk.Liu@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 42c140155b70..21adb1b6e5cb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -167,6 +167,9 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
if (r < 1 && (adev->in_gpu_reset || in_interrupt()))
goto failed_kiq_read;
+ if (in_interrupt())
+ might_sleep();
+
while (r < 1 && cnt++ < MAX_KIQ_REG_TRY) {
msleep(MAX_KIQ_REG_BAILOUT_INTERVAL);
r = amdgpu_fence_wait_polling(ring, seq, MAX_KIQ_REG_WAIT);
@@ -212,7 +215,11 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
if (r < 1 && (adev->in_gpu_reset || in_interrupt()))
goto failed_kiq_write;
+ if (in_interrupt())
+ might_sleep();
+
while (r < 1 && cnt++ < MAX_KIQ_REG_TRY) {
+
msleep(MAX_KIQ_REG_BAILOUT_INTERVAL);
r = amdgpu_fence_wait_polling(ring, seq, MAX_KIQ_REG_WAIT);
}