drm/amdgpu/sdma3: set wptr shadow atomically
authorXiangliang.Yu <Xiangliang.Yu@amd.com>
Wed, 13 Sep 2017 02:58:19 +0000 (10:58 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 19:14:02 +0000 (15:14 -0400)
Port it from sdma4 for wptr polling usage.

Signed-off-by: Xiangliang.Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c

index b7d69ab9a94a30f000af9cdfb3f7bdf732db32b0..728c0d8e849b847570950396909b864647182487 100644 (file)
@@ -379,8 +379,10 @@ static void sdma_v3_0_ring_set_wptr(struct amdgpu_ring *ring)
        struct amdgpu_device *adev = ring->adev;
 
        if (ring->use_doorbell) {
+               u32 *wb = (u32 *)&adev->wb.wb[ring->wptr_offs];
+
                /* XXX check if swapping is necessary on BE */
-               adev->wb.wb[ring->wptr_offs] = lower_32_bits(ring->wptr) << 2;
+               WRITE_ONCE(*wb, (lower_32_bits(ring->wptr) << 2));
                WDOORBELL32(ring->doorbell_index, lower_32_bits(ring->wptr) << 2);
        } else {
                int me = (ring == &ring->adev->sdma.instance[0].ring) ? 0 : 1;