From ad717d2e984541fb2eb2c632e6884c7f4f4f7814 Mon Sep 17 00:00:00 2001 From: Jay Cornwall Date: Thu, 8 Aug 2019 14:36:10 -0500 Subject: [PATCH] Support KFD interrupt protocol in second-level trap handler If M0[23] is set then the driver will interpret the interrupt as a debug event, rather than a signal event. Clear M0 before sending the interrupt. All paths here are terminal so it's not necessary to save/restore M0. Change-Id: Ibd85b8cc6f8556941f2308a2c3fa3c68702cd606 --- runtime/hsa-runtime/core/inc/amd_gpu_shaders.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h b/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h index 76b975c773..59ba7dc4ad 100644 --- a/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h +++ b/runtime/hsa-runtime/core/inc/amd_gpu_shaders.h @@ -202,6 +202,8 @@ static const unsigned int kCodeTrapHandler9[] = { s_waitcnt lgkmcnt(0) // Send an interrupt to trigger event notification. + s_mov_b32 m0, 0x0 + s_nop 0 s_sendmsg sendmsg(MSG_INTERRUPT) .signal_done: @@ -226,15 +228,16 @@ static const unsigned int kCodeTrapHandler9[] = { */ 0xb8eef803, 0x8670ff6e, 0x10000100, 0xbf06ff70, 0x00000100, 0xbef000ff, 0x20000000, 0xbf85000e, 0x8670ff6e, 0x00000800, 0xbef000f4, 0xbf85000a, - 0x92eeff6d, 0x00080010, 0xbf84002a, 0xbf06826e, 0xbef000ff, 0x80000000, - 0xbf850003, 0x806c846c, 0x826d806d, 0xbf820023, 0xbefe00ff, 0x80000000, + 0x92eeff6d, 0x00080010, 0xbf84002c, 0xbf06826e, 0xbef000ff, 0x80000000, + 0xbf850003, 0x806c846c, 0x826d806d, 0xbf820025, 0xbefe00ff, 0x80000000, 0xbf90000a, 0xbf800007, 0xbf0c9f7e, 0xbf84fffd, 0x866eff7e, 0x000003ff, 0x8e6e836e, 0xc0051bbd, 0x0000006e, 0xbf8cc07f, 0xc0071bb7, 0x000000c0, 0xbf8cc07f, 0xbef10080, 0xc2831c37, 0x00000008, 0xbf8cc07f, 0x87707170, - 0xbf85000c, 0xc0071c37, 0x00000010, 0xbf8cc07f, 0x86f07070, 0xbf840007, + 0xbf85000e, 0xc0071c37, 0x00000010, 0xbf8cc07f, 0x86f07070, 0xbf840009, 0xc0031bb7, 0x00000018, 0xbf8cc07f, 0xc0431bb8, 0x00000000, 0xbf8cc07f, - 0xbf900001, 0x8778ff78, 0x00002000, 0x8f6e8b77, 0x866eff6e, 0x001f8000, - 0xb96ef807, 0x86fe7e7e, 0x86ea6a6a, 0xb978f802, 0xbe801f6c, + 0xbefc0080, 0xbf800000, 0xbf900001, 0x8778ff78, 0x00002000, 0x8f6e8b77, + 0x866eff6e, 0x001f8000, 0xb96ef807, 0x86fe7e7e, 0x86ea6a6a, 0xb978f802, + 0xbe801f6c, }; static const unsigned int kCodeCopyAligned8[] = {