diff --git a/include/hsakmt.h b/include/hsakmt.h index 49d255a868..d5af173b30 100644 --- a/include/hsakmt.h +++ b/include/hsakmt.h @@ -917,6 +917,36 @@ hsaKmtSetWaveLaunchMode( HSA_DBG_WAVE_LAUNCH_MODE WaveLaunchMode //IN ); +/** + * Get the major and minor version of the kernel debugger support. + * + * Returns: + * - HSAKMT_STATUS_SUCCESS if successful. + * + * - HSAKMT_STATUS_INVALID_HANDLE if NodeId is invalid. + * + * - HSAKMT_STATUS_NOT_SUPPORTED if debug trap not supported for NodeId. +*/ +HSAKMT_STATUS +HSAKMTAPI +hsaKmtGetKernelDebugTrapVersionInfo( + HSAuint32 *Major, //Out + HSAuint32 *Minor //Out + ); + +/** + * Get the major and minor version of the thunk debugger support. +*/ +void +HSAKMTAPI +hsaKmtGetThunkDebugTrapVersionInfo( + HSAuint32 *Major, //Out + HSAuint32 *Minor //Out + ); + + + + /** Set a debug memory access watch point. A memory access of the kind specified by WatchMode to an matching address will cause the trap diff --git a/src/debug.c b/src/debug.c index f111d7ff75..6d2f7b8773 100644 --- a/src/debug.c +++ b/src/debug.c @@ -286,7 +286,8 @@ static HSAKMT_STATUS debug_trap(HSAuint32 NodeId, CHECK_KFD_OPEN(); if (op == KFD_IOC_DBG_TRAP_NODE_SUSPEND || - op == KFD_IOC_DBG_TRAP_NODE_RESUME) { + op == KFD_IOC_DBG_TRAP_NODE_RESUME || + op == KFD_IOC_DBG_TRAP_GET_VERSION) { if (NodeId != INVALID_NODEID) return HSAKMT_STATUS_INVALID_HANDLE; @@ -596,3 +597,50 @@ hsaKmtQueryDebugEvent( return result; } +/** + * Get the major and minor version of the kernel debugger support. + * + * Returns: + * - HSAKMT_STATUS_SUCCESS if successful. + * + * - HSAKMT_STATUS_INVALID_HANDLE if NodeId is invalid. + * + * - HSAKMT_STATUS_NOT_SUPPORTED if debug trap not supported for NodeId. +*/ +HSAKMT_STATUS +HSAKMTAPI +hsaKmtGetKernelDebugTrapVersionInfo( + HSAuint32 *Major, //Out + HSAuint32 *Minor //Out +) +{ + HSAKMT_STATUS result; + struct kfd_ioctl_dbg_trap_args argout = {0}; + + result = debug_trap(INVALID_NODEID, + KFD_IOC_DBG_TRAP_GET_VERSION, + 0, + 0, + 0, + INVALID_PID, + 0, + &argout); + + *Major = argout.data1; + *Minor = argout.data2; + return result; +} + +/** + * Get the major and minor version of the Thunk debugger support. +*/ +void +HSAKMTAPI +hsaKmtGetThunkDebugTrapVersionInfo( + HSAuint32 *Major, //Out + HSAuint32 *Minor //Out +) +{ + *Major = KFD_IOCTL_DBG_MAJOR_VERSION; + *Minor = KFD_IOCTL_DBG_MINOR_VERSION; +} diff --git a/src/libhsakmt.ver b/src/libhsakmt.ver index 482a7aeaf8..3f2e787ac5 100644 --- a/src/libhsakmt.ver +++ b/src/libhsakmt.ver @@ -67,6 +67,8 @@ hsaKmtSetWaveLaunchMode; hsaKmtQueueSuspend; hsaKmtQueueResume; hsaKmtAllocQueueGWS; +hsaKmtGetKernelDebugTrapVersionInfo; +hsaKmtGetThunkDebugTrapVersionInfo; local: *; };