Go to the documentation of this file.
23 #ifndef KFD_IOCTL_H_INCLUDED
24 #define KFD_IOCTL_H_INCLUDED
26 #include <linux/types.h>
27 #include <linux/ioctl.h>
29 #define KFD_IOCTL_MAJOR_VERSION 1
30 #define KFD_IOCTL_MINOR_VERSION 2
38 #define KFD_IOC_QUEUE_TYPE_COMPUTE 0
39 #define KFD_IOC_QUEUE_TYPE_SDMA 1
40 #define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2
42 #define KFD_MAX_QUEUE_PERCENTAGE 100
43 #define KFD_MAX_QUEUE_PRIORITY 15
86 #define KFD_IOC_CACHE_POLICY_COHERENT 0
87 #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
123 #define NUM_OF_SUPPORTED_GPUS 7
162 #define MAX_ALLOWED_NUM_POINTS 100
163 #define MAX_ALLOWED_AW_BUFF_SIZE 4096
164 #define MAX_ALLOWED_WAC_BUFF_SIZE 128
189 #define KFD_IOC_EVENT_SIGNAL 0
190 #define KFD_IOC_EVENT_NODECHANGE 1
191 #define KFD_IOC_EVENT_DEVICESTATECHANGE 2
192 #define KFD_IOC_EVENT_HW_EXCEPTION 3
193 #define KFD_IOC_EVENT_SYSTEM_EVENT 4
194 #define KFD_IOC_EVENT_DEBUG_EVENT 5
195 #define KFD_IOC_EVENT_PROFILE_EVENT 6
196 #define KFD_IOC_EVENT_QUEUE_EVENT 7
197 #define KFD_IOC_EVENT_MEMORY 8
199 #define KFD_IOC_WAIT_RESULT_COMPLETE 0
200 #define KFD_IOC_WAIT_RESULT_TIMEOUT 1
201 #define KFD_IOC_WAIT_RESULT_FAIL 2
210 #define KFD_SIGNAL_EVENT_LIMIT (4096 + 512)
281 #define KFD_IOC_ALLOC_MEM_FLAGS_VRAM (1 << 0)
282 #define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1)
283 #define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2)
284 #define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3)
286 #define KFD_IOC_ALLOC_MEM_FLAGS_NONPAGED (1 << 31)
287 #define KFD_IOC_ALLOC_MEM_FLAGS_READONLY (1 << 30)
288 #define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29)
289 #define KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE (1 << 28)
290 #define KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM (1 << 27)
291 #define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTE_ACCESS (1 << 26)
292 #define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 25)
407 #define KFD_CROSS_MEMORY_RW_BIT (1 << 0)
408 #define KFD_SET_CROSS_MEMORY_READ(flags) (flags &= ~KFD_CROSS_MEMORY_RW_BIT)
409 #define KFD_SET_CROSS_MEMORY_WRITE(flags) (flags |= KFD_CROSS_MEMORY_RW_BIT)
410 #define KFD_IS_CROSS_MEMORY_WRITE(flags) (flags & KFD_CROSS_MEMORY_RW_BIT)
429 #define AMDKFD_IOCTL_BASE 'K'
430 #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
431 #define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
432 #define AMDKFD_IOW(nr, type) _IOW(AMDKFD_IOCTL_BASE, nr, type)
433 #define AMDKFD_IOWR(nr, type) _IOWR(AMDKFD_IOCTL_BASE, nr, type)
435 #define AMDKFD_IOC_GET_VERSION \
436 AMDKFD_IOR(0x01, struct kfd_ioctl_get_version_args)
438 #define AMDKFD_IOC_CREATE_QUEUE \
439 AMDKFD_IOWR(0x02, struct kfd_ioctl_create_queue_args)
441 #define AMDKFD_IOC_DESTROY_QUEUE \
442 AMDKFD_IOWR(0x03, struct kfd_ioctl_destroy_queue_args)
444 #define AMDKFD_IOC_SET_MEMORY_POLICY \
445 AMDKFD_IOW(0x04, struct kfd_ioctl_set_memory_policy_args)
447 #define AMDKFD_IOC_GET_CLOCK_COUNTERS \
448 AMDKFD_IOWR(0x05, struct kfd_ioctl_get_clock_counters_args)
450 #define AMDKFD_IOC_GET_PROCESS_APERTURES \
451 AMDKFD_IOR(0x06, struct kfd_ioctl_get_process_apertures_args)
453 #define AMDKFD_IOC_UPDATE_QUEUE \
454 AMDKFD_IOW(0x07, struct kfd_ioctl_update_queue_args)
456 #define AMDKFD_IOC_CREATE_EVENT \
457 AMDKFD_IOWR(0x08, struct kfd_ioctl_create_event_args)
459 #define AMDKFD_IOC_DESTROY_EVENT \
460 AMDKFD_IOW(0x09, struct kfd_ioctl_destroy_event_args)
462 #define AMDKFD_IOC_SET_EVENT \
463 AMDKFD_IOW(0x0A, struct kfd_ioctl_set_event_args)
465 #define AMDKFD_IOC_RESET_EVENT \
466 AMDKFD_IOW(0x0B, struct kfd_ioctl_reset_event_args)
468 #define AMDKFD_IOC_WAIT_EVENTS \
469 AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args)
471 #define AMDKFD_IOC_DBG_REGISTER \
472 AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args)
474 #define AMDKFD_IOC_DBG_UNREGISTER \
475 AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args)
477 #define AMDKFD_IOC_DBG_ADDRESS_WATCH \
478 AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args)
480 #define AMDKFD_IOC_DBG_WAVE_CONTROL \
481 AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args)
483 #define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU \
484 AMDKFD_IOWR(0x11, struct kfd_ioctl_alloc_memory_of_gpu_args)
486 #define AMDKFD_IOC_FREE_MEMORY_OF_GPU \
487 AMDKFD_IOWR(0x12, struct kfd_ioctl_free_memory_of_gpu_args)
489 #define AMDKFD_IOC_MAP_MEMORY_TO_GPU \
490 AMDKFD_IOWR(0x13, struct kfd_ioctl_map_memory_to_gpu_args)
492 #define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU \
493 AMDKFD_IOWR(0x14, struct kfd_ioctl_unmap_memory_from_gpu_args)
495 #define AMDKFD_IOC_ALLOC_MEMORY_OF_SCRATCH \
496 AMDKFD_IOWR(0x15, struct kfd_ioctl_alloc_memory_of_scratch_args)
498 #define AMDKFD_IOC_SET_CU_MASK \
499 AMDKFD_IOW(0x16, struct kfd_ioctl_set_cu_mask_args)
501 #define AMDKFD_IOC_SET_PROCESS_DGPU_APERTURE \
503 struct kfd_ioctl_set_process_dgpu_aperture_args)
505 #define AMDKFD_IOC_SET_TRAP_HANDLER \
506 AMDKFD_IOW(0x18, struct kfd_ioctl_set_trap_handler_args)
508 #define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW \
509 AMDKFD_IOWR(0x19, struct kfd_ioctl_get_process_apertures_new_args)
511 #define AMDKFD_IOC_GET_DMABUF_INFO \
512 AMDKFD_IOWR(0x1A, struct kfd_ioctl_get_dmabuf_info_args)
514 #define AMDKFD_IOC_IMPORT_DMABUF \
515 AMDKFD_IOWR(0x1B, struct kfd_ioctl_import_dmabuf_args)
517 #define AMDKFD_IOC_GET_TILE_CONFIG \
518 AMDKFD_IOWR(0x1C, struct kfd_ioctl_get_tile_config_args)
520 #define AMDKFD_IOC_IPC_IMPORT_HANDLE \
521 AMDKFD_IOWR(0x1D, struct kfd_ioctl_ipc_import_handle_args)
523 #define AMDKFD_IOC_IPC_EXPORT_HANDLE \
524 AMDKFD_IOWR(0x1E, struct kfd_ioctl_ipc_export_handle_args)
526 #define AMDKFD_IOC_CROSS_MEMORY_COPY \
527 AMDKFD_IOWR(0x1F, struct kfd_ioctl_cross_memory_copy_args)
530 #define AMDKFD_IOC_OPEN_GRAPHIC_HANDLE \
531 AMDKFD_IOWR(0x20, struct kfd_ioctl_open_graphic_handle_args)
533 #define AMDKFD_COMMAND_START 0x01
534 #define AMDKFD_COMMAND_END 0x21
uint32_t alternate_policy
struct kfd_hsa_memory_exception_data memory_exception_data
uint32_t num_macro_tile_configs
uint64_t kfd_process_device_apertures_ptr
uint64_t read_pointer_address
uint32_t buf_size_in_bytes
uint32_t num_tile_configs
struct kfd_memory_exception_failure failure
uint64_t event_page_offset
uint64_t dst_mem_range_array
uint64_t ctx_save_restore_address
uint64_t system_clock_counter
uint64_t alternate_aperture_base
uint32_t ctx_save_restore_size
struct kfd_process_device_apertures process_apertures[NUM_OF_SUPPORTED_GPUS]
uint64_t src_mem_range_array
uint32_t device_ids_array_size
uint64_t system_clock_freq
uint64_t gpu_clock_counter
uint64_t cpu_clock_counter
uint32_t event_trigger_data
uint64_t ring_base_address
uint32_t buf_size_in_bytes
uint64_t macro_tile_config_ptr
uint32_t queue_percentage
uint64_t eop_buffer_address
uint64_t ring_base_address
uint64_t dst_mem_array_size
uint64_t device_ids_array_ptr
uint64_t device_ids_array_ptr
uint64_t kfd_event_data_ext
#define NUM_OF_SUPPORTED_GPUS
uint64_t write_pointer_address
uint32_t event_slot_index
uint32_t device_ids_array_size
uint64_t alternate_aperture_size
uint64_t src_mem_array_size
uint32_t queue_percentage
Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17