freedreno/drm: fix 64b iova shifts
authorRob Clark <robdclark@chromium.org>
Thu, 29 Aug 2019 18:35:17 +0000 (11:35 -0700)
committerRob Clark <robdclark@chromium.org>
Tue, 3 Sep 2019 21:10:57 +0000 (14:10 -0700)
Should shift before splitting 64b iova into dwords

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/freedreno/drm/msm_ringbuffer_sp.c

index af71277072c730e29b29af687bbad74915ecbf8f..ec375a19938bb77e5b42dd3f95925281a0596ff6 100644 (file)
@@ -421,25 +421,19 @@ msm_ringbuffer_sp_emit_reloc(struct fd_ringbuffer *ring,
        }
 
        uint64_t iova = fd_bo_get_iova(reloc->bo) + reloc->offset;
-       uint32_t dword = iova;
        int shift = reloc->shift;
 
        if (shift < 0)
-               dword >>= -shift;
+               iova >>= -shift;
        else
-               dword <<= shift;
+               iova <<= shift;
+
+       uint32_t dword = iova;
 
        (*ring->cur++) = dword | reloc->or;
 
        if (pipe->gpu_id >= 500) {
                dword = iova >> 32;
-               shift -= 32;
-
-               if (shift < 0)
-                       dword >>= -shift;
-               else
-                       dword <<= shift;
-
                (*ring->cur++) = dword | reloc->orhi;
        }
 }