Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu:Improves robustness of SOC15_WAIT_ON_RREG

If register value is updating, reset timeout counter.
It improves robustness of SOC15_WAIT_ON_RREG.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

James Zhu and committed by
Alex Deucher
7ab3f021 9194fb22

+7 -2
+7 -2
drivers/gpu/drm/amd/amdgpu/soc15_common.h
··· 49 49 50 50 #define SOC15_WAIT_ON_RREG(ip, inst, reg, expected_value, mask, ret) \ 51 51 do { \ 52 + uint32_t old_ = 0; \ 52 53 uint32_t tmp_ = RREG32(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \ 53 54 uint32_t loop = adev->usec_timeout; \ 54 55 while ((tmp_ & (mask)) != (expected_value)) { \ 55 - udelay(2); \ 56 + if (old_ != tmp_) { \ 57 + loop = adev->usec_timeout; \ 58 + old_ = tmp_; \ 59 + } else \ 60 + udelay(1); \ 56 61 tmp_ = RREG32(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg); \ 57 62 loop--; \ 58 63 if (!loop) { \ 59 - DRM_ERROR("Register(%d) [%s] failed to reach value 0x%08x != 0x%08x\n", \ 64 + DRM_WARN("Register(%d) [%s] failed to reach value 0x%08x != 0x%08x\n", \ 60 65 inst, #reg, (unsigned)expected_value, (unsigned)(tmp_ & (mask))); \ 61 66 ret = -ETIMEDOUT; \ 62 67 break; \