aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2019-01-21 17:22:55 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-02-05 21:15:46 -0500
commit41cca166cc57e75e94d888595a428d23a3bf4e36 (patch)
treef9c01b66358ac82def807ca7074c501bccd718e9 /drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
parent67dd1a36334ffce82bebeb2d633e152aa436d370 (diff)
drm/amdgpu: add a workaround for GDS ordered append hangs with compute queues
I'm not increasing the DRM version because GDS isn't totally without bugs yet. v2: update emit_ib_size Signed-off-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index a26747681ed6..b8e50a34bdb3 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -6084,6 +6084,22 @@ static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
6084 unsigned vmid = AMDGPU_JOB_GET_VMID(job); 6084 unsigned vmid = AMDGPU_JOB_GET_VMID(job);
6085 u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24); 6085 u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
6086 6086
6087 /* Currently, there is a high possibility to get wave ID mismatch
6088 * between ME and GDS, leading to a hw deadlock, because ME generates
6089 * different wave IDs than the GDS expects. This situation happens
6090 * randomly when at least 5 compute pipes use GDS ordered append.
6091 * The wave IDs generated by ME are also wrong after suspend/resume.
6092 * Those are probably bugs somewhere else in the kernel driver.
6093 *
6094 * Writing GDS_COMPUTE_MAX_WAVE_ID resets wave ID counters in ME and
6095 * GDS to 0 for this ring (me/pipe).
6096 */
6097 if (ib->flags & AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID) {
6098 amdgpu_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1));
6099 amdgpu_ring_write(ring, mmGDS_COMPUTE_MAX_WAVE_ID - PACKET3_SET_CONFIG_REG_START);
6100 amdgpu_ring_write(ring, ring->adev->gds.gds_compute_max_wave_id);
6101 }
6102
6087 amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); 6103 amdgpu_ring_write(ring, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
6088 amdgpu_ring_write(ring, 6104 amdgpu_ring_write(ring,
6089#ifdef __BIG_ENDIAN 6105#ifdef __BIG_ENDIAN
@@ -6890,7 +6906,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
6890 7 + /* gfx_v8_0_ring_emit_pipeline_sync */ 6906 7 + /* gfx_v8_0_ring_emit_pipeline_sync */
6891 VI_FLUSH_GPU_TLB_NUM_WREG * 5 + 7 + /* gfx_v8_0_ring_emit_vm_flush */ 6907 VI_FLUSH_GPU_TLB_NUM_WREG * 5 + 7 + /* gfx_v8_0_ring_emit_vm_flush */
6892 7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_compute x3 for user fence, vm fence */ 6908 7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_compute x3 for user fence, vm fence */
6893 .emit_ib_size = 4, /* gfx_v8_0_ring_emit_ib_compute */ 6909 .emit_ib_size = 7, /* gfx_v8_0_ring_emit_ib_compute */
6894 .emit_ib = gfx_v8_0_ring_emit_ib_compute, 6910 .emit_ib = gfx_v8_0_ring_emit_ib_compute,
6895 .emit_fence = gfx_v8_0_ring_emit_fence_compute, 6911 .emit_fence = gfx_v8_0_ring_emit_fence_compute,
6896 .emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync, 6912 .emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync,
@@ -6920,7 +6936,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_kiq = {
6920 7 + /* gfx_v8_0_ring_emit_pipeline_sync */ 6936 7 + /* gfx_v8_0_ring_emit_pipeline_sync */
6921 17 + /* gfx_v8_0_ring_emit_vm_flush */ 6937 17 + /* gfx_v8_0_ring_emit_vm_flush */
6922 7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_kiq x3 for user fence, vm fence */ 6938 7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_kiq x3 for user fence, vm fence */
6923 .emit_ib_size = 4, /* gfx_v8_0_ring_emit_ib_compute */ 6939 .emit_ib_size = 7, /* gfx_v8_0_ring_emit_ib_compute */
6924 .emit_fence = gfx_v8_0_ring_emit_fence_kiq, 6940 .emit_fence = gfx_v8_0_ring_emit_fence_kiq,
6925 .test_ring = gfx_v8_0_ring_test_ring, 6941 .test_ring = gfx_v8_0_ring_test_ring,
6926 .insert_nop = amdgpu_ring_insert_nop, 6942 .insert_nop = amdgpu_ring_insert_nop,
@@ -6996,6 +7012,7 @@ static void gfx_v8_0_set_gds_init(struct amdgpu_device *adev)
6996 adev->gds.mem.total_size = RREG32(mmGDS_VMID0_SIZE); 7012 adev->gds.mem.total_size = RREG32(mmGDS_VMID0_SIZE);
6997 adev->gds.gws.total_size = 64; 7013 adev->gds.gws.total_size = 64;
6998 adev->gds.oa.total_size = 16; 7014 adev->gds.oa.total_size = 16;
7015 adev->gds.gds_compute_max_wave_id = RREG32(mmGDS_COMPUTE_MAX_WAVE_ID);
6999 7016
7000 if (adev->gds.mem.total_size == 64 * 1024) { 7017 if (adev->gds.mem.total_size == 64 * 1024) {
7001 adev->gds.mem.gfx_partition_size = 4096; 7018 adev->gds.mem.gfx_partition_size = 4096;