aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong Zhao <yong.zhao@amd.com>2018-05-01 17:56:07 -0400
committerOded Gabbay <oded.gabbay@gmail.com>2018-05-01 17:56:07 -0400
commitf8ea72d097965617bba0d6773fd29d44070c5e1a (patch)
treef1d0feb2b5fd08a534292156f9eaecca8bf40e1d
parent0db54b24ad676c3f2d0cf5291c9d170e3e15f213 (diff)
drm/amdkfd: Fix CP soft hang on APUs
The problem happens on Raven and Carrizo. The context save handler should not clear the high bits of PC_HI before extracting the bits of IB_STS. The bug is not relevant to VEGA10 until we enable demand paging. Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com> Signed-off-by: Yong Zhao <yong.zhao@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
-rw-r--r--drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h4
-rw-r--r--drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx8.asm3
-rw-r--r--drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx9.asm3
3 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index a546a219d025..f68aef02fc1f 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -253,7 +253,6 @@ static const uint32_t cwsr_trap_gfx8_hex[] = {
253 0x00000072, 0x80728472, 253 0x00000072, 0x80728472,
254 0xc0211b7c, 0x00000072, 254 0xc0211b7c, 0x00000072,
255 0x80728472, 0xbf8c007f, 255 0x80728472, 0xbf8c007f,
256 0x8671ff71, 0x0000ffff,
257 0xbefc0073, 0xbefe006e, 256 0xbefc0073, 0xbefe006e,
258 0xbeff006f, 0x867375ff, 257 0xbeff006f, 0x867375ff,
259 0x000003ff, 0xb9734803, 258 0x000003ff, 0xb9734803,
@@ -267,6 +266,7 @@ static const uint32_t cwsr_trap_gfx8_hex[] = {
267 0x8e738f73, 0x87767376, 266 0x8e738f73, 0x87767376,
268 0x8673ff74, 0x00800000, 267 0x8673ff74, 0x00800000,
269 0x8f739773, 0xb976f807, 268 0x8f739773, 0xb976f807,
269 0x8671ff71, 0x0000ffff,
270 0x86fe7e7e, 0x86ea6a6a, 270 0x86fe7e7e, 0x86ea6a6a,
271 0xb974f802, 0xbf8a0000, 271 0xb974f802, 0xbf8a0000,
272 0x95807370, 0xbf810000, 272 0x95807370, 0xbf810000,
@@ -530,7 +530,6 @@ static const uint32_t cwsr_trap_gfx9_hex[] = {
530 0x00000078, 0x80788478, 530 0x00000078, 0x80788478,
531 0xc0211cfa, 0x00000078, 531 0xc0211cfa, 0x00000078,
532 0x80788478, 0xbf8cc07f, 532 0x80788478, 0xbf8cc07f,
533 0x866dff6d, 0x0000ffff,
534 0xbefc006f, 0xbefe007a, 533 0xbefc006f, 0xbefe007a,
535 0xbeff007b, 0x866f71ff, 534 0xbeff007b, 0x866f71ff,
536 0x000003ff, 0xb96f4803, 535 0x000003ff, 0xb96f4803,
@@ -554,6 +553,7 @@ static const uint32_t cwsr_trap_gfx9_hex[] = {
554 0x8e6f8f6f, 0x876e6f6e, 553 0x8e6f8f6f, 0x876e6f6e,
555 0x866fff70, 0x00800000, 554 0x866fff70, 0x00800000,
556 0x8f6f976f, 0xb96ef807, 555 0x8f6f976f, 0xb96ef807,
556 0x866dff6d, 0x0000ffff,
557 0x86fe7e7e, 0x86ea6a6a, 557 0x86fe7e7e, 0x86ea6a6a,
558 0xb970f802, 0xbf8a0000, 558 0xb970f802, 0xbf8a0000,
559 0x95806f6c, 0xbf810000, 559 0x95806f6c, 0xbf810000,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx8.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx8.asm
index 658a4c6be8e4..a2a04bb64096 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx8.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx8.asm
@@ -1015,8 +1015,6 @@ end
1015 1015
1016 s_waitcnt lgkmcnt(0) //from now on, it is safe to restore STATUS and IB_STS 1016 s_waitcnt lgkmcnt(0) //from now on, it is safe to restore STATUS and IB_STS
1017 1017
1018 s_and_b32 s_restore_pc_hi, s_restore_pc_hi, 0x0000ffff //pc[47:32] //Do it here in order not to affect STATUS
1019
1020 //for normal save & restore, the saved PC points to the next inst to execute, no adjustment needs to be made, otherwise: 1018 //for normal save & restore, the saved PC points to the next inst to execute, no adjustment needs to be made, otherwise:
1021 if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_RESTORE_NORMAL)) 1019 if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_RESTORE_NORMAL))
1022 s_add_u32 s_restore_pc_lo, s_restore_pc_lo, 8 //pc[31:0]+8 //two back-to-back s_trap are used (first for save and second for restore) 1020 s_add_u32 s_restore_pc_lo, s_restore_pc_lo, 8 //pc[31:0]+8 //two back-to-back s_trap are used (first for save and second for restore)
@@ -1052,6 +1050,7 @@ end
1052 s_lshr_b32 s_restore_m0, s_restore_m0, SQ_WAVE_STATUS_INST_ATC_SHIFT 1050 s_lshr_b32 s_restore_m0, s_restore_m0, SQ_WAVE_STATUS_INST_ATC_SHIFT
1053 s_setreg_b32 hwreg(HW_REG_IB_STS), s_restore_tmp 1051 s_setreg_b32 hwreg(HW_REG_IB_STS), s_restore_tmp
1054 1052
1053 s_and_b32 s_restore_pc_hi, s_restore_pc_hi, 0x0000ffff //pc[47:32] //Do it here in order not to affect STATUS
1055 s_and_b64 exec, exec, exec // Restore STATUS.EXECZ, not writable by s_setreg_b32 1054 s_and_b64 exec, exec, exec // Restore STATUS.EXECZ, not writable by s_setreg_b32
1056 s_and_b64 vcc, vcc, vcc // Restore STATUS.VCCZ, not writable by s_setreg_b32 1055 s_and_b64 vcc, vcc, vcc // Restore STATUS.VCCZ, not writable by s_setreg_b32
1057 s_setreg_b32 hwreg(HW_REG_STATUS), s_restore_status // SCC is included, which is changed by previous salu 1056 s_setreg_b32 hwreg(HW_REG_STATUS), s_restore_status // SCC is included, which is changed by previous salu
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx9.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx9.asm
index 065f55ae9e41..998be96be736 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx9.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx9.asm
@@ -1067,8 +1067,6 @@ end
1067 1067
1068 s_waitcnt lgkmcnt(0) //from now on, it is safe to restore STATUS and IB_STS 1068 s_waitcnt lgkmcnt(0) //from now on, it is safe to restore STATUS and IB_STS
1069 1069
1070 s_and_b32 s_restore_pc_hi, s_restore_pc_hi, 0x0000ffff //pc[47:32] //Do it here in order not to affect STATUS
1071
1072 //for normal save & restore, the saved PC points to the next inst to execute, no adjustment needs to be made, otherwise: 1070 //for normal save & restore, the saved PC points to the next inst to execute, no adjustment needs to be made, otherwise:
1073 if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_RESTORE_NORMAL)) 1071 if ((EMU_RUN_HACK) && (!EMU_RUN_HACK_RESTORE_NORMAL))
1074 s_add_u32 s_restore_pc_lo, s_restore_pc_lo, 8 //pc[31:0]+8 //two back-to-back s_trap are used (first for save and second for restore) 1072 s_add_u32 s_restore_pc_lo, s_restore_pc_lo, 8 //pc[31:0]+8 //two back-to-back s_trap are used (first for save and second for restore)
@@ -1119,6 +1117,7 @@ end
1119 s_lshr_b32 s_restore_m0, s_restore_m0, SQ_WAVE_STATUS_INST_ATC_SHIFT 1117 s_lshr_b32 s_restore_m0, s_restore_m0, SQ_WAVE_STATUS_INST_ATC_SHIFT
1120 s_setreg_b32 hwreg(HW_REG_IB_STS), s_restore_tmp 1118 s_setreg_b32 hwreg(HW_REG_IB_STS), s_restore_tmp
1121 1119
1120 s_and_b32 s_restore_pc_hi, s_restore_pc_hi, 0x0000ffff //pc[47:32] //Do it here in order not to affect STATUS
1122 s_and_b64 exec, exec, exec // Restore STATUS.EXECZ, not writable by s_setreg_b32 1121 s_and_b64 exec, exec, exec // Restore STATUS.EXECZ, not writable by s_setreg_b32
1123 s_and_b64 vcc, vcc, vcc // Restore STATUS.VCCZ, not writable by s_setreg_b32 1122 s_and_b64 vcc, vcc, vcc // Restore STATUS.VCCZ, not writable by s_setreg_b32
1124 s_setreg_b32 hwreg(HW_REG_STATUS), s_restore_status // SCC is included, which is changed by previous salu 1123 s_setreg_b32 hwreg(HW_REG_STATUS), s_restore_status // SCC is included, which is changed by previous salu