drm/amdgpu: try again kiq access if not in IRQ(v4)
authorMonk Liu <Monk.Liu@amd.com>
Mon, 25 Dec 2017 07:59:30 +0000 (15:59 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 1 Mar 2018 17:04:17 +0000 (12:04 -0500)
commita22144a58f784265fe8140724a7390443f63ef53
tree394a81a535d1bff9cbe7fb3baab5cd1994d06762
parentc41d1cf62d3615294c1dee291b05ee3220a4de6c
drm/amdgpu: try again kiq access if not in IRQ(v4)

sometimes GPU is switched to other VFs and won't swich
back soon, so the kiq reg access will not signal within
a short period, instead of busy waiting a long time(MAX_KEQ_REG_WAIT)
and returning TMO we can istead sleep 5ms and try again
later (non irq context)

And since the waiting in kiq_r/weg is busy wait, so MAX_KIQ_REG_WAIT
shouldn't set to a long time, set it to 10ms is more appropriate.

if gpu already in reset state, don't retry the KIQ reg access
otherwise it would always hang because KIQ was already die usually.

v2:
replace schedule() with msleep() for the wait

v3:
use while loop for the wait repeating
use macros for the sleep period
more description for it

v4:
drop unused variable

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com
Reviewed-by: Pixel Ding <Pixel.Ding@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c