Add polling query debug event operation.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Change-Id: Ic82ce4a393bfb28c9f32e7920f80c12da7f627d5
Этот коммит содержится в:
Jonathan Kim
2022-05-13 12:35:45 -04:00
коммит произвёл Jonathan Kim
родитель c7129edcb8
Коммит bfb0d15ee8
2 изменённых файлов: 38 добавлений и 0 удалений
+35
Просмотреть файл
@@ -111,3 +111,38 @@ HSAKMT_STATUS BaseDebug::SendRuntimeEvent(uint64_t exceptions, int gpuId, int qu
return hsaKmtDebugTrapIoctl(&args, NULL);
}
HSAKMT_STATUS BaseDebug::QueryDebugEvent(uint64_t *exceptions,
uint32_t *gpuId, uint32_t *queueId,
int timeoutMsec)
{
struct kfd_ioctl_dbg_trap_args args = {0};
HSAKMT_STATUS result;
int r = poll(&m_Fd, 1, timeoutMsec);
if (r > 0) {
char tmp[r];
read(m_Fd.fd, tmp, sizeof(tmp));
} else {
return HSAKMT_STATUS_ERROR;
}
memset(&args, 0x00, sizeof(args));
args.pid = m_Pid;
args.op = KFD_IOC_DBG_TRAP_QUERY_DEBUG_EVENT;
args.query_debug_event.exception_mask = *exceptions;
result = hsaKmtDebugTrapIoctl(&args, NULL);
*exceptions = args.query_debug_event.exception_mask;
if (gpuId)
*gpuId = args.query_debug_event.gpu_id;
if (queueId)
*queueId = args.query_debug_event.queue_id;
return result;
}
+3
Просмотреть файл
@@ -41,6 +41,9 @@ class BaseDebug {
void Detach(void);
HSAKMT_STATUS SendRuntimeEvent(uint64_t exceptions, int gpuId, int queueId);
HSAKMT_STATUS QueryDebugEvent(uint64_t *exceptions,
uint32_t *gpuId, uint32_t *queueId,
int timeoutMsec);
private:
unsigned int m_Pid;