forked from Minki/linux
drm/radeon: Writeback endian fixes
The writeback ring pointer and IH ring pointer are read using le32_to_cpu so we do not want the chip to byteswap them on big-endian. We still want to byteswap the ring itself and the IBs, so we don't touch that but we remove setting of the byteswap bits in CP_RB_RPTR_ADDR and IH_CNTL. In general, for things like that where we control all the accessors easily, we are better off doing the swap in SW rather than HW. Paradoxally, it does keep the code closer to x86 and avoid using poorly tested HW features. I also changed the use of RADEON_ to R600_ in a couple of cases to be more consistent with the surrounding code. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Michel Dänzer <michel@daenzer.net> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
a0533fbf87
commit
df07d6999e
@ -1382,9 +1382,6 @@ int evergreen_cp_resume(struct radeon_device *rdev)
|
|||||||
|
|
||||||
/* set the wb address wether it's enabled or not */
|
/* set the wb address wether it's enabled or not */
|
||||||
WREG32(CP_RB_RPTR_ADDR,
|
WREG32(CP_RB_RPTR_ADDR,
|
||||||
#ifdef __BIG_ENDIAN
|
|
||||||
RB_RPTR_SWAP(2) |
|
|
||||||
#endif
|
|
||||||
((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC));
|
((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC));
|
||||||
WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF);
|
WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF);
|
||||||
WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF);
|
WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF);
|
||||||
|
@ -2213,9 +2213,6 @@ int r600_cp_resume(struct radeon_device *rdev)
|
|||||||
|
|
||||||
/* set the wb address whether it's enabled or not */
|
/* set the wb address whether it's enabled or not */
|
||||||
WREG32(CP_RB_RPTR_ADDR,
|
WREG32(CP_RB_RPTR_ADDR,
|
||||||
#ifdef __BIG_ENDIAN
|
|
||||||
RB_RPTR_SWAP(2) |
|
|
||||||
#endif
|
|
||||||
((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC));
|
((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC));
|
||||||
WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF);
|
WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF);
|
||||||
WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF);
|
WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF);
|
||||||
@ -2995,10 +2992,6 @@ int r600_irq_init(struct radeon_device *rdev)
|
|||||||
/* RPTR_REARM only works if msi's are enabled */
|
/* RPTR_REARM only works if msi's are enabled */
|
||||||
if (rdev->msi_enabled)
|
if (rdev->msi_enabled)
|
||||||
ih_cntl |= RPTR_REARM;
|
ih_cntl |= RPTR_REARM;
|
||||||
|
|
||||||
#ifdef __BIG_ENDIAN
|
|
||||||
ih_cntl |= IH_MC_SWAP(IH_MC_SWAP_32BIT);
|
|
||||||
#endif
|
|
||||||
WREG32(IH_CNTL, ih_cntl);
|
WREG32(IH_CNTL, ih_cntl);
|
||||||
|
|
||||||
/* force the active interrupt state to all disabled */
|
/* force the active interrupt state to all disabled */
|
||||||
|
@ -1802,8 +1802,8 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev,
|
|||||||
/* Set ring buffer size */
|
/* Set ring buffer size */
|
||||||
#ifdef __BIG_ENDIAN
|
#ifdef __BIG_ENDIAN
|
||||||
RADEON_WRITE(R600_CP_RB_CNTL,
|
RADEON_WRITE(R600_CP_RB_CNTL,
|
||||||
RADEON_BUF_SWAP_32BIT |
|
R600_BUF_SWAP_32BIT |
|
||||||
RADEON_RB_NO_UPDATE |
|
R600_RB_NO_UPDATE |
|
||||||
(dev_priv->ring.rptr_update_l2qw << 8) |
|
(dev_priv->ring.rptr_update_l2qw << 8) |
|
||||||
dev_priv->ring.size_l2qw);
|
dev_priv->ring.size_l2qw);
|
||||||
#else
|
#else
|
||||||
@ -1820,15 +1820,15 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev,
|
|||||||
|
|
||||||
#ifdef __BIG_ENDIAN
|
#ifdef __BIG_ENDIAN
|
||||||
RADEON_WRITE(R600_CP_RB_CNTL,
|
RADEON_WRITE(R600_CP_RB_CNTL,
|
||||||
RADEON_BUF_SWAP_32BIT |
|
R600_BUF_SWAP_32BIT |
|
||||||
RADEON_RB_NO_UPDATE |
|
R600_RB_NO_UPDATE |
|
||||||
RADEON_RB_RPTR_WR_ENA |
|
R600_RB_RPTR_WR_ENA |
|
||||||
(dev_priv->ring.rptr_update_l2qw << 8) |
|
(dev_priv->ring.rptr_update_l2qw << 8) |
|
||||||
dev_priv->ring.size_l2qw);
|
dev_priv->ring.size_l2qw);
|
||||||
#else
|
#else
|
||||||
RADEON_WRITE(R600_CP_RB_CNTL,
|
RADEON_WRITE(R600_CP_RB_CNTL,
|
||||||
RADEON_RB_NO_UPDATE |
|
R600_RB_NO_UPDATE |
|
||||||
RADEON_RB_RPTR_WR_ENA |
|
R600_RB_RPTR_WR_ENA |
|
||||||
(dev_priv->ring.rptr_update_l2qw << 8) |
|
(dev_priv->ring.rptr_update_l2qw << 8) |
|
||||||
dev_priv->ring.size_l2qw);
|
dev_priv->ring.size_l2qw);
|
||||||
#endif
|
#endif
|
||||||
@ -1851,13 +1851,8 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev,
|
|||||||
- ((unsigned long) dev->sg->virtual)
|
- ((unsigned long) dev->sg->virtual)
|
||||||
+ dev_priv->gart_vm_start;
|
+ dev_priv->gart_vm_start;
|
||||||
}
|
}
|
||||||
RADEON_WRITE(R600_CP_RB_RPTR_ADDR,
|
RADEON_WRITE(R600_CP_RB_RPTR_ADDR, (rptr_addr & 0xfffffffc));
|
||||||
#ifdef __BIG_ENDIAN
|
RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI, upper_32_bits(rptr_addr));
|
||||||
(2 << 0) |
|
|
||||||
#endif
|
|
||||||
(rptr_addr & 0xfffffffc));
|
|
||||||
RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI,
|
|
||||||
upper_32_bits(rptr_addr));
|
|
||||||
|
|
||||||
#ifdef __BIG_ENDIAN
|
#ifdef __BIG_ENDIAN
|
||||||
RADEON_WRITE(R600_CP_RB_CNTL,
|
RADEON_WRITE(R600_CP_RB_CNTL,
|
||||||
|
Loading…
Reference in New Issue
Block a user