drm/amdgpu: give warning before sleep in kiq_r/wreg
authorMonk Liu <Monk.Liu@amd.com>
Mon, 5 Mar 2018 11:26:36 +0000 (19:26 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 7 Mar 2018 21:10:13 +0000 (16:10 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

index 42c140155b701f4446db43d37ae12727c073cfae..21adb1b6e5cb73f593dd3e5d5b84c7eac8811632 100644 (file)
@@ -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);
        }