aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2014-01-09 16:23:37 -0500
committerAlex Deucher <alexander.deucher@amd.com>2014-01-20 12:05:13 -0500
commitca113f6baeb314a66463c35565b4f7955c484000 (patch)
tree90567fdfdf24481fd499aaba6ba630a9f5caac0c
parent780f5dddaeb8e5950d8ecf2e7565a35bf5d5be36 (diff)
drm/radeon: consolidate sdma hdp flushing code for CIK
It's used in several places so move to a common shared function. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/cik_sdma.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
index af520d4d362b..d7e51c06d597 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -157,6 +157,27 @@ void cik_sdma_ring_ib_execute(struct radeon_device *rdev,
157} 157}
158 158
159/** 159/**
160 * cik_sdma_hdp_flush_ring_emit - emit an hdp flush on the DMA ring
161 *
162 * @rdev: radeon_device pointer
163 * @ridx: radeon ring index
164 *
165 * Emit an hdp flush packet on the requested DMA ring.
166 */
167static void cik_sdma_hdp_flush_ring_emit(struct radeon_device *rdev,
168 int ridx)
169{
170 struct radeon_ring *ring = &rdev->ring[ridx];
171
172 /* We should be using the new POLL_REG_MEM special op packet here
173 * but it causes sDMA to hang sometimes
174 */
175 radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000));
176 radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2);
177 radeon_ring_write(ring, 0);
178}
179
180/**
160 * cik_sdma_fence_ring_emit - emit a fence on the DMA ring 181 * cik_sdma_fence_ring_emit - emit a fence on the DMA ring
161 * 182 *
162 * @rdev: radeon_device pointer 183 * @rdev: radeon_device pointer
@@ -180,12 +201,7 @@ void cik_sdma_fence_ring_emit(struct radeon_device *rdev,
180 /* generate an interrupt */ 201 /* generate an interrupt */
181 radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_TRAP, 0, 0)); 202 radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_TRAP, 0, 0));
182 /* flush HDP */ 203 /* flush HDP */
183 /* We should be using the new POLL_REG_MEM special op packet here 204 cik_sdma_hdp_flush_ring_emit(rdev, fence->ring);
184 * but it causes sDMA to hang sometimes
185 */
186 radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000));
187 radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2);
188 radeon_ring_write(ring, 0);
189} 205}
190 206
191/** 207/**
@@ -816,12 +832,7 @@ void cik_dma_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm
816 radeon_ring_write(ring, VMID(0)); 832 radeon_ring_write(ring, VMID(0));
817 833
818 /* flush HDP */ 834 /* flush HDP */
819 /* We should be using the new POLL_REG_MEM special op packet here 835 cik_sdma_hdp_flush_ring_emit(rdev, ridx);
820 * but it causes sDMA to hang sometimes
821 */
822 radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000));
823 radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2);
824 radeon_ring_write(ring, 0);
825 836
826 /* flush TLB */ 837 /* flush TLB */
827 radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000)); 838 radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000));