23#ifndef KFD_IOCTL_H_INCLUDED
24#define KFD_IOCTL_H_INCLUDED
38#define KFD_IOCTL_MAJOR_VERSION 1
39#define KFD_IOCTL_MINOR_VERSION 3
48#define KFD_IOC_QUEUE_TYPE_COMPUTE 0
49#define KFD_IOC_QUEUE_TYPE_SDMA 1
50#define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2
51#define KFD_IOC_QUEUE_TYPE_SDMA_XGMI 3
53#define KFD_MAX_QUEUE_PERCENTAGE 100
54#define KFD_MAX_QUEUE_PRIORITY 15
110#define KFD_IOC_CACHE_POLICY_COHERENT 0
111#define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
159#define NUM_OF_SUPPORTED_GPUS 7
184#define MAX_ALLOWED_NUM_POINTS 100
185#define MAX_ALLOWED_AW_BUFF_SIZE 4096
186#define MAX_ALLOWED_WAC_BUFF_SIZE 128
215#define KFD_IOC_EVENT_SIGNAL 0
216#define KFD_IOC_EVENT_NODECHANGE 1
217#define KFD_IOC_EVENT_DEVICESTATECHANGE 2
218#define KFD_IOC_EVENT_HW_EXCEPTION 3
219#define KFD_IOC_EVENT_SYSTEM_EVENT 4
220#define KFD_IOC_EVENT_DEBUG_EVENT 5
221#define KFD_IOC_EVENT_PROFILE_EVENT 6
222#define KFD_IOC_EVENT_QUEUE_EVENT 7
223#define KFD_IOC_EVENT_MEMORY 8
225#define KFD_IOC_WAIT_RESULT_COMPLETE 0
226#define KFD_IOC_WAIT_RESULT_TIMEOUT 1
227#define KFD_IOC_WAIT_RESULT_FAIL 2
229#define KFD_SIGNAL_EVENT_LIMIT 4096
232#define KFD_HW_EXCEPTION_WHOLE_GPU_RESET 0
233#define KFD_HW_EXCEPTION_PER_ENGINE_RESET 1
236#define KFD_HW_EXCEPTION_GPU_HANG 0
237#define KFD_HW_EXCEPTION_ECC 1
240#define KFD_MEM_ERR_NO_RAS 0
241#define KFD_MEM_ERR_SRAM_ECC 1
242#define KFD_MEM_ERR_POISON_CONSUMED 2
243#define KFD_MEM_ERR_GPU_HANG 3
376#define KFD_IOC_ALLOC_MEM_FLAGS_VRAM (1 << 0)
377#define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1)
378#define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2)
379#define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3)
380#define KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP (1 << 4)
382#define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31)
383#define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30)
384#define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29)
385#define KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE (1 << 28)
386#define KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM (1 << 27)
387#define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 26)
501#define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
517#define AMDKFD_IOCTL_BASE 'K'
518#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
519#define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
520#define AMDKFD_IOW(nr, type) _IOW(AMDKFD_IOCTL_BASE, nr, type)
521#define AMDKFD_IOWR(nr, type) _IOWR(AMDKFD_IOCTL_BASE, nr, type)
523#define AMDKFD_IOC_GET_VERSION \
524 AMDKFD_IOR(0x01, struct kfd_ioctl_get_version_args)
526#define AMDKFD_IOC_CREATE_QUEUE \
527 AMDKFD_IOWR(0x02, struct kfd_ioctl_create_queue_args)
529#define AMDKFD_IOC_DESTROY_QUEUE \
530 AMDKFD_IOWR(0x03, struct kfd_ioctl_destroy_queue_args)
532#define AMDKFD_IOC_SET_MEMORY_POLICY \
533 AMDKFD_IOW(0x04, struct kfd_ioctl_set_memory_policy_args)
535#define AMDKFD_IOC_GET_CLOCK_COUNTERS \
536 AMDKFD_IOWR(0x05, struct kfd_ioctl_get_clock_counters_args)
538#define AMDKFD_IOC_GET_PROCESS_APERTURES \
539 AMDKFD_IOR(0x06, struct kfd_ioctl_get_process_apertures_args)
541#define AMDKFD_IOC_UPDATE_QUEUE \
542 AMDKFD_IOW(0x07, struct kfd_ioctl_update_queue_args)
544#define AMDKFD_IOC_CREATE_EVENT \
545 AMDKFD_IOWR(0x08, struct kfd_ioctl_create_event_args)
547#define AMDKFD_IOC_DESTROY_EVENT \
548 AMDKFD_IOW(0x09, struct kfd_ioctl_destroy_event_args)
550#define AMDKFD_IOC_SET_EVENT \
551 AMDKFD_IOW(0x0A, struct kfd_ioctl_set_event_args)
553#define AMDKFD_IOC_RESET_EVENT \
554 AMDKFD_IOW(0x0B, struct kfd_ioctl_reset_event_args)
556#define AMDKFD_IOC_WAIT_EVENTS \
557 AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args)
559#define AMDKFD_IOC_DBG_REGISTER \
560 AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args)
562#define AMDKFD_IOC_DBG_UNREGISTER \
563 AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args)
565#define AMDKFD_IOC_DBG_ADDRESS_WATCH \
566 AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args)
568#define AMDKFD_IOC_DBG_WAVE_CONTROL \
569 AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args)
571#define AMDKFD_IOC_SET_SCRATCH_BACKING_VA \
572 AMDKFD_IOWR(0x11, struct kfd_ioctl_set_scratch_backing_va_args)
574#define AMDKFD_IOC_GET_TILE_CONFIG \
575 AMDKFD_IOWR(0x12, struct kfd_ioctl_get_tile_config_args)
577#define AMDKFD_IOC_SET_TRAP_HANDLER \
578 AMDKFD_IOW(0x13, struct kfd_ioctl_set_trap_handler_args)
580#define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW \
582 struct kfd_ioctl_get_process_apertures_new_args)
584#define AMDKFD_IOC_ACQUIRE_VM \
585 AMDKFD_IOW(0x15, struct kfd_ioctl_acquire_vm_args)
587#define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU \
588 AMDKFD_IOWR(0x16, struct kfd_ioctl_alloc_memory_of_gpu_args)
590#define AMDKFD_IOC_FREE_MEMORY_OF_GPU \
591 AMDKFD_IOW(0x17, struct kfd_ioctl_free_memory_of_gpu_args)
593#define AMDKFD_IOC_MAP_MEMORY_TO_GPU \
594 AMDKFD_IOWR(0x18, struct kfd_ioctl_map_memory_to_gpu_args)
596#define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU \
597 AMDKFD_IOWR(0x19, struct kfd_ioctl_unmap_memory_from_gpu_args)
599#define AMDKFD_IOC_SET_CU_MASK \
600 AMDKFD_IOW(0x1A, struct kfd_ioctl_set_cu_mask_args)
602#define AMDKFD_IOC_GET_QUEUE_WAVE_STATE \
603 AMDKFD_IOWR(0x1B, struct kfd_ioctl_get_queue_wave_state_args)
605#define AMDKFD_IOC_GET_DMABUF_INFO \
606 AMDKFD_IOWR(0x1C, struct kfd_ioctl_get_dmabuf_info_args)
608#define AMDKFD_IOC_IMPORT_DMABUF \
609 AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args)
611#define AMDKFD_IOC_ALLOC_QUEUE_GWS \
612 AMDKFD_IOWR(0x1E, struct kfd_ioctl_alloc_queue_gws_args)
614#define AMDKFD_IOC_SMI_EVENTS \
615 AMDKFD_IOWR(0x1F, struct kfd_ioctl_smi_events_args)
617#define AMDKFD_COMMAND_START 0x01
618#define AMDKFD_COMMAND_END 0x20
#define NUM_OF_SUPPORTED_GPUS
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
@ KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL
@ KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL
@ KFD_SMI_EVENT_GPU_PRE_RESET
@ KFD_SMI_EVENT_GPU_POST_RESET
@ KFD_SMI_EVENT_THERMAL_THROTTLE
uint64_t kfd_event_data_ext
struct kfd_hsa_hw_exception_data hw_exception_data
struct kfd_hsa_memory_exception_data memory_exception_data
struct kfd_memory_exception_failure failure
uint32_t event_slot_index
uint32_t event_trigger_data
uint64_t event_page_offset
uint64_t ring_base_address
uint64_t ctx_save_restore_address
uint32_t ctx_save_restore_size
uint32_t queue_percentage
uint64_t read_pointer_address
uint64_t write_pointer_address
uint64_t eop_buffer_address
uint32_t buf_size_in_bytes
uint32_t buf_size_in_bytes
uint64_t gpu_clock_counter
uint64_t system_clock_counter
uint64_t cpu_clock_counter
uint64_t system_clock_freq
struct kfd_process_device_apertures process_apertures[NUM_OF_SUPPORTED_GPUS]
uint64_t kfd_process_device_apertures_ptr
uint32_t ctl_stack_used_size
uint64_t ctl_stack_address
uint32_t save_area_used_size
uint32_t num_macro_tile_configs
uint32_t num_tile_configs
uint64_t macro_tile_config_ptr
uint64_t device_ids_array_ptr
uint64_t alternate_aperture_base
uint32_t alternate_policy
uint64_t alternate_aperture_size
uint64_t device_ids_array_ptr
uint64_t ring_base_address
uint32_t queue_percentage