drm/amdkfd: Fix gfx8 MEM_VIOL exception handler
authorJay Cornwall <Jay.Cornwall@amd.com>
Thu, 15 Nov 2018 04:23:25 +0000 (22:23 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 24 May 2019 17:21:01 +0000 (12:21 -0500)
When MEM_VIOL is asserted the context save handler rewinds the
program counter. This is incorrect for any source of the exception.
MEM_VIOL may be raised in normal operation by out-of-bounds access
to LDS or GDS and does not require special handling.

Remove PC adjustment when MEM_VIOL has been raised.

Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx8.asm

index 3621efbd57595df861e9d2088f6fd2e02c596eef..ec9a9a99f8080dd015d96209aa50d6ce9e7083e5 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 static const uint32_t cwsr_trap_gfx8_hex[] = {
-       0xbf820001, 0xbf82012b,
+       0xbf820001, 0xbf820121,
        0xb8f4f802, 0x89748674,
        0xb8f5f803, 0x8675ff75,
        0x00000400, 0xbf850017,
@@ -36,12 +36,7 @@ static const uint32_t cwsr_trap_gfx8_hex[] = {
        0x8671ff71, 0x0000ffff,
        0x8f728374, 0xb972e0c2,
        0xbf800002, 0xb9740002,
-       0xbe801f70, 0xb8f5f803,
-       0x8675ff75, 0x00000100,
-       0xbf840006, 0xbefa0080,
-       0xb97a0203, 0x8671ff71,
-       0x0000ffff, 0x80f08870,
-       0x82f18071, 0xbefa0080,
+       0xbe801f70, 0xbefa0080,
        0xb97a0283, 0xbef60068,
        0xbef70069, 0xb8fa1c07,
        0x8e7a9c7a, 0x87717a71,
index abe1a5da29fb313b7ae03777bec24ddf8082a40c..a47f5b933120f3919f233de91d4320706957c2f1 100644 (file)
@@ -282,19 +282,6 @@ if G8SR_DEBUG_TIMESTAMP
         s_waitcnt lgkmcnt(0)         //FIXME, will cause xnack??
 end
 
-    //check whether there is mem_viol
-    s_getreg_b32    s_save_trapsts, hwreg(HW_REG_TRAPSTS)
-    s_and_b32   s_save_trapsts, s_save_trapsts, SQ_WAVE_TRAPSTS_MEM_VIOL_MASK
-    s_cbranch_scc0  L_NO_PC_REWIND
-
-    //if so, need rewind PC assuming GDS operation gets NACKed
-    s_mov_b32       s_save_tmp, 0                                                           //clear mem_viol bit
-    s_setreg_b32    hwreg(HW_REG_TRAPSTS, SQ_WAVE_TRAPSTS_MEM_VIOL_SHIFT, 1), s_save_tmp    //clear mem_viol bit
-    s_and_b32       s_save_pc_hi, s_save_pc_hi, 0x0000ffff    //pc[47:32]
-    s_sub_u32       s_save_pc_lo, s_save_pc_lo, 8             //pc[31:0]-8
-    s_subb_u32      s_save_pc_hi, s_save_pc_hi, 0x0           // -scc
-
-L_NO_PC_REWIND:
     s_mov_b32       s_save_tmp, 0                                                           //clear saveCtx bit
     s_setreg_b32    hwreg(HW_REG_TRAPSTS, SQ_WAVE_TRAPSTS_SAVECTX_SHIFT, 1), s_save_tmp     //clear saveCtx bit