History

drm/amdkfd: add H/W debugger IOCTL set definitions

This patch adds four new IOCTLs to amdkfd. These IOCTLs expose a H/W debugger functionality to the userspace. The IOCTLs are: - AMDKFD_IOC_DBG_REGISTER: The purpose of this IOCTL is to notify amdkfd that a process wants to use GPU debugging facilities on itself only. It is expected that this IOCTL would be called before any other H/W debugger requests are sent to amdkfd and for each GPU where the H/W debugging needs to be enabled. The use of this IOCTL ensures that only one instance of a debugger is active in the system. - AMDKFD_IOC_DBG_UNREGISTER: This IOCTL detaches the debugger/debugged process from the H/W Debug which was established by the AMDKFD_IOC_DBG_REGISTER IOCTL. - AMDKFD_IOC_DBG_ADDRESS_WATCH: This IOCTL allows to set different watchpoints with various conditions as indicated by the IOCTL's arguments. The available number of watchpoints is retrieved from topology. This operation is confined to the current debugged process, which was registered through AMDKFD_IOC_DBG_REGISTER. - AMDKFD_IOC_DBG_WAVE_CONTROL: This IOCTL allows to control a wavefront as indicated by the IOCTL's arguments. For example, you can halt/resume or kill either a single wavefront or a set of wavefronts. This operation is confined to the current debugged process, which was registered through AMDKFD_IOC_DBG_REGISTER. Because the arguments for the address watch IOCTL and wave control IOCTL are dynamic, meaning that they could vary in size, the userspace passes a pointer to a structure (in userspace) that contains the value of the arguments. The kernel driver is responsible to parse this structure and validate its contents. v2: change void* to uint64_t inside ioctl arguments

Yair Shachar committed 11 years ago

Commit aef11001 parent a6186f42 files · +95 −2Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/kfd_ioctl.h+41−2
@@ -128,6 +128,32 @@ struct kfd_ioctl_get_process_apertures_args { · 127 unmodified lines
128 uint32_t pad;128 uint32_t pad;
129};129};
130 130
131#define MAX_ALLOWED_NUM_POINTS 100
132#define MAX_ALLOWED_AW_BUFF_SIZE 4096
133#define MAX_ALLOWED_WAC_BUFF_SIZE 128
134
135struct kfd_ioctl_dbg_register_args {
136 uint32_t gpu_id; /* to KFD */
137 uint32_t pad;
138};
139
140struct kfd_ioctl_dbg_unregister_args {
141 uint32_t gpu_id; /* to KFD */
142 uint32_t pad;
143};
144
145struct kfd_ioctl_dbg_address_watch_args {
146 uint64_t content_ptr; /* a pointer to the actual content */
147 uint32_t gpu_id; /* to KFD */
148 uint32_t buf_size_in_bytes; /*including gpu_id and buf_size */
149};
150
151struct kfd_ioctl_dbg_wave_control_args {
152 uint64_t content_ptr; /* a pointer to the actual content */
153 uint32_t gpu_id; /* to KFD */
154 uint32_t buf_size_in_bytes; /*including gpu_id and buf_size */
155};
156
131/* Matching HSA_EVENTTYPE */157/* Matching HSA_EVENTTYPE */
132#define KFD_IOC_EVENT_SIGNAL 0158#define KFD_IOC_EVENT_SIGNAL 0
133#define KFD_IOC_EVENT_NODECHANGE 1159#define KFD_IOC_EVENT_NODECHANGE 1
@@ -198,7 +224,8 @@ struct kfd_event_data { · 64 unmodified lines
198};224};
199 225
200struct kfd_ioctl_wait_events_args {226struct kfd_ioctl_wait_events_args {
201 uint64_t events_ptr; /* to KFD */227 uint64_t events_ptr; /* pointed to struct
228 kfd_event_data array, to KFD */
202 uint32_t num_events; /* to KFD */229 uint32_t num_events; /* to KFD */
203 uint32_t wait_for_all; /* to KFD */230 uint32_t wait_for_all; /* to KFD */
204 uint32_t timeout; /* to KFD */231 uint32_t timeout; /* to KFD */
@@ -247,7 +274,19 @@ struct kfd_ioctl_wait_events_args { · 42 unmodified lines
247#define AMDKFD_IOC_WAIT_EVENTS \274#define AMDKFD_IOC_WAIT_EVENTS \
248 AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args)275 AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args)
249 276
277#define AMDKFD_IOC_DBG_REGISTER \
278 AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args)
279
280#define AMDKFD_IOC_DBG_UNREGISTER \
281 AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args)
282
283#define AMDKFD_IOC_DBG_ADDRESS_WATCH \
284 AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args)
285
286#define AMDKFD_IOC_DBG_WAVE_CONTROL \
287 AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args)
288
250#define AMDKFD_COMMAND_START 0x01289#define AMDKFD_COMMAND_START 0x01
251#define AMDKFD_COMMAND_END 0x0D290#define AMDKFD_COMMAND_END 0x11
252 291
253#endif292#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t