drm/amdgpu/sdma5: fix wptr overwritten in ->get_wptr()
authorXiaojie Yuan <xiaojie.yuan@amd.com>
Tue, 14 Jul 2020 07:47:31 +0000 (15:47 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 14 Jul 2020 18:38:48 +0000 (14:38 -0400)
commit87d6883b327eef30b56e0a6bca9d5c9800ab6462
tree5ccfddbb52bce2d8954b2f0485c9421087d6e7bc
parent9987d70d10eea0d685d4bfbf2101eaad64d36c37
drm/amdgpu/sdma5: fix wptr overwritten in ->get_wptr()

"u64 *wptr" points to the the wptr value in write back buffer and
"*wptr = (*wptr) >> 2;" results in the value being overwritten each time
when ->get_wptr() is called.

umr uses /sys/kernel/debug/dri/0/amdgpu_ring_sdma0 to get rptr/wptr and
decode ring content and it is affected by this issue.

fix and simplify the logic similar as sdma_v4_0_ring_get_wptr().

v2: fix for sdma5.2 as well

Suggested-by: Le Ma <le.ma@amd.com>
Signed-off-by: Xiaojie Yuan <xiaojie.yuan@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/sdma_v5_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c