libhsakmt: Add check for the runntime debuuger

Avoiding the segfault, runtime debugger enable is not supported
if the firmware of gpu doesn't support debug exceptions.

Signed-off-by: jie1zhan <jesse.zhang@amd.com>
Change-Id: Ifad57a6e78cb1c92b1f8927355ece8c64e89c51b
Ta zmiana jest zawarta w:
jie1zhan authored and Jesse Zhang committed 2022-09-08 20:52:01 -04:00
1 rodzic 57a1c6f3ff
złożenie d98c729ff9
Plik 1 zmieniony
+19
+19
Wyświetl plik
@@ -302,6 +302,25 @@ hsaKmtGetKernelDebugTrapVersionInfo(
static HSAKMT_STATUS checkRuntimeDebugSupport(void) {
HSAuint32 kMajor, kMinor;
HsaNodeProperties node = {0};
HsaSystemProperties props = {0};
memset(&node, 0x00, sizeof(node));
memset(&props, 0x00, sizeof(props));
if (hsaKmtAcquireSystemProperties(&props))
return HSAKMT_STATUS_ERROR;
//the firmware of gpu node doesn't support the debugger, disable it.
for (uint32_t i = 0; i < props.NumNodes; i++) {
if (hsaKmtGetNodeProperties(i, &node))
return HSAKMT_STATUS_ERROR;
//ignore cpu node
if (node.NumCPUCores)
continue;
if (!node.Capability.ui32.DebugSupportedFirmware)
return HSAKMT_STATUS_NOT_SUPPORTED;
}
if (hsaKmtGetKernelDebugTrapVersionInfo(&kMajor, &kMinor))
return HSAKMT_STATUS_NOT_SUPPORTED;