From 74fe695127f80ee4d42e7e50ee364412a3eb637a Mon Sep 17 00:00:00 2001 From: Philip Cox Date: Tue, 13 Aug 2019 11:03:43 -0400 Subject: [PATCH] Remove debugger data reg accesses The debug trap accesses the data0/data1 registers, so we do not want the userspace to write values to it. We remove the calls to set the data0/data1 register values. Change-Id: Iaba842a4c445f339f16a39fe1994526ff78a2f3c Signed-off-by: Philip Cox [ROCm/ROCR-Runtime commit: 6933540c819910d93dc5e94e32ba05f7eb471fdf] --- projects/rocr-runtime/include/hsakmt.h | 33 ------------------- .../rocr-runtime/include/linux/kfd_ioctl.h | 24 +++++--------- projects/rocr-runtime/src/debug.c | 14 -------- 3 files changed, 8 insertions(+), 63 deletions(-) diff --git a/projects/rocr-runtime/include/hsakmt.h b/projects/rocr-runtime/include/hsakmt.h index d5af173b30..79eb5e3446 100644 --- a/projects/rocr-runtime/include/hsakmt.h +++ b/projects/rocr-runtime/include/hsakmt.h @@ -735,9 +735,6 @@ hsaKmtQueueResume( - X, Y, Z grid and work-group position of the wave within the dispatch. - - The value of TrapData registers. hsaKmtEnableDebugTrap() sets - these to 0 and they can be changed by hsaKmtSetDebugTrapData2(). - - The scratch backing memory address. - Enable wave launch trap override. hsaKmtEnableDebugTrap() sets the @@ -826,36 +823,6 @@ hsaKmtQueryDebugEvent( bool *IsNew //OUT ); -/** - Set the value to use to initialize the TrapData used when - initializing trap temp registers for NodeId when debug trap is enabled. - - An error is returned if debug trap is not currently enabled for - NodeId. Debug trap is enabled by hsaKmtEnableDebugTrap() which - initializes TrapData to 0. - - Returns: - - HSAKMT_STATUS_SUCCESS if successful. - - - HSAKMT_STATUS_NOT_SUPPORTED if debug trap data is not supported - by NodeId. - - - HSAKMT_STATUS_INVALID_HANDLE if NodeId is invalid. - - - HSAKMT_STATUS_INVALID_PARAMETER if TrapDataIndex is larger than - trap-data-count - 1. - - - HSAKMT_STATUS_ERROR if debug trap is not currently enabled by - hsaKmtEnableDebugTrap() for NodeId. -*/ -HSAKMT_STATUS -HSAKMTAPI -hsaKmtSetDebugTrapData2( - HSAuint32 NodeId, //IN - HSAuint32 TrapData0, //IN - HSAuint32 TrapData1 //IN - ); - /** Set the trap override mask. When debug trap is enabled by hsaKmtEnableDebugTrap() each wave launched has its initial diff --git a/projects/rocr-runtime/include/linux/kfd_ioctl.h b/projects/rocr-runtime/include/linux/kfd_ioctl.h index 66c72c9f8d..4e02aa8158 100644 --- a/projects/rocr-runtime/include/linux/kfd_ioctl.h +++ b/projects/rocr-runtime/include/linux/kfd_ioctl.h @@ -28,8 +28,8 @@ #define KFD_IOCTL_MAJOR_VERSION 1 #define KFD_IOCTL_MINOR_VERSION 2 -#define KFD_IOCTL_DBG_MAJOR_VERSION 0 -#define KFD_IOCTL_DBG_MINOR_VERSION 2 +#define KFD_IOCTL_DBG_MAJOR_VERSION 1 +#define KFD_IOCTL_DBG_MINOR_VERSION 0 struct kfd_ioctl_get_version_args { __u32 major_version; /* from KFD */ @@ -206,21 +206,13 @@ struct kfd_ioctl_dbg_wave_control_args { */ #define KFD_IOC_DBG_TRAP_ENABLE 0 -/* KFD_IOC_DBG_TRAP_SET_TRAP_DATA: - * ptr: unused - * data1: SPI_GDBG_TRAP_DATA0 - * data2: SPI_GDBG_TRAP_DATA1 - * data3: unused - */ -#define KFD_IOC_DBG_TRAP_SET_TRAP_DATA 1 - /* KFD_IOC_DBG_TRAP_SET_WAVE_LAUNCH_OVERRIDE: * ptr: unused * data1: override mode: 0=OR, 1=REPLACE * data2: mask * data3: unused */ -#define KFD_IOC_DBG_TRAP_SET_WAVE_LAUNCH_OVERRIDE 2 +#define KFD_IOC_DBG_TRAP_SET_WAVE_LAUNCH_OVERRIDE 1 /* KFD_IOC_DBG_TRAP_SET_WAVE_LAUNCH_MODE: * ptr: unused @@ -228,7 +220,7 @@ struct kfd_ioctl_dbg_wave_control_args { * data2: unused * data3: unused */ -#define KFD_IOC_DBG_TRAP_SET_WAVE_LAUNCH_MODE 3 +#define KFD_IOC_DBG_TRAP_SET_WAVE_LAUNCH_MODE 2 /* KFD_IOC_DBG_TRAP_NODE_SUSPEND: * ptr: pointer to an array of Queues IDs @@ -236,7 +228,7 @@ struct kfd_ioctl_dbg_wave_control_args { * data2: number of queues * data3: grace period */ -#define KFD_IOC_DBG_TRAP_NODE_SUSPEND 4 +#define KFD_IOC_DBG_TRAP_NODE_SUSPEND 3 /* KFD_IOC_DBG_TRAP_NODE_RESUME: * ptr: pointer to an array of Queues IDs @@ -244,7 +236,7 @@ struct kfd_ioctl_dbg_wave_control_args { * data2: number of queues * data3: unused */ -#define KFD_IOC_DBG_TRAP_NODE_RESUME 5 +#define KFD_IOC_DBG_TRAP_NODE_RESUME 4 /* KFD_IOC_DBG_TRAP_QUERY_DEBUG_EVENT: * ptr: unused @@ -252,7 +244,7 @@ struct kfd_ioctl_dbg_wave_control_args { * data2: flags (IN) * data3: suspend[2:2], event type [1:0] (OUT) */ -#define KFD_IOC_DBG_TRAP_QUERY_DEBUG_EVENT 6 +#define KFD_IOC_DBG_TRAP_QUERY_DEBUG_EVENT 5 /* KFD_IOC_DBG_TRAP_GET_VERSION: * prt: unsused @@ -260,7 +252,7 @@ struct kfd_ioctl_dbg_wave_control_args { * data2: minor version (OUT) * data3: unused */ -#define KFD_IOC_DBG_TRAP_GET_VERSION 8 +#define KFD_IOC_DBG_TRAP_GET_VERSION 7 struct kfd_ioctl_dbg_trap_args { __u64 ptr; /* to KFD -- used for pointer arguments: queue arrays */ diff --git a/projects/rocr-runtime/src/debug.c b/projects/rocr-runtime/src/debug.c index 6d2f7b8773..8aa67446ad 100644 --- a/projects/rocr-runtime/src/debug.c +++ b/projects/rocr-runtime/src/debug.c @@ -383,20 +383,6 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtDisableDebugTrap(HSAuint32 NodeId) NULL); } -HSAKMT_STATUS HSAKMTAPI hsaKmtSetDebugTrapData2(HSAuint32 NodeId, - HSAuint32 TrapData0, - HSAuint32 TrapData1) -{ - return debug_trap(NodeId, - KFD_IOC_DBG_TRAP_SET_TRAP_DATA, - TrapData0, - TrapData1, - 0, - INVALID_PID, - 0, - NULL); -} - HSAKMT_STATUS HSAKMTAPI hsaKmtSetWaveLaunchTrapOverride( HSAuint32 NodeId, HSA_DBG_TRAP_OVERRIDE TrapOverride,