Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Advanced Micro Devices, Inc. |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included in |
| 12 | * all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | */ |
| 22 | |
| 23 | #ifndef KFD_PRIV_H_INCLUDED |
| 24 | #define KFD_PRIV_H_INCLUDED |
| 25 | |
| 26 | #include <linux/hashtable.h> |
| 27 | #include <linux/mmu_notifier.h> |
| 28 | #include <linux/mutex.h> |
| 29 | #include <linux/types.h> |
| 30 | #include <linux/atomic.h> |
| 31 | #include <linux/workqueue.h> |
| 32 | #include <linux/spinlock.h> |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 33 | #include <linux/kfd_ioctl.h> |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 34 | #include <kgd_kfd_interface.h> |
| 35 | |
Evgeny Pinchuk | 5b5c4e4 | 2014-07-16 21:22:32 +0300 | [diff] [blame] | 36 | #define KFD_SYSFS_FILE_MODE 0444 |
| 37 | |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 38 | #define KFD_MMAP_DOORBELL_MASK 0x8000000000000 |
| 39 | #define KFD_MMAP_EVENTS_MASK 0x4000000000000 |
| 40 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 41 | /* |
| 42 | * When working with cp scheduler we should assign the HIQ manually or via |
| 43 | * the radeon driver to a fixed hqd slot, here are the fixed HIQ hqd slot |
| 44 | * definitions for Kaveri. In Kaveri only the first ME queues participates |
| 45 | * in the cp scheduling taking that in mind we set the HIQ slot in the |
| 46 | * second ME. |
| 47 | */ |
| 48 | #define KFD_CIK_HIQ_PIPE 4 |
| 49 | #define KFD_CIK_HIQ_QUEUE 0 |
| 50 | |
Evgeny Pinchuk | 5b5c4e4 | 2014-07-16 21:22:32 +0300 | [diff] [blame] | 51 | /* GPU ID hash width in bits */ |
| 52 | #define KFD_GPU_ID_HASH_WIDTH 16 |
| 53 | |
| 54 | /* Macro for allocating structures */ |
| 55 | #define kfd_alloc_struct(ptr_to_struct) \ |
| 56 | ((typeof(ptr_to_struct)) kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL)) |
| 57 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 58 | #define KFD_MAX_NUM_OF_PROCESSES 512 |
Oded Gabbay | b8cbab0 | 2015-01-18 13:18:01 +0200 | [diff] [blame] | 59 | #define KFD_MAX_NUM_OF_QUEUES_PER_PROCESS 1024 |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 60 | |
| 61 | /* |
Oded Gabbay | b8cbab0 | 2015-01-18 13:18:01 +0200 | [diff] [blame] | 62 | * Kernel module parameter to specify maximum number of supported queues per |
| 63 | * device |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 64 | */ |
Oded Gabbay | b8cbab0 | 2015-01-18 13:18:01 +0200 | [diff] [blame] | 65 | extern int max_num_of_queues_per_device; |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 66 | |
Oded Gabbay | b8cbab0 | 2015-01-18 13:18:01 +0200 | [diff] [blame] | 67 | #define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT 4096 |
| 68 | #define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE \ |
| 69 | (KFD_MAX_NUM_OF_PROCESSES * \ |
| 70 | KFD_MAX_NUM_OF_QUEUES_PER_PROCESS) |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 71 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 72 | #define KFD_KERNEL_QUEUE_SIZE 2048 |
| 73 | |
Ben Goz | 31c21fe | 2014-07-17 00:48:28 +0300 | [diff] [blame] | 74 | /* Kernel module parameter to specify the scheduling policy */ |
| 75 | extern int sched_policy; |
| 76 | |
Oded Gabbay | 8166301 | 2014-12-24 13:30:52 +0200 | [diff] [blame] | 77 | /* |
| 78 | * Kernel module parameter to specify whether to send sigterm to HSA process on |
| 79 | * unhandled exception |
| 80 | */ |
| 81 | extern int send_sigterm; |
| 82 | |
Ben Goz | 31c21fe | 2014-07-17 00:48:28 +0300 | [diff] [blame] | 83 | /** |
| 84 | * enum kfd_sched_policy |
| 85 | * |
| 86 | * @KFD_SCHED_POLICY_HWS: H/W scheduling policy known as command processor (cp) |
| 87 | * scheduling. In this scheduling mode we're using the firmware code to |
| 88 | * schedule the user mode queues and kernel queues such as HIQ and DIQ. |
| 89 | * the HIQ queue is used as a special queue that dispatches the configuration |
| 90 | * to the cp and the user mode queues list that are currently running. |
| 91 | * the DIQ queue is a debugging queue that dispatches debugging commands to the |
| 92 | * firmware. |
| 93 | * in this scheduling mode user mode queues over subscription feature is |
| 94 | * enabled. |
| 95 | * |
| 96 | * @KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION: The same as above but the over |
| 97 | * subscription feature disabled. |
| 98 | * |
| 99 | * @KFD_SCHED_POLICY_NO_HWS: no H/W scheduling policy is a mode which directly |
| 100 | * set the command processor registers and sets the queues "manually". This |
| 101 | * mode is used *ONLY* for debugging proposes. |
| 102 | * |
| 103 | */ |
| 104 | enum kfd_sched_policy { |
| 105 | KFD_SCHED_POLICY_HWS = 0, |
| 106 | KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION, |
| 107 | KFD_SCHED_POLICY_NO_HWS |
| 108 | }; |
| 109 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 110 | enum cache_policy { |
| 111 | cache_policy_coherent, |
| 112 | cache_policy_noncoherent |
| 113 | }; |
| 114 | |
Ben Goz | 0da7558 | 2015-01-01 17:10:01 +0200 | [diff] [blame] | 115 | enum asic_family_type { |
| 116 | CHIP_KAVERI = 0, |
| 117 | CHIP_CARRIZO |
| 118 | }; |
| 119 | |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 120 | struct kfd_event_interrupt_class { |
| 121 | bool (*interrupt_isr)(struct kfd_dev *dev, |
| 122 | const uint32_t *ih_ring_entry); |
| 123 | void (*interrupt_wq)(struct kfd_dev *dev, |
| 124 | const uint32_t *ih_ring_entry); |
| 125 | }; |
| 126 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 127 | struct kfd_device_info { |
Ben Goz | 0da7558 | 2015-01-01 17:10:01 +0200 | [diff] [blame] | 128 | unsigned int asic_family; |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 129 | const struct kfd_event_interrupt_class *event_interrupt_class; |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 130 | unsigned int max_pasid_bits; |
Yair Shachar | 992839a | 2015-05-20 13:43:04 +0300 | [diff] [blame] | 131 | unsigned int max_no_of_hqd; |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 132 | size_t ih_ring_entry_size; |
Alexey Skidanov | f7c826a | 2014-10-13 16:35:12 +0300 | [diff] [blame] | 133 | uint8_t num_of_watch_points; |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 134 | uint16_t mqd_size_aligned; |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 135 | }; |
| 136 | |
Oded Gabbay | 36b5c08 | 2014-10-26 09:53:10 +0200 | [diff] [blame] | 137 | struct kfd_mem_obj { |
| 138 | uint32_t range_start; |
| 139 | uint32_t range_end; |
| 140 | uint64_t gpu_addr; |
| 141 | uint32_t *cpu_ptr; |
| 142 | }; |
| 143 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 144 | struct kfd_dev { |
| 145 | struct kgd_dev *kgd; |
| 146 | |
| 147 | const struct kfd_device_info *device_info; |
| 148 | struct pci_dev *pdev; |
| 149 | |
| 150 | unsigned int id; /* topology stub index */ |
| 151 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 152 | phys_addr_t doorbell_base; /* Start of actual doorbells used by |
| 153 | * KFD. It is aligned for mapping |
| 154 | * into user mode |
| 155 | */ |
| 156 | size_t doorbell_id_offset; /* Doorbell offset (from KFD doorbell |
| 157 | * to HW doorbell, GFX reserved some |
| 158 | * at the start) |
| 159 | */ |
| 160 | size_t doorbell_process_limit; /* Number of processes we have doorbell |
| 161 | * space for. |
| 162 | */ |
| 163 | u32 __iomem *doorbell_kernel_ptr; /* This is a pointer for a doorbells |
| 164 | * page used by kernel queue |
| 165 | */ |
| 166 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 167 | struct kgd2kfd_shared_resources shared_resources; |
| 168 | |
Xihan Zhang | cea405b | 2015-03-17 19:32:53 +0800 | [diff] [blame] | 169 | const struct kfd2kgd_calls *kfd2kgd; |
| 170 | struct mutex doorbell_mutex; |
Joe Perches | f761d8b | 2015-05-19 18:37:51 -0700 | [diff] [blame] | 171 | DECLARE_BITMAP(doorbell_available_index, |
| 172 | KFD_MAX_NUM_OF_QUEUES_PER_PROCESS); |
Xihan Zhang | cea405b | 2015-03-17 19:32:53 +0800 | [diff] [blame] | 173 | |
Oded Gabbay | 36b5c08 | 2014-10-26 09:53:10 +0200 | [diff] [blame] | 174 | void *gtt_mem; |
| 175 | uint64_t gtt_start_gpu_addr; |
| 176 | void *gtt_start_cpu_ptr; |
| 177 | void *gtt_sa_bitmap; |
| 178 | struct mutex gtt_sa_lock; |
| 179 | unsigned int gtt_sa_chunk_size; |
| 180 | unsigned int gtt_sa_num_of_chunks; |
| 181 | |
Andrew Lewycky | 2249d55 | 2014-07-17 01:37:30 +0300 | [diff] [blame] | 182 | /* Interrupts */ |
| 183 | void *interrupt_ring; |
| 184 | size_t interrupt_ring_size; |
| 185 | atomic_t interrupt_ring_rptr; |
| 186 | atomic_t interrupt_ring_wptr; |
| 187 | struct work_struct interrupt_work; |
| 188 | spinlock_t interrupt_lock; |
| 189 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 190 | /* QCM Device instance */ |
| 191 | struct device_queue_manager *dqm; |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 192 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 193 | bool init_complete; |
Andrew Lewycky | 2249d55 | 2014-07-17 01:37:30 +0300 | [diff] [blame] | 194 | /* |
| 195 | * Interrupts of interest to KFD are copied |
| 196 | * from the HW ring into a SW ring. |
| 197 | */ |
| 198 | bool interrupts_active; |
Yair Shachar | fbeb661 | 2015-05-20 13:48:26 +0300 | [diff] [blame] | 199 | |
| 200 | /* Debug manager */ |
| 201 | struct kfd_dbgmgr *dbgmgr; |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 202 | }; |
| 203 | |
| 204 | /* KGD2KFD callbacks */ |
| 205 | void kgd2kfd_exit(void); |
Xihan Zhang | cea405b | 2015-03-17 19:32:53 +0800 | [diff] [blame] | 206 | struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, |
| 207 | struct pci_dev *pdev, const struct kfd2kgd_calls *f2g); |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 208 | bool kgd2kfd_device_init(struct kfd_dev *kfd, |
Xihan Zhang | cea405b | 2015-03-17 19:32:53 +0800 | [diff] [blame] | 209 | const struct kgd2kfd_shared_resources *gpu_resources); |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 210 | void kgd2kfd_device_exit(struct kfd_dev *kfd); |
| 211 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 212 | enum kfd_mempool { |
| 213 | KFD_MEMPOOL_SYSTEM_CACHEABLE = 1, |
| 214 | KFD_MEMPOOL_SYSTEM_WRITECOMBINE = 2, |
| 215 | KFD_MEMPOOL_FRAMEBUFFER = 3, |
| 216 | }; |
| 217 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 218 | /* Character device interface */ |
| 219 | int kfd_chardev_init(void); |
| 220 | void kfd_chardev_exit(void); |
| 221 | struct device *kfd_chardev(void); |
| 222 | |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 223 | /** |
| 224 | * enum kfd_preempt_type_filter |
| 225 | * |
| 226 | * @KFD_PREEMPT_TYPE_FILTER_SINGLE_QUEUE: Preempts single queue. |
| 227 | * |
| 228 | * @KFD_PRERMPT_TYPE_FILTER_ALL_QUEUES: Preempts all queues in the |
| 229 | * running queues list. |
| 230 | * |
| 231 | * @KFD_PRERMPT_TYPE_FILTER_BY_PASID: Preempts queues that belongs to |
| 232 | * specific process. |
| 233 | * |
| 234 | */ |
| 235 | enum kfd_preempt_type_filter { |
| 236 | KFD_PREEMPT_TYPE_FILTER_SINGLE_QUEUE, |
| 237 | KFD_PREEMPT_TYPE_FILTER_ALL_QUEUES, |
Yair Shachar | 992839a | 2015-05-20 13:43:04 +0300 | [diff] [blame] | 238 | KFD_PREEMPT_TYPE_FILTER_DYNAMIC_QUEUES, |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 239 | KFD_PREEMPT_TYPE_FILTER_BY_PASID |
| 240 | }; |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 241 | |
Ben Goz | 6e99df5 | 2014-07-17 00:36:17 +0300 | [diff] [blame] | 242 | enum kfd_preempt_type { |
| 243 | KFD_PREEMPT_TYPE_WAVEFRONT, |
| 244 | KFD_PREEMPT_TYPE_WAVEFRONT_RESET |
| 245 | }; |
| 246 | |
Ben Goz | ed8aab4 | 2014-07-17 00:18:51 +0300 | [diff] [blame] | 247 | /** |
| 248 | * enum kfd_queue_type |
| 249 | * |
| 250 | * @KFD_QUEUE_TYPE_COMPUTE: Regular user mode queue type. |
| 251 | * |
| 252 | * @KFD_QUEUE_TYPE_SDMA: Sdma user mode queue type. |
| 253 | * |
| 254 | * @KFD_QUEUE_TYPE_HIQ: HIQ queue type. |
| 255 | * |
| 256 | * @KFD_QUEUE_TYPE_DIQ: DIQ queue type. |
| 257 | */ |
| 258 | enum kfd_queue_type { |
| 259 | KFD_QUEUE_TYPE_COMPUTE, |
| 260 | KFD_QUEUE_TYPE_SDMA, |
| 261 | KFD_QUEUE_TYPE_HIQ, |
| 262 | KFD_QUEUE_TYPE_DIQ |
| 263 | }; |
| 264 | |
Ben Goz | 6e99df5 | 2014-07-17 00:36:17 +0300 | [diff] [blame] | 265 | enum kfd_queue_format { |
| 266 | KFD_QUEUE_FORMAT_PM4, |
| 267 | KFD_QUEUE_FORMAT_AQL |
| 268 | }; |
| 269 | |
Ben Goz | ed8aab4 | 2014-07-17 00:18:51 +0300 | [diff] [blame] | 270 | /** |
| 271 | * struct queue_properties |
| 272 | * |
| 273 | * @type: The queue type. |
| 274 | * |
| 275 | * @queue_id: Queue identifier. |
| 276 | * |
| 277 | * @queue_address: Queue ring buffer address. |
| 278 | * |
| 279 | * @queue_size: Queue ring buffer size. |
| 280 | * |
| 281 | * @priority: Defines the queue priority relative to other queues in the |
| 282 | * process. |
| 283 | * This is just an indication and HW scheduling may override the priority as |
| 284 | * necessary while keeping the relative prioritization. |
| 285 | * the priority granularity is from 0 to f which f is the highest priority. |
| 286 | * currently all queues are initialized with the highest priority. |
| 287 | * |
| 288 | * @queue_percent: This field is partially implemented and currently a zero in |
| 289 | * this field defines that the queue is non active. |
| 290 | * |
| 291 | * @read_ptr: User space address which points to the number of dwords the |
| 292 | * cp read from the ring buffer. This field updates automatically by the H/W. |
| 293 | * |
| 294 | * @write_ptr: Defines the number of dwords written to the ring buffer. |
| 295 | * |
| 296 | * @doorbell_ptr: This field aim is to notify the H/W of new packet written to |
| 297 | * the queue ring buffer. This field should be similar to write_ptr and the user |
| 298 | * should update this field after he updated the write_ptr. |
| 299 | * |
| 300 | * @doorbell_off: The doorbell offset in the doorbell pci-bar. |
| 301 | * |
| 302 | * @is_interop: Defines if this is a interop queue. Interop queue means that the |
| 303 | * queue can access both graphics and compute resources. |
| 304 | * |
| 305 | * @is_active: Defines if the queue is active or not. |
| 306 | * |
| 307 | * @vmid: If the scheduling mode is no cp scheduling the field defines the vmid |
| 308 | * of the queue. |
| 309 | * |
| 310 | * This structure represents the queue properties for each queue no matter if |
| 311 | * it's user mode or kernel mode queue. |
| 312 | * |
| 313 | */ |
| 314 | struct queue_properties { |
| 315 | enum kfd_queue_type type; |
Ben Goz | 6e99df5 | 2014-07-17 00:36:17 +0300 | [diff] [blame] | 316 | enum kfd_queue_format format; |
Ben Goz | ed8aab4 | 2014-07-17 00:18:51 +0300 | [diff] [blame] | 317 | unsigned int queue_id; |
| 318 | uint64_t queue_address; |
| 319 | uint64_t queue_size; |
| 320 | uint32_t priority; |
| 321 | uint32_t queue_percent; |
| 322 | uint32_t *read_ptr; |
| 323 | uint32_t *write_ptr; |
Oded Gabbay | 5cd78de | 2014-11-20 16:14:56 +0200 | [diff] [blame] | 324 | uint32_t __iomem *doorbell_ptr; |
Ben Goz | ed8aab4 | 2014-07-17 00:18:51 +0300 | [diff] [blame] | 325 | uint32_t doorbell_off; |
| 326 | bool is_interop; |
| 327 | bool is_active; |
| 328 | /* Not relevant for user mode queues in cp scheduling */ |
| 329 | unsigned int vmid; |
Ben Goz | 77669eb | 2015-01-03 22:12:31 +0200 | [diff] [blame] | 330 | /* Relevant only for sdma queues*/ |
| 331 | uint32_t sdma_engine_id; |
| 332 | uint32_t sdma_queue_id; |
| 333 | uint32_t sdma_vm_addr; |
Ben Goz | ff3d04a | 2015-01-04 10:37:18 +0200 | [diff] [blame] | 334 | /* Relevant only for VI */ |
| 335 | uint64_t eop_ring_buffer_address; |
| 336 | uint32_t eop_ring_buffer_size; |
| 337 | uint64_t ctx_save_restore_area_address; |
| 338 | uint32_t ctx_save_restore_area_size; |
Ben Goz | ed8aab4 | 2014-07-17 00:18:51 +0300 | [diff] [blame] | 339 | }; |
| 340 | |
| 341 | /** |
| 342 | * struct queue |
| 343 | * |
| 344 | * @list: Queue linked list. |
| 345 | * |
| 346 | * @mqd: The queue MQD. |
| 347 | * |
| 348 | * @mqd_mem_obj: The MQD local gpu memory object. |
| 349 | * |
| 350 | * @gart_mqd_addr: The MQD gart mc address. |
| 351 | * |
| 352 | * @properties: The queue properties. |
| 353 | * |
| 354 | * @mec: Used only in no cp scheduling mode and identifies to micro engine id |
| 355 | * that the queue should be execute on. |
| 356 | * |
| 357 | * @pipe: Used only in no cp scheduling mode and identifies the queue's pipe id. |
| 358 | * |
| 359 | * @queue: Used only in no cp scheduliong mode and identifies the queue's slot. |
| 360 | * |
| 361 | * @process: The kfd process that created this queue. |
| 362 | * |
| 363 | * @device: The kfd device that created this queue. |
| 364 | * |
| 365 | * This structure represents user mode compute queues. |
| 366 | * It contains all the necessary data to handle such queues. |
| 367 | * |
| 368 | */ |
| 369 | |
| 370 | struct queue { |
| 371 | struct list_head list; |
| 372 | void *mqd; |
| 373 | struct kfd_mem_obj *mqd_mem_obj; |
| 374 | uint64_t gart_mqd_addr; |
| 375 | struct queue_properties properties; |
| 376 | |
| 377 | uint32_t mec; |
| 378 | uint32_t pipe; |
| 379 | uint32_t queue; |
| 380 | |
Ben Goz | 77669eb | 2015-01-03 22:12:31 +0200 | [diff] [blame] | 381 | unsigned int sdma_id; |
| 382 | |
Ben Goz | ed8aab4 | 2014-07-17 00:18:51 +0300 | [diff] [blame] | 383 | struct kfd_process *process; |
| 384 | struct kfd_dev *device; |
| 385 | }; |
| 386 | |
Ben Goz | 6e99df5 | 2014-07-17 00:36:17 +0300 | [diff] [blame] | 387 | /* |
| 388 | * Please read the kfd_mqd_manager.h description. |
| 389 | */ |
| 390 | enum KFD_MQD_TYPE { |
Ben Goz | 85d258f | 2015-01-04 10:36:30 +0200 | [diff] [blame] | 391 | KFD_MQD_TYPE_COMPUTE = 0, /* for no cp scheduling */ |
| 392 | KFD_MQD_TYPE_HIQ, /* for hiq */ |
| 393 | KFD_MQD_TYPE_CP, /* for cp queues and diq */ |
| 394 | KFD_MQD_TYPE_SDMA, /* for sdma queues */ |
Ben Goz | 6e99df5 | 2014-07-17 00:36:17 +0300 | [diff] [blame] | 395 | KFD_MQD_TYPE_MAX |
| 396 | }; |
| 397 | |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 398 | struct scheduling_resources { |
| 399 | unsigned int vmid_mask; |
| 400 | enum kfd_queue_type type; |
| 401 | uint64_t queue_mask; |
| 402 | uint64_t gws_mask; |
| 403 | uint32_t oac_mask; |
| 404 | uint32_t gds_heap_base; |
| 405 | uint32_t gds_heap_size; |
| 406 | }; |
| 407 | |
| 408 | struct process_queue_manager { |
| 409 | /* data */ |
| 410 | struct kfd_process *process; |
| 411 | unsigned int num_concurrent_processes; |
| 412 | struct list_head queues; |
| 413 | unsigned long *queue_slot_bitmap; |
| 414 | }; |
| 415 | |
| 416 | struct qcm_process_device { |
| 417 | /* The Device Queue Manager that owns this data */ |
| 418 | struct device_queue_manager *dqm; |
| 419 | struct process_queue_manager *pqm; |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 420 | /* Queues list */ |
| 421 | struct list_head queues_list; |
| 422 | struct list_head priv_queue_list; |
| 423 | |
| 424 | unsigned int queue_count; |
| 425 | unsigned int vmid; |
| 426 | bool is_debug; |
| 427 | /* |
| 428 | * All the memory management data should be here too |
| 429 | */ |
| 430 | uint64_t gds_context_area; |
| 431 | uint32_t sh_mem_config; |
| 432 | uint32_t sh_mem_bases; |
| 433 | uint32_t sh_mem_ape1_base; |
| 434 | uint32_t sh_mem_ape1_limit; |
| 435 | uint32_t page_table_base; |
| 436 | uint32_t gds_size; |
| 437 | uint32_t num_gws; |
| 438 | uint32_t num_oac; |
| 439 | }; |
| 440 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 441 | /* Data that is per-process-per device. */ |
| 442 | struct kfd_process_device { |
| 443 | /* |
| 444 | * List of all per-device data for a process. |
| 445 | * Starts from kfd_process.per_device_data. |
| 446 | */ |
| 447 | struct list_head per_device_list; |
| 448 | |
| 449 | /* The device that owns this data. */ |
| 450 | struct kfd_dev *dev; |
| 451 | |
| 452 | |
Ben Goz | 4510204 | 2014-07-17 01:04:10 +0300 | [diff] [blame] | 453 | /* per-process-per device QCM data structure */ |
| 454 | struct qcm_process_device qpd; |
| 455 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 456 | /*Apertures*/ |
| 457 | uint64_t lds_base; |
| 458 | uint64_t lds_limit; |
| 459 | uint64_t gpuvm_base; |
| 460 | uint64_t gpuvm_limit; |
| 461 | uint64_t scratch_base; |
| 462 | uint64_t scratch_limit; |
| 463 | |
| 464 | /* Is this process/pasid bound to this device? (amd_iommu_bind_pasid) */ |
| 465 | bool bound; |
Ben Goz | a82918f | 2015-03-25 13:12:20 +0200 | [diff] [blame] | 466 | |
| 467 | /* This flag tells if we should reset all |
| 468 | * wavefronts on process termination |
| 469 | */ |
| 470 | bool reset_wavefronts; |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 471 | }; |
| 472 | |
Alexey Skidanov | 52a5fdc | 2014-11-19 17:07:00 +0200 | [diff] [blame] | 473 | #define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd) |
| 474 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 475 | /* Process data */ |
| 476 | struct kfd_process { |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 477 | /* |
| 478 | * kfd_process are stored in an mm_struct*->kfd_process* |
| 479 | * hash table (kfd_processes in kfd_process.c) |
| 480 | */ |
| 481 | struct hlist_node kfd_processes; |
| 482 | |
| 483 | struct mm_struct *mm; |
| 484 | |
| 485 | struct mutex mutex; |
| 486 | |
| 487 | /* |
| 488 | * In any process, the thread that started main() is the lead |
| 489 | * thread and outlives the rest. |
| 490 | * It is here because amd_iommu_bind_pasid wants a task_struct. |
| 491 | */ |
| 492 | struct task_struct *lead_thread; |
| 493 | |
| 494 | /* We want to receive a notification when the mm_struct is destroyed */ |
| 495 | struct mmu_notifier mmu_notifier; |
| 496 | |
| 497 | /* Use for delayed freeing of kfd_process structure */ |
| 498 | struct rcu_head rcu; |
| 499 | |
| 500 | unsigned int pasid; |
| 501 | |
| 502 | /* |
| 503 | * List of kfd_process_device structures, |
| 504 | * one for each device the process is using. |
| 505 | */ |
| 506 | struct list_head per_device_data; |
| 507 | |
Ben Goz | 4510204 | 2014-07-17 01:04:10 +0300 | [diff] [blame] | 508 | struct process_queue_manager pqm; |
| 509 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 510 | /* The process's queues. */ |
| 511 | size_t queue_array_size; |
| 512 | |
| 513 | /* Size is queue_array_size, up to MAX_PROCESS_QUEUES. */ |
| 514 | struct kfd_queue **queues; |
| 515 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 516 | /*Is the user space process 32 bit?*/ |
| 517 | bool is_32bit_user_mode; |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 518 | |
| 519 | /* Event-related data */ |
| 520 | struct mutex event_mutex; |
| 521 | /* All events in process hashed by ID, linked on kfd_event.events. */ |
| 522 | DECLARE_HASHTABLE(events, 4); |
| 523 | struct list_head signal_event_pages; /* struct slot_page_header. |
| 524 | event_pages */ |
| 525 | u32 next_nonsignal_event_id; |
| 526 | size_t signal_event_count; |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 527 | }; |
| 528 | |
Oded Gabbay | 76baee6 | 2014-12-29 14:20:05 +0200 | [diff] [blame] | 529 | /** |
| 530 | * Ioctl function type. |
| 531 | * |
| 532 | * \param filep pointer to file structure. |
| 533 | * \param p amdkfd process pointer. |
| 534 | * \param data pointer to arg that was copied from user. |
| 535 | */ |
| 536 | typedef int amdkfd_ioctl_t(struct file *filep, struct kfd_process *p, |
| 537 | void *data); |
| 538 | |
| 539 | struct amdkfd_ioctl_desc { |
| 540 | unsigned int cmd; |
| 541 | int flags; |
| 542 | amdkfd_ioctl_t *func; |
| 543 | unsigned int cmd_drv; |
| 544 | const char *name; |
| 545 | }; |
| 546 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 547 | void kfd_process_create_wq(void); |
| 548 | void kfd_process_destroy_wq(void); |
| 549 | struct kfd_process *kfd_create_process(const struct task_struct *); |
| 550 | struct kfd_process *kfd_get_process(const struct task_struct *); |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 551 | struct kfd_process *kfd_lookup_process_by_pasid(unsigned int pasid); |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 552 | |
Ben Goz | 64c7f8c | 2014-07-17 01:27:00 +0300 | [diff] [blame] | 553 | struct kfd_process_device *kfd_bind_process_to_device(struct kfd_dev *dev, |
| 554 | struct kfd_process *p); |
Oded Gabbay | b17f068 | 2014-07-17 00:06:27 +0300 | [diff] [blame] | 555 | void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid); |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 556 | struct kfd_process_device *kfd_get_process_device_data(struct kfd_dev *dev, |
Alexey Skidanov | 093c7d8 | 2014-11-18 14:00:04 +0200 | [diff] [blame] | 557 | struct kfd_process *p); |
| 558 | struct kfd_process_device *kfd_create_process_device_data(struct kfd_dev *dev, |
| 559 | struct kfd_process *p); |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 560 | |
Alexey Skidanov | 775921e | 2014-07-17 01:49:36 +0300 | [diff] [blame] | 561 | /* Process device data iterator */ |
| 562 | struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p); |
| 563 | struct kfd_process_device *kfd_get_next_process_device_data(struct kfd_process *p, |
| 564 | struct kfd_process_device *pdd); |
| 565 | bool kfd_has_process_device_data(struct kfd_process *p); |
| 566 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 567 | /* PASIDs */ |
| 568 | int kfd_pasid_init(void); |
| 569 | void kfd_pasid_exit(void); |
| 570 | bool kfd_set_pasid_limit(unsigned int new_limit); |
| 571 | unsigned int kfd_get_pasid_limit(void); |
| 572 | unsigned int kfd_pasid_alloc(void); |
| 573 | void kfd_pasid_free(unsigned int pasid); |
| 574 | |
| 575 | /* Doorbells */ |
| 576 | void kfd_doorbell_init(struct kfd_dev *kfd); |
| 577 | int kfd_doorbell_mmap(struct kfd_process *process, struct vm_area_struct *vma); |
| 578 | u32 __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd, |
| 579 | unsigned int *doorbell_off); |
| 580 | void kfd_release_kernel_doorbell(struct kfd_dev *kfd, u32 __iomem *db_addr); |
| 581 | u32 read_kernel_doorbell(u32 __iomem *db); |
| 582 | void write_kernel_doorbell(u32 __iomem *db, u32 value); |
| 583 | unsigned int kfd_queue_id_to_doorbell(struct kfd_dev *kfd, |
| 584 | struct kfd_process *process, |
| 585 | unsigned int queue_id); |
| 586 | |
Oded Gabbay | 6e81090 | 2014-10-27 14:36:07 +0200 | [diff] [blame] | 587 | /* GTT Sub-Allocator */ |
| 588 | |
| 589 | int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size, |
| 590 | struct kfd_mem_obj **mem_obj); |
| 591 | |
| 592 | int kfd_gtt_sa_free(struct kfd_dev *kfd, struct kfd_mem_obj *mem_obj); |
| 593 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 594 | extern struct device *kfd_device; |
| 595 | |
Evgeny Pinchuk | 5b5c4e4 | 2014-07-16 21:22:32 +0300 | [diff] [blame] | 596 | /* Topology */ |
| 597 | int kfd_topology_init(void); |
| 598 | void kfd_topology_shutdown(void); |
| 599 | int kfd_topology_add_device(struct kfd_dev *gpu); |
| 600 | int kfd_topology_remove_device(struct kfd_dev *gpu); |
| 601 | struct kfd_dev *kfd_device_by_id(uint32_t gpu_id); |
| 602 | struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev); |
| 603 | struct kfd_dev *kfd_topology_enum_kfd_devices(uint8_t idx); |
| 604 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 605 | /* Interrupts */ |
Andrew Lewycky | 2249d55 | 2014-07-17 01:37:30 +0300 | [diff] [blame] | 606 | int kfd_interrupt_init(struct kfd_dev *dev); |
| 607 | void kfd_interrupt_exit(struct kfd_dev *dev); |
Andrew Lewycky | b3f5e6b | 2014-07-17 01:37:30 +0300 | [diff] [blame] | 608 | void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry); |
Andrew Lewycky | 2249d55 | 2014-07-17 01:37:30 +0300 | [diff] [blame] | 609 | bool enqueue_ih_ring_entry(struct kfd_dev *kfd, const void *ih_ring_entry); |
| 610 | bool interrupt_is_wanted(struct kfd_dev *dev, const uint32_t *ih_ring_entry); |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 611 | |
| 612 | /* Power Management */ |
Andrew Lewycky | b3f5e6b | 2014-07-17 01:37:30 +0300 | [diff] [blame] | 613 | void kgd2kfd_suspend(struct kfd_dev *kfd); |
| 614 | int kgd2kfd_resume(struct kfd_dev *kfd); |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 615 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 616 | /* amdkfd Apertures */ |
| 617 | int kfd_init_apertures(struct kfd_process *process); |
| 618 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 619 | /* Queue Context Management */ |
Ben Goz | 77669eb | 2015-01-03 22:12:31 +0200 | [diff] [blame] | 620 | struct cik_sdma_rlc_registers *get_sdma_mqd(void *mqd); |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 621 | |
Edward O'Callaghan | e88a614 | 2016-09-17 15:01:45 +1000 | [diff] [blame] | 622 | int init_queue(struct queue **q, const struct queue_properties *properties); |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 623 | void uninit_queue(struct queue *q); |
Ben Goz | 4510204 | 2014-07-17 01:04:10 +0300 | [diff] [blame] | 624 | void print_queue_properties(struct queue_properties *q); |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 625 | void print_queue(struct queue *q); |
| 626 | |
Ben Goz | 64c7f8c | 2014-07-17 01:27:00 +0300 | [diff] [blame] | 627 | struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type, |
| 628 | struct kfd_dev *dev); |
Ben Goz | 4b8f589 | 2015-01-04 11:24:25 +0200 | [diff] [blame] | 629 | struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type, |
| 630 | struct kfd_dev *dev); |
| 631 | struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type, |
| 632 | struct kfd_dev *dev); |
Ben Goz | 64c7f8c | 2014-07-17 01:27:00 +0300 | [diff] [blame] | 633 | struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev); |
| 634 | void device_queue_manager_uninit(struct device_queue_manager *dqm); |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 635 | struct kernel_queue *kernel_queue_init(struct kfd_dev *dev, |
| 636 | enum kfd_queue_type type); |
| 637 | void kernel_queue_uninit(struct kernel_queue *kq); |
| 638 | |
Ben Goz | 4510204 | 2014-07-17 01:04:10 +0300 | [diff] [blame] | 639 | /* Process Queue Manager */ |
| 640 | struct process_queue_node { |
| 641 | struct queue *q; |
| 642 | struct kernel_queue *kq; |
| 643 | struct list_head process_queue_list; |
| 644 | }; |
| 645 | |
| 646 | int pqm_init(struct process_queue_manager *pqm, struct kfd_process *p); |
| 647 | void pqm_uninit(struct process_queue_manager *pqm); |
| 648 | int pqm_create_queue(struct process_queue_manager *pqm, |
| 649 | struct kfd_dev *dev, |
| 650 | struct file *f, |
| 651 | struct queue_properties *properties, |
| 652 | unsigned int flags, |
| 653 | enum kfd_queue_type type, |
| 654 | unsigned int *qid); |
| 655 | int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid); |
| 656 | int pqm_update_queue(struct process_queue_manager *pqm, unsigned int qid, |
| 657 | struct queue_properties *p); |
Yair Shachar | fbeb661 | 2015-05-20 13:48:26 +0300 | [diff] [blame] | 658 | struct kernel_queue *pqm_get_kernel_queue(struct process_queue_manager *pqm, |
| 659 | unsigned int qid); |
Ben Goz | 4510204 | 2014-07-17 01:04:10 +0300 | [diff] [blame] | 660 | |
Yair Shachar | 788bf83 | 2015-05-20 13:58:12 +0300 | [diff] [blame] | 661 | int amdkfd_fence_wait_timeout(unsigned int *fence_addr, |
| 662 | unsigned int fence_value, |
| 663 | unsigned long timeout); |
| 664 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 665 | /* Packet Manager */ |
| 666 | |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 667 | #define KFD_HIQ_TIMEOUT (500) |
| 668 | |
Ben Goz | 64c7f8c | 2014-07-17 01:27:00 +0300 | [diff] [blame] | 669 | #define KFD_FENCE_COMPLETED (100) |
| 670 | #define KFD_FENCE_INIT (10) |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 671 | #define KFD_UNMAP_LATENCY (150) |
| 672 | |
Ben Goz | ed6e6a3 | 2014-07-17 00:45:35 +0300 | [diff] [blame] | 673 | struct packet_manager { |
| 674 | struct device_queue_manager *dqm; |
| 675 | struct kernel_queue *priv_queue; |
| 676 | struct mutex lock; |
| 677 | bool allocated; |
| 678 | struct kfd_mem_obj *ib_buffer_obj; |
| 679 | }; |
| 680 | |
Ben Goz | 64c7f8c | 2014-07-17 01:27:00 +0300 | [diff] [blame] | 681 | int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm); |
| 682 | void pm_uninit(struct packet_manager *pm); |
| 683 | int pm_send_set_resources(struct packet_manager *pm, |
| 684 | struct scheduling_resources *res); |
| 685 | int pm_send_runlist(struct packet_manager *pm, struct list_head *dqm_queues); |
| 686 | int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address, |
| 687 | uint32_t fence_value); |
| 688 | |
| 689 | int pm_send_unmap_queue(struct packet_manager *pm, enum kfd_queue_type type, |
| 690 | enum kfd_preempt_type_filter mode, |
| 691 | uint32_t filter_param, bool reset, |
| 692 | unsigned int sdma_engine); |
| 693 | |
Ben Goz | 241f24f | 2014-07-17 00:55:28 +0300 | [diff] [blame] | 694 | void pm_release_ib(struct packet_manager *pm); |
| 695 | |
Oded Gabbay | 19f6d2a | 2014-07-16 23:25:31 +0300 | [diff] [blame] | 696 | uint64_t kfd_get_number_elems(struct kfd_dev *kfd); |
| 697 | phys_addr_t kfd_get_process_doorbells(struct kfd_dev *dev, |
| 698 | struct kfd_process *process); |
| 699 | |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 700 | /* Events */ |
| 701 | extern const struct kfd_event_interrupt_class event_interrupt_class_cik; |
Alexey Skidanov | 930c5ff | 2014-11-25 10:34:31 +0200 | [diff] [blame] | 702 | extern const struct kfd_device_global_init_class device_global_init_class_cik; |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 703 | |
| 704 | enum kfd_event_wait_result { |
| 705 | KFD_WAIT_COMPLETE, |
| 706 | KFD_WAIT_TIMEOUT, |
| 707 | KFD_WAIT_ERROR |
| 708 | }; |
| 709 | |
| 710 | void kfd_event_init_process(struct kfd_process *p); |
| 711 | void kfd_event_free_process(struct kfd_process *p); |
| 712 | int kfd_event_mmap(struct kfd_process *process, struct vm_area_struct *vma); |
| 713 | int kfd_wait_on_events(struct kfd_process *p, |
Alexey Skidanov | 59d3e8b | 2015-04-14 18:05:49 +0300 | [diff] [blame] | 714 | uint32_t num_events, void __user *data, |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 715 | bool all, uint32_t user_timeout_ms, |
| 716 | enum kfd_event_wait_result *wait_result); |
| 717 | void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id, |
| 718 | uint32_t valid_id_bits); |
Alexey Skidanov | 59d3e8b | 2015-04-14 18:05:49 +0300 | [diff] [blame] | 719 | void kfd_signal_iommu_event(struct kfd_dev *dev, |
| 720 | unsigned int pasid, unsigned long address, |
| 721 | bool is_write_requested, bool is_execute_requested); |
Alexey Skidanov | 930c5ff | 2014-11-25 10:34:31 +0200 | [diff] [blame] | 722 | void kfd_signal_hw_exception_event(unsigned int pasid); |
Andrew Lewycky | f3a3981 | 2015-05-10 12:15:46 +0300 | [diff] [blame] | 723 | int kfd_set_event(struct kfd_process *p, uint32_t event_id); |
| 724 | int kfd_reset_event(struct kfd_process *p, uint32_t event_id); |
| 725 | int kfd_event_create(struct file *devkfd, struct kfd_process *p, |
| 726 | uint32_t event_type, bool auto_reset, uint32_t node_id, |
| 727 | uint32_t *event_id, uint32_t *event_trigger_data, |
| 728 | uint64_t *event_page_offset, uint32_t *event_slot_index); |
| 729 | int kfd_event_destroy(struct kfd_process *p, uint32_t event_id); |
| 730 | |
Ben Goz | c3447e8 | 2015-05-20 18:05:44 +0300 | [diff] [blame] | 731 | int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p); |
| 732 | |
Oded Gabbay | 4a488a7 | 2014-07-16 21:08:55 +0300 | [diff] [blame] | 733 | #endif |