[PATCH 5/6] drm/amdgpu: Correct sdma_v4 get_wptr(v2)
Christian König
ckoenig.leichtzumerken at gmail.com
Tue Feb 27 10:27:24 UTC 2018
Am 27.02.2018 um 09:47 schrieb Monk Liu:
> From: Emily Deng <Emily.Deng at amd.com>
>
> the original method will change the wptr value in wb.
> v2:
> furthur cleanup
>
> Change-Id: I984fabca35d9dcf1f5fa8ef7779b2afb7f7d7370
> Signed-off-by: Emily Deng <Emily.Deng at amd.com>
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index 3d5385d..04e9cb0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -238,15 +238,14 @@ static uint64_t sdma_v4_0_ring_get_rptr(struct amdgpu_ring *ring)
> static uint64_t sdma_v4_0_ring_get_wptr(struct amdgpu_ring *ring)
> {
> struct amdgpu_device *adev = ring->adev;
> - u64 *wptr = NULL;
> + u64 wptr;
> uint64_t local_wptr = 0;
> + u64 tmp = 0;
As far as I can see local_wptr and tmp are now unused and can be dropped
as well.
With that fixed the patch is Reviewed-by: Christian König
<christian.koenig at amd.com>
Regards,
Christian.
>
> if (ring->use_doorbell) {
> /* XXX check if swapping is necessary on BE */
> - wptr = ((u64 *)&adev->wb.wb[ring->wptr_offs]);
> - DRM_DEBUG("wptr/doorbell before shift == 0x%016llx\n", *wptr);
> - *wptr = (*wptr) >> 2;
> - DRM_DEBUG("wptr/doorbell after shift == 0x%016llx\n", *wptr);
> + wptr = READ_ONCE(*((u64 *)&adev->wb.wb[ring->wptr_offs]));
> + DRM_DEBUG("wptr/doorbell before shift == 0x%016llx\n", wptr);
> } else {
> u32 lowbit, highbit;
> int me = (ring == &adev->sdma.instance[0].ring) ? 0 : 1;
> @@ -257,12 +256,12 @@ static uint64_t sdma_v4_0_ring_get_wptr(struct amdgpu_ring *ring)
>
> DRM_DEBUG("wptr [%i]high== 0x%08x low==0x%08x\n",
> me, highbit, lowbit);
> - *wptr = highbit;
> - *wptr = (*wptr) << 32;
> - *wptr |= lowbit;
> + wptr = highbit;
> + wptr = wptr << 32;
> + wptr |= lowbit;
> }
>
> - return *wptr;
> + return wptr >> 2;
> }
>
> /**
More information about the amd-gfx
mailing list