Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef KFD_IOCTL_H_INCLUDED |
| 20 | #define KFD_IOCTL_H_INCLUDED |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 21 | #include <drm/drm.h> |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 22 | #include <linux/ioctl.h> |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 23 | #define KFD_IOCTL_MAJOR_VERSION 1 |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame^] | 24 | #define KFD_IOCTL_MINOR_VERSION 4 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 25 | struct kfd_ioctl_get_version_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 26 | __u32 major_version; |
| 27 | __u32 minor_version; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 28 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 29 | #define KFD_IOC_QUEUE_TYPE_COMPUTE 0x0 |
| 30 | #define KFD_IOC_QUEUE_TYPE_SDMA 0x1 |
| 31 | #define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 0x2 |
| 32 | #define KFD_IOC_QUEUE_TYPE_SDMA_XGMI 0x3 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 33 | #define KFD_MAX_QUEUE_PERCENTAGE 100 |
| 34 | #define KFD_MAX_QUEUE_PRIORITY 15 |
| 35 | struct kfd_ioctl_create_queue_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 36 | __u64 ring_base_address; |
| 37 | __u64 write_pointer_address; |
| 38 | __u64 read_pointer_address; |
| 39 | __u64 doorbell_offset; |
| 40 | __u32 ring_size; |
| 41 | __u32 gpu_id; |
| 42 | __u32 queue_type; |
| 43 | __u32 queue_percentage; |
| 44 | __u32 queue_priority; |
| 45 | __u32 queue_id; |
| 46 | __u64 eop_buffer_address; |
| 47 | __u64 eop_buffer_size; |
| 48 | __u64 ctx_save_restore_address; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 49 | __u32 ctx_save_restore_size; |
| 50 | __u32 ctl_stack_size; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 51 | }; |
| 52 | struct kfd_ioctl_destroy_queue_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 53 | __u32 queue_id; |
| 54 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 55 | }; |
| 56 | struct kfd_ioctl_update_queue_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 57 | __u64 ring_base_address; |
| 58 | __u32 queue_id; |
| 59 | __u32 ring_size; |
| 60 | __u32 queue_percentage; |
| 61 | __u32 queue_priority; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 62 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 63 | struct kfd_ioctl_set_cu_mask_args { |
| 64 | __u32 queue_id; |
| 65 | __u32 num_cu_mask; |
| 66 | __u64 cu_mask_ptr; |
| 67 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 68 | struct kfd_ioctl_get_queue_wave_state_args { |
| 69 | __u64 ctl_stack_address; |
| 70 | __u32 ctl_stack_used_size; |
| 71 | __u32 save_area_used_size; |
| 72 | __u32 queue_id; |
| 73 | __u32 pad; |
| 74 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 75 | #define KFD_IOC_CACHE_POLICY_COHERENT 0 |
| 76 | #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 77 | struct kfd_ioctl_set_memory_policy_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 78 | __u64 alternate_aperture_base; |
| 79 | __u64 alternate_aperture_size; |
| 80 | __u32 gpu_id; |
| 81 | __u32 default_policy; |
| 82 | __u32 alternate_policy; |
| 83 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 84 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 85 | struct kfd_ioctl_get_clock_counters_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 86 | __u64 gpu_clock_counter; |
| 87 | __u64 cpu_clock_counter; |
| 88 | __u64 system_clock_counter; |
| 89 | __u64 system_clock_freq; |
| 90 | __u32 gpu_id; |
| 91 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 92 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 93 | struct kfd_process_device_apertures { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 94 | __u64 lds_base; |
| 95 | __u64 lds_limit; |
| 96 | __u64 scratch_base; |
| 97 | __u64 scratch_limit; |
| 98 | __u64 gpuvm_base; |
| 99 | __u64 gpuvm_limit; |
| 100 | __u32 gpu_id; |
| 101 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 102 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 103 | #define NUM_OF_SUPPORTED_GPUS 7 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 104 | struct kfd_ioctl_get_process_apertures_args { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 105 | struct kfd_process_device_apertures process_apertures[NUM_OF_SUPPORTED_GPUS]; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 106 | __u32 num_of_nodes; |
| 107 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 108 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 109 | struct kfd_ioctl_get_process_apertures_new_args { |
| 110 | __u64 kfd_process_device_apertures_ptr; |
| 111 | __u32 num_of_nodes; |
| 112 | __u32 pad; |
| 113 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 114 | #define MAX_ALLOWED_NUM_POINTS 100 |
| 115 | #define MAX_ALLOWED_AW_BUFF_SIZE 4096 |
| 116 | #define MAX_ALLOWED_WAC_BUFF_SIZE 128 |
| 117 | struct kfd_ioctl_dbg_register_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 118 | __u32 gpu_id; |
| 119 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 120 | }; |
| 121 | struct kfd_ioctl_dbg_unregister_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 122 | __u32 gpu_id; |
| 123 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 124 | }; |
| 125 | struct kfd_ioctl_dbg_address_watch_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 126 | __u64 content_ptr; |
| 127 | __u32 gpu_id; |
| 128 | __u32 buf_size_in_bytes; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 129 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 130 | struct kfd_ioctl_dbg_wave_control_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 131 | __u64 content_ptr; |
| 132 | __u32 gpu_id; |
| 133 | __u32 buf_size_in_bytes; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 134 | }; |
| 135 | #define KFD_IOC_EVENT_SIGNAL 0 |
| 136 | #define KFD_IOC_EVENT_NODECHANGE 1 |
| 137 | #define KFD_IOC_EVENT_DEVICESTATECHANGE 2 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 138 | #define KFD_IOC_EVENT_HW_EXCEPTION 3 |
| 139 | #define KFD_IOC_EVENT_SYSTEM_EVENT 4 |
| 140 | #define KFD_IOC_EVENT_DEBUG_EVENT 5 |
| 141 | #define KFD_IOC_EVENT_PROFILE_EVENT 6 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 142 | #define KFD_IOC_EVENT_QUEUE_EVENT 7 |
| 143 | #define KFD_IOC_EVENT_MEMORY 8 |
| 144 | #define KFD_IOC_WAIT_RESULT_COMPLETE 0 |
| 145 | #define KFD_IOC_WAIT_RESULT_TIMEOUT 1 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 146 | #define KFD_IOC_WAIT_RESULT_FAIL 2 |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 147 | #define KFD_SIGNAL_EVENT_LIMIT 4096 |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 148 | #define KFD_HW_EXCEPTION_WHOLE_GPU_RESET 0 |
| 149 | #define KFD_HW_EXCEPTION_PER_ENGINE_RESET 1 |
| 150 | #define KFD_HW_EXCEPTION_GPU_HANG 0 |
| 151 | #define KFD_HW_EXCEPTION_ECC 1 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 152 | #define KFD_MEM_ERR_NO_RAS 0 |
| 153 | #define KFD_MEM_ERR_SRAM_ECC 1 |
| 154 | #define KFD_MEM_ERR_POISON_CONSUMED 2 |
| 155 | #define KFD_MEM_ERR_GPU_HANG 3 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 156 | struct kfd_ioctl_create_event_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 157 | __u64 event_page_offset; |
| 158 | __u32 event_trigger_data; |
| 159 | __u32 event_type; |
| 160 | __u32 auto_reset; |
| 161 | __u32 node_id; |
| 162 | __u32 event_id; |
| 163 | __u32 event_slot_index; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 164 | }; |
| 165 | struct kfd_ioctl_destroy_event_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 166 | __u32 event_id; |
| 167 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 168 | }; |
| 169 | struct kfd_ioctl_set_event_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 170 | __u32 event_id; |
| 171 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 172 | }; |
| 173 | struct kfd_ioctl_reset_event_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 174 | __u32 event_id; |
| 175 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 176 | }; |
| 177 | struct kfd_memory_exception_failure { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 178 | __u32 NotPresent; |
| 179 | __u32 ReadOnly; |
| 180 | __u32 NoExecute; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 181 | __u32 imprecise; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 182 | }; |
| 183 | struct kfd_hsa_memory_exception_data { |
| 184 | struct kfd_memory_exception_failure failure; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 185 | __u64 va; |
| 186 | __u32 gpu_id; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 187 | __u32 ErrorType; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 188 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 189 | struct kfd_hsa_hw_exception_data { |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 190 | __u32 reset_type; |
| 191 | __u32 reset_cause; |
| 192 | __u32 memory_lost; |
| 193 | __u32 gpu_id; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 194 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 195 | struct kfd_event_data { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 196 | union { |
| 197 | struct kfd_hsa_memory_exception_data memory_exception_data; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 198 | struct kfd_hsa_hw_exception_data hw_exception_data; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 199 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 200 | __u64 kfd_event_data_ext; |
| 201 | __u32 event_id; |
| 202 | __u32 pad; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 203 | }; |
| 204 | struct kfd_ioctl_wait_events_args { |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 205 | __u64 events_ptr; |
| 206 | __u32 num_events; |
| 207 | __u32 wait_for_all; |
| 208 | __u32 timeout; |
| 209 | __u32 wait_result; |
| 210 | }; |
| 211 | struct kfd_ioctl_set_scratch_backing_va_args { |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 212 | __u64 va_addr; |
| 213 | __u32 gpu_id; |
| 214 | __u32 pad; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 215 | }; |
| 216 | struct kfd_ioctl_get_tile_config_args { |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 217 | __u64 tile_config_ptr; |
| 218 | __u64 macro_tile_config_ptr; |
| 219 | __u32 num_tile_configs; |
| 220 | __u32 num_macro_tile_configs; |
| 221 | __u32 gpu_id; |
| 222 | __u32 gb_addr_config; |
| 223 | __u32 num_banks; |
| 224 | __u32 num_ranks; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 225 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 226 | struct kfd_ioctl_set_trap_handler_args { |
| 227 | __u64 tba_addr; |
| 228 | __u64 tma_addr; |
| 229 | __u32 gpu_id; |
| 230 | __u32 pad; |
| 231 | }; |
| 232 | struct kfd_ioctl_acquire_vm_args { |
| 233 | __u32 drm_fd; |
| 234 | __u32 gpu_id; |
| 235 | }; |
| 236 | #define KFD_IOC_ALLOC_MEM_FLAGS_VRAM (1 << 0) |
| 237 | #define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1) |
| 238 | #define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2) |
| 239 | #define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3) |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 240 | #define KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP (1 << 4) |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 241 | #define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31) |
| 242 | #define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30) |
| 243 | #define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29) |
| 244 | #define KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE (1 << 28) |
| 245 | #define KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM (1 << 27) |
| 246 | #define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 26) |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame^] | 247 | #define KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED (1 << 25) |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 248 | struct kfd_ioctl_alloc_memory_of_gpu_args { |
| 249 | __u64 va_addr; |
| 250 | __u64 size; |
| 251 | __u64 handle; |
| 252 | __u64 mmap_offset; |
| 253 | __u32 gpu_id; |
| 254 | __u32 flags; |
| 255 | }; |
| 256 | struct kfd_ioctl_free_memory_of_gpu_args { |
| 257 | __u64 handle; |
| 258 | }; |
| 259 | struct kfd_ioctl_map_memory_to_gpu_args { |
| 260 | __u64 handle; |
| 261 | __u64 device_ids_array_ptr; |
| 262 | __u32 n_devices; |
| 263 | __u32 n_success; |
| 264 | }; |
| 265 | struct kfd_ioctl_unmap_memory_from_gpu_args { |
| 266 | __u64 handle; |
| 267 | __u64 device_ids_array_ptr; |
| 268 | __u32 n_devices; |
| 269 | __u32 n_success; |
| 270 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 271 | struct kfd_ioctl_alloc_queue_gws_args { |
| 272 | __u32 queue_id; |
| 273 | __u32 num_gws; |
| 274 | __u32 first_gws; |
| 275 | __u32 pad; |
| 276 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 277 | struct kfd_ioctl_get_dmabuf_info_args { |
| 278 | __u64 size; |
| 279 | __u64 metadata_ptr; |
| 280 | __u32 metadata_size; |
| 281 | __u32 gpu_id; |
| 282 | __u32 flags; |
| 283 | __u32 dmabuf_fd; |
| 284 | }; |
| 285 | struct kfd_ioctl_import_dmabuf_args { |
| 286 | __u64 va_addr; |
| 287 | __u64 handle; |
| 288 | __u32 gpu_id; |
| 289 | __u32 dmabuf_fd; |
| 290 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 291 | enum kfd_smi_event { |
| 292 | KFD_SMI_EVENT_NONE = 0, |
| 293 | KFD_SMI_EVENT_VMFAULT = 1, |
| 294 | KFD_SMI_EVENT_THERMAL_THROTTLE = 2, |
| 295 | KFD_SMI_EVENT_GPU_PRE_RESET = 3, |
| 296 | KFD_SMI_EVENT_GPU_POST_RESET = 4, |
| 297 | }; |
| 298 | #define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1)) |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 299 | struct kfd_ioctl_smi_events_args { |
| 300 | __u32 gpuid; |
| 301 | __u32 anon_fd; |
| 302 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 303 | enum kfd_mmio_remap { |
| 304 | KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL = 0, |
| 305 | KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL = 4, |
| 306 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 307 | #define AMDKFD_IOCTL_BASE 'K' |
| 308 | #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 309 | #define AMDKFD_IOR(nr,type) _IOR(AMDKFD_IOCTL_BASE, nr, type) |
| 310 | #define AMDKFD_IOW(nr,type) _IOW(AMDKFD_IOCTL_BASE, nr, type) |
| 311 | #define AMDKFD_IOWR(nr,type) _IOWR(AMDKFD_IOCTL_BASE, nr, type) |
| 312 | #define AMDKFD_IOC_GET_VERSION AMDKFD_IOR(0x01, struct kfd_ioctl_get_version_args) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 313 | #define AMDKFD_IOC_CREATE_QUEUE AMDKFD_IOWR(0x02, struct kfd_ioctl_create_queue_args) |
| 314 | #define AMDKFD_IOC_DESTROY_QUEUE AMDKFD_IOWR(0x03, struct kfd_ioctl_destroy_queue_args) |
| 315 | #define AMDKFD_IOC_SET_MEMORY_POLICY AMDKFD_IOW(0x04, struct kfd_ioctl_set_memory_policy_args) |
| 316 | #define AMDKFD_IOC_GET_CLOCK_COUNTERS AMDKFD_IOWR(0x05, struct kfd_ioctl_get_clock_counters_args) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 317 | #define AMDKFD_IOC_GET_PROCESS_APERTURES AMDKFD_IOR(0x06, struct kfd_ioctl_get_process_apertures_args) |
| 318 | #define AMDKFD_IOC_UPDATE_QUEUE AMDKFD_IOW(0x07, struct kfd_ioctl_update_queue_args) |
| 319 | #define AMDKFD_IOC_CREATE_EVENT AMDKFD_IOWR(0x08, struct kfd_ioctl_create_event_args) |
| 320 | #define AMDKFD_IOC_DESTROY_EVENT AMDKFD_IOW(0x09, struct kfd_ioctl_destroy_event_args) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 321 | #define AMDKFD_IOC_SET_EVENT AMDKFD_IOW(0x0A, struct kfd_ioctl_set_event_args) |
| 322 | #define AMDKFD_IOC_RESET_EVENT AMDKFD_IOW(0x0B, struct kfd_ioctl_reset_event_args) |
| 323 | #define AMDKFD_IOC_WAIT_EVENTS AMDKFD_IOWR(0x0C, struct kfd_ioctl_wait_events_args) |
| 324 | #define AMDKFD_IOC_DBG_REGISTER AMDKFD_IOW(0x0D, struct kfd_ioctl_dbg_register_args) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 325 | #define AMDKFD_IOC_DBG_UNREGISTER AMDKFD_IOW(0x0E, struct kfd_ioctl_dbg_unregister_args) |
| 326 | #define AMDKFD_IOC_DBG_ADDRESS_WATCH AMDKFD_IOW(0x0F, struct kfd_ioctl_dbg_address_watch_args) |
| 327 | #define AMDKFD_IOC_DBG_WAVE_CONTROL AMDKFD_IOW(0x10, struct kfd_ioctl_dbg_wave_control_args) |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 328 | #define AMDKFD_IOC_SET_SCRATCH_BACKING_VA AMDKFD_IOWR(0x11, struct kfd_ioctl_set_scratch_backing_va_args) |
| 329 | #define AMDKFD_IOC_GET_TILE_CONFIG AMDKFD_IOWR(0x12, struct kfd_ioctl_get_tile_config_args) |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 330 | #define AMDKFD_IOC_SET_TRAP_HANDLER AMDKFD_IOW(0x13, struct kfd_ioctl_set_trap_handler_args) |
| 331 | #define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW AMDKFD_IOWR(0x14, struct kfd_ioctl_get_process_apertures_new_args) |
| 332 | #define AMDKFD_IOC_ACQUIRE_VM AMDKFD_IOW(0x15, struct kfd_ioctl_acquire_vm_args) |
| 333 | #define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU AMDKFD_IOWR(0x16, struct kfd_ioctl_alloc_memory_of_gpu_args) |
| 334 | #define AMDKFD_IOC_FREE_MEMORY_OF_GPU AMDKFD_IOW(0x17, struct kfd_ioctl_free_memory_of_gpu_args) |
| 335 | #define AMDKFD_IOC_MAP_MEMORY_TO_GPU AMDKFD_IOWR(0x18, struct kfd_ioctl_map_memory_to_gpu_args) |
| 336 | #define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU AMDKFD_IOWR(0x19, struct kfd_ioctl_unmap_memory_from_gpu_args) |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 337 | #define AMDKFD_IOC_SET_CU_MASK AMDKFD_IOW(0x1A, struct kfd_ioctl_set_cu_mask_args) |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 338 | #define AMDKFD_IOC_GET_QUEUE_WAVE_STATE AMDKFD_IOWR(0x1B, struct kfd_ioctl_get_queue_wave_state_args) |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 339 | #define AMDKFD_IOC_GET_DMABUF_INFO AMDKFD_IOWR(0x1C, struct kfd_ioctl_get_dmabuf_info_args) |
| 340 | #define AMDKFD_IOC_IMPORT_DMABUF AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 341 | #define AMDKFD_IOC_ALLOC_QUEUE_GWS AMDKFD_IOWR(0x1E, struct kfd_ioctl_alloc_queue_gws_args) |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 342 | #define AMDKFD_IOC_SMI_EVENTS AMDKFD_IOWR(0x1F, struct kfd_ioctl_smi_events_args) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 343 | #define AMDKFD_COMMAND_START 0x01 |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 344 | #define AMDKFD_COMMAND_END 0x20 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 345 | #endif |