xref: /linux/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h (revision da2897ee8b811945fd40ecc4aaf03291c14ce61c)
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 /* amdgpu_amdkfd.h defines the private interface between amdgpu and amdkfd. */
24 
25 #ifndef AMDGPU_AMDKFD_H_INCLUDED
26 #define AMDGPU_AMDKFD_H_INCLUDED
27 
28 #include <linux/list.h>
29 #include <linux/types.h>
30 #include <linux/mm.h>
31 #include <linux/kthread.h>
32 #include <linux/workqueue.h>
33 #include <linux/mmu_notifier.h>
34 #include <linux/memremap.h>
35 #include <kgd_kfd_interface.h>
36 #include <drm/drm_client.h>
37 #include "amdgpu_sync.h"
38 #include "amdgpu_vm.h"
39 #include "amdgpu_xcp.h"
40 #include "kfd_topology.h"
41 #include "amdgpu_ptl.h"
42 
43 extern uint64_t amdgpu_amdkfd_total_mem_size;
44 
45 /*
46  * Align VRAM availability to 2MB to avoid fragmentation caused by 4K
47  * allocations in the tail 2MB BO chunk.
48  */
49 #define VRAM_AVAILABLITY_ALIGN (1 << 21)
50 
51 enum TLB_FLUSH_TYPE {
52 	TLB_FLUSH_LEGACY = 0,
53 	TLB_FLUSH_LIGHTWEIGHT,
54 	TLB_FLUSH_HEAVYWEIGHT
55 };
56 
57 struct amdgpu_device;
58 struct kfd_process_device;
59 struct amdgpu_reset_context;
60 
61 enum kfd_mem_attachment_type {
62 	KFD_MEM_ATT_SHARED,	/* Share kgd_mem->bo or another attachment's */
63 	KFD_MEM_ATT_USERPTR,	/* SG bo to DMA map pages from a userptr bo */
64 	KFD_MEM_ATT_DMABUF,	/* DMAbuf to DMA map TTM BOs */
65 	KFD_MEM_ATT_SG		/* Tag to DMA map SG BOs */
66 };
67 
68 struct kfd_mem_attachment {
69 	struct list_head list;
70 	enum kfd_mem_attachment_type type;
71 	bool is_mapped;
72 	struct amdgpu_bo_va *bo_va;
73 	struct amdgpu_device *adev;
74 	uint64_t va;
75 	uint64_t pte_flags;
76 };
77 
78 struct kgd_mem {
79 	struct mutex lock;
80 	struct amdgpu_bo *bo;
81 	struct dma_buf *dmabuf;
82 	struct amdgpu_hmm_range *range;
83 	struct list_head attachments;
84 	/* protected by amdkfd_process_info.lock */
85 	struct list_head validate_list;
86 	uint32_t domain;
87 	unsigned int mapped_to_gpu_memory;
88 	uint64_t va;
89 
90 	uint32_t alloc_flags;
91 
92 	uint32_t invalid;
93 	struct amdkfd_process_info *process_info;
94 
95 	struct amdgpu_sync sync;
96 
97 	uint32_t gem_handle;
98 	bool aql_queue;
99 	bool is_imported;
100 };
101 
102 /* KFD Memory Eviction */
103 struct amdgpu_amdkfd_fence {
104 	struct dma_fence base;
105 	struct mm_struct *mm;
106 	spinlock_t lock;
107 	char timeline_name[TASK_COMM_LEN];
108 	uint16_t context_id;
109 };
110 
111 struct amdgpu_kfd_dev {
112 	struct kfd_dev *dev;
113 	int64_t vram_used[MAX_XCP];
114 	uint64_t vram_used_aligned[MAX_XCP];
115 	atomic64_t vram_pinned[MAX_XCP];
116 	bool init_complete;
117 	struct work_struct reset_work;
118 
119 	/* Client for KFD BO GEM handle allocations */
120 	struct drm_client_dev client;
121 
122 	/* HMM page migration MEMORY_DEVICE_PRIVATE mapping
123 	 * Must be last --ends in a flexible-array member.
124 	 */
125 	struct dev_pagemap pgmap;
126 };
127 
128 enum kgd_engine_type {
129 	KGD_ENGINE_PFP = 1,
130 	KGD_ENGINE_ME,
131 	KGD_ENGINE_CE,
132 	KGD_ENGINE_MEC1,
133 	KGD_ENGINE_MEC2,
134 	KGD_ENGINE_RLC,
135 	KGD_ENGINE_SDMA1,
136 	KGD_ENGINE_SDMA2,
137 	KGD_ENGINE_MAX
138 };
139 
140 
141 struct amdkfd_process_info {
142 	/* List head of all VMs that belong to a KFD process */
143 	struct list_head vm_list_head;
144 	/* List head for all KFD BOs that belong to a KFD process. */
145 	struct list_head kfd_bo_list;
146 	/* List of userptr BOs that are valid or invalid */
147 	struct list_head userptr_valid_list;
148 	struct list_head userptr_inval_list;
149 	/* Lock to protect kfd_bo_list */
150 	struct mutex lock;
151 
152 	/* Number of VMs */
153 	unsigned int n_vms;
154 	/* Eviction Fence */
155 	struct amdgpu_amdkfd_fence *eviction_fence;
156 
157 	/* MMU-notifier related fields */
158 	struct mutex notifier_lock;
159 	uint32_t evicted_bos;
160 	/* kfd context id */
161 	u16 context_id;
162 	struct delayed_work restore_userptr_work;
163 	struct pid *pid;
164 	bool block_mmu_notifications;
165 };
166 
167 int amdgpu_amdkfd_init(void);
168 void amdgpu_amdkfd_fini(void);
169 void amdgpu_amdkfd_teardown_processes(struct amdgpu_device *adev);
170 
171 void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool suspend_proc);
172 int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool resume_proc);
173 void amdgpu_amdkfd_suspend_process(struct amdgpu_device *adev);
174 int amdgpu_amdkfd_resume_process(struct amdgpu_device *adev);
175 void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
176 			const void *ih_ring_entry);
177 void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev);
178 void amdgpu_amdkfd_device_init(struct amdgpu_device *adev);
179 void amdgpu_amdkfd_device_fini_sw(struct amdgpu_device *adev);
180 int amdgpu_amdkfd_prepare_partition_switch(struct amdgpu_device *adev);
181 int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
182 				enum kgd_engine_type engine,
183 				uint32_t vmid, uint64_t gpu_addr,
184 				uint32_t *ib_cmd, uint32_t ib_len);
185 void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle);
186 bool amdgpu_amdkfd_have_atomics_support(struct amdgpu_device *adev);
187 
188 bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid);
189 
190 int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev,
191 			    struct amdgpu_reset_context *reset_context);
192 
193 int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
194 
195 void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev);
196 
197 int amdgpu_queue_mask_bit_to_set_resource_bit(struct amdgpu_device *adev,
198 					int queue_bit);
199 
200 struct amdgpu_amdkfd_fence *amdgpu_amdkfd_fence_create(u64 context,
201 				struct mm_struct *mm,
202 				u16 context_id);
203 
204 int amdgpu_amdkfd_drm_client_create(struct amdgpu_device *adev);
205 #if defined(CONFIG_DEBUG_FS)
206 int kfd_debugfs_kfd_mem_limits(struct seq_file *m, void *data);
207 #endif
208 #if IS_ENABLED(CONFIG_HSA_AMD)
209 bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm);
210 struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f);
211 void amdgpu_amdkfd_remove_all_eviction_fences(struct amdgpu_bo *bo);
212 int amdgpu_amdkfd_evict_userptr(struct mmu_interval_notifier *mni,
213 				unsigned long cur_seq, struct kgd_mem *mem);
214 int amdgpu_amdkfd_bo_validate_and_fence(struct amdgpu_bo *bo,
215 					uint32_t domain,
216 					struct dma_fence *fence);
217 int amdgpu_amdkfd_set_sigbus_delay(struct task_struct *task, u32 ms);
218 #else
219 static inline
220 bool amdkfd_fence_check_mm(struct dma_fence *f, struct mm_struct *mm)
221 {
222 	return false;
223 }
224 
225 static inline
226 struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)
227 {
228 	return NULL;
229 }
230 
231 static inline
232 void amdgpu_amdkfd_remove_all_eviction_fences(struct amdgpu_bo *bo)
233 {
234 }
235 
236 static inline
237 int amdgpu_amdkfd_evict_userptr(struct mmu_interval_notifier *mni,
238 				unsigned long cur_seq, struct kgd_mem *mem)
239 {
240 	return 0;
241 }
242 static inline
243 int amdgpu_amdkfd_bo_validate_and_fence(struct amdgpu_bo *bo,
244 					uint32_t domain,
245 					struct dma_fence *fence)
246 {
247 	return 0;
248 }
249 static inline
250 int amdgpu_amdkfd_set_sigbus_delay(struct task_struct *task, u32 ms)
251 {
252 	return -EOPNOTSUPP;
253 }
254 #endif
255 /* Shared API */
256 int amdgpu_amdkfd_alloc_kernel_mem(struct amdgpu_device *adev, size_t size,
257 				u32 domain, void **mem_obj, uint64_t *gpu_addr,
258 				void **cpu_ptr, bool mqd_gfx9);
259 void amdgpu_amdkfd_free_kernel_mem(struct amdgpu_device *adev, void **mem_obj);
260 int amdgpu_amdkfd_alloc_gws(struct amdgpu_device *adev, size_t size,
261 				void **mem_obj);
262 void amdgpu_amdkfd_free_gws(struct amdgpu_device *adev, void *mem_obj);
263 int amdgpu_amdkfd_add_gws_to_process(void *info, void *gws, struct kgd_mem **mem);
264 int amdgpu_amdkfd_remove_gws_from_process(void *info, void *mem);
265 uint32_t amdgpu_amdkfd_get_fw_version(struct amdgpu_device *adev,
266 				      enum kgd_engine_type type);
267 void amdgpu_amdkfd_get_local_mem_info(struct amdgpu_device *adev,
268 				      struct kfd_local_mem_info *mem_info,
269 				      struct amdgpu_xcp *xcp);
270 uint64_t amdgpu_amdkfd_get_gpu_clock_counter(struct amdgpu_device *adev);
271 
272 uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz(struct amdgpu_device *adev);
273 int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd,
274 				  struct amdgpu_device **dmabuf_adev,
275 				  uint64_t *bo_size, void **metadata_buffer,
276 				  size_t buffer_size, uint32_t *metadata_size,
277 				  uint32_t *flags, int8_t *xcp_id);
278 int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct amdgpu_device *adev, bool is_min);
279 int amdgpu_amdkfd_send_close_event_drain_irq(struct amdgpu_device *adev,
280 					uint32_t *payload);
281 int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off,
282 				u32 inst);
283 int amdgpu_amdkfd_start_sched(struct amdgpu_device *adev, uint32_t node_id);
284 int amdgpu_amdkfd_stop_sched(struct amdgpu_device *adev, uint32_t node_id);
285 int amdgpu_amdkfd_config_sq_perfmon(struct amdgpu_device *adev, uint32_t xcp_id,
286 	bool core_override_enable, bool reg_override_enable, bool perfmon_override_enable);
287 bool amdgpu_amdkfd_compute_active(struct amdgpu_device *adev, uint32_t node_id);
288 int amdgpu_amdkfd_reset_mes_queue(struct amdgpu_device *adev,
289 				  uint32_t node_id,
290 				  int queue_type,
291 				  int pipe, int queue,
292 				  unsigned int db);
293 
294 /* Read user wptr from a specified user address space with page fault
295  * disabled. The memory must be pinned and mapped to the hardware when
296  * this is called in hqd_load functions, so it should never fault in
297  * the first place. This resolves a circular lock dependency involving
298  * four locks, including the DQM lock and mmap_lock.
299  */
300 #define read_user_wptr(mmptr, wptr, dst)				\
301 	({								\
302 		bool valid = false;					\
303 		if ((mmptr) && (wptr)) {				\
304 			pagefault_disable();				\
305 			if ((mmptr) == current->mm) {			\
306 				valid = !get_user((dst), (wptr));	\
307 			} else if (current->flags & PF_KTHREAD) {	\
308 				kthread_use_mm(mmptr);			\
309 				valid = !get_user((dst), (wptr));	\
310 				kthread_unuse_mm(mmptr);		\
311 			}						\
312 			pagefault_enable();				\
313 		}							\
314 		valid;							\
315 	})
316 
317 /* GPUVM API */
318 #define drm_priv_to_vm(drm_priv)					\
319 	(&((struct amdgpu_fpriv *)					\
320 		((struct drm_file *)(drm_priv))->driver_priv)->vm)
321 
322 int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct amdgpu_device *adev,
323 					struct amdgpu_vm *avm,
324 					void **process_info,
325 					struct dma_fence **ef);
326 uint64_t amdgpu_amdkfd_gpuvm_get_process_page_dir(void *drm_priv);
327 size_t amdgpu_amdkfd_get_available_memory(struct amdgpu_device *adev,
328 					uint8_t xcp_id);
329 int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
330 		struct amdgpu_device *adev, uint64_t va, uint64_t size,
331 		void *drm_priv, struct kgd_mem **mem,
332 		uint64_t *offset, uint32_t flags, bool criu_resume);
333 int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
334 		struct amdgpu_device *adev, struct kgd_mem *mem, void *drm_priv,
335 		uint64_t *size);
336 int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(struct amdgpu_device *adev,
337 					  struct kgd_mem *mem, void *drm_priv);
338 int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
339 		struct amdgpu_device *adev, struct kgd_mem *mem, void *drm_priv);
340 int amdgpu_amdkfd_gpuvm_dmaunmap_mem(struct kgd_mem *mem, void *drm_priv);
341 int amdgpu_amdkfd_gpuvm_sync_memory(
342 		struct amdgpu_device *adev, struct kgd_mem *mem, bool intr);
343 int amdgpu_amdkfd_gpuvm_map_bo_to_kernel(struct kgd_mem *mem, void **kptr,
344 					 u64 *size, u32 domain);
345 void amdgpu_amdkfd_gpuvm_unmap_bo_from_kernel(struct kgd_mem *mem);
346 
347 int amdgpu_amdkfd_map_gtt_bo_to_gart(struct amdgpu_bo *bo, struct amdgpu_bo **bo_gart,
348 				     struct amdkfd_process_info *process_info);
349 
350 int amdgpu_amdkfd_gpuvm_restore_process_bos(void *process_info,
351 					    struct dma_fence __rcu **ef);
352 int amdgpu_amdkfd_gpuvm_get_vm_fault_info(struct amdgpu_device *adev,
353 					      struct kfd_vm_fault_info *info);
354 int amdgpu_amdkfd_gpuvm_import_dmabuf_fd(struct amdgpu_device *adev, int fd,
355 					 uint64_t va, void *drm_priv,
356 					 struct kgd_mem **mem, uint64_t *size,
357 					 uint64_t *mmap_offset);
358 int amdgpu_amdkfd_gpuvm_export_dmabuf(struct kgd_mem *mem,
359 				      struct dma_buf **dmabuf);
360 void amdgpu_amdkfd_debug_mem_fence(struct amdgpu_device *adev);
361 int amdgpu_amdkfd_get_tile_config(struct amdgpu_device *adev,
362 				struct tile_config *config);
363 void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev,
364 			enum amdgpu_ras_block block, uint32_t reset);
365 
366 void amdgpu_amdkfd_ras_pasid_poison_consumption_handler(struct amdgpu_device *adev,
367 			enum amdgpu_ras_block block, uint16_t pasid,
368 			pasid_notify pasid_fn, void *data, uint32_t reset);
369 
370 bool amdgpu_amdkfd_is_fed(struct amdgpu_device *adev);
371 bool amdgpu_amdkfd_bo_mapped_to_dev(void *drm_priv, struct kgd_mem *mem);
372 void amdgpu_amdkfd_block_mmu_notifications(void *p);
373 int amdgpu_amdkfd_criu_resume(void *p);
374 int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
375 		uint64_t size, u32 alloc_flag, int8_t xcp_id);
376 void amdgpu_amdkfd_unreserve_mem_limit(struct amdgpu_device *adev,
377 		uint64_t size, u32 alloc_flag, int8_t xcp_id);
378 void amdgpu_amdkfd_clear_kfd_mapping(struct amdgpu_device *adev);
379 
380 u64 amdgpu_amdkfd_xcp_memory_size(struct amdgpu_device *adev, int xcp_id);
381 
382 #define KFD_XCP_MEM_ID(adev, xcp_id) \
383 		((adev)->xcp_mgr && (xcp_id) >= 0 ?\
384 		(adev)->xcp_mgr->xcp[(xcp_id)].mem_id : -1)
385 
386 #define KFD_XCP_MEMORY_SIZE(adev, xcp_id) amdgpu_amdkfd_xcp_memory_size((adev), (xcp_id))
387 
388 
389 #if IS_ENABLED(CONFIG_HSA_AMD)
390 void amdgpu_amdkfd_gpuvm_init_mem_limits(void);
391 void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
392 				struct amdgpu_vm *vm);
393 
394 /**
395  * @amdgpu_amdkfd_release_notify() - Notify KFD when GEM object is released
396  *
397  * Allows KFD to release its resources associated with the GEM object.
398  */
399 void amdgpu_amdkfd_release_notify(struct amdgpu_bo *bo);
400 void amdgpu_amdkfd_account_vram_pin(struct amdgpu_bo *bo, int xcp_id);
401 void amdgpu_amdkfd_account_vram_unpin(struct amdgpu_bo *bo, int xcp_id);
402 void amdgpu_amdkfd_reserve_system_mem(uint64_t size);
403 #else
404 static inline
405 void amdgpu_amdkfd_gpuvm_init_mem_limits(void)
406 {
407 }
408 
409 static inline
410 void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
411 					struct amdgpu_vm *vm)
412 {
413 }
414 
415 static inline
416 void amdgpu_amdkfd_release_notify(struct amdgpu_bo *bo)
417 {
418 }
419 
420 static inline
421 void amdgpu_amdkfd_account_vram_pin(struct amdgpu_bo *bo, int xcp_id)
422 {
423 }
424 
425 static inline
426 void amdgpu_amdkfd_account_vram_unpin(struct amdgpu_bo *bo, int xcp_id)
427 {
428 }
429 #endif
430 
431 #if IS_ENABLED(CONFIG_HSA_AMD_SVM)
432 int kgd2kfd_init_zone_device(struct amdgpu_device *adev);
433 #else
434 static inline
435 int kgd2kfd_init_zone_device(struct amdgpu_device *adev)
436 {
437 	return 0;
438 }
439 #endif
440 
441 /* KGD2KFD callbacks */
442 int kgd2kfd_quiesce_mm(struct mm_struct *mm, uint32_t trigger);
443 int kgd2kfd_resume_mm(struct mm_struct *mm);
444 int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
445 					       u16 context_id, struct dma_fence *fence);
446 #if IS_ENABLED(CONFIG_HSA_AMD)
447 int kgd2kfd_init(void);
448 void kgd2kfd_exit(void);
449 struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf);
450 bool kgd2kfd_device_init(struct kfd_dev *kfd,
451 			 const struct kgd2kfd_shared_resources *gpu_resources);
452 void kgd2kfd_device_exit(struct kfd_dev *kfd);
453 void kgd2kfd_device_fini(struct kfd_dev *kfd);
454 void kgd2kfd_suspend(struct kfd_dev *kfd, bool suspend_proc);
455 int kgd2kfd_resume(struct kfd_dev *kfd, bool resume_proc);
456 void kgd2kfd_suspend_process(struct kfd_dev *kfd);
457 int kgd2kfd_resume_process(struct kfd_dev *kfd);
458 int kgd2kfd_pre_reset(struct kfd_dev *kfd,
459 		      struct amdgpu_reset_context *reset_context);
460 int kgd2kfd_post_reset(struct kfd_dev *kfd);
461 void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry);
462 void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd);
463 void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask);
464 int kgd2kfd_check_and_lock_kfd(struct kfd_dev *kfd);
465 void kgd2kfd_unlock_kfd(struct kfd_dev *kfd);
466 int kgd2kfd_start_sched(struct kfd_dev *kfd, uint32_t node_id);
467 int kgd2kfd_start_sched_all_nodes(struct kfd_dev *kfd);
468 int amdgpu_amdkfd_start_sched_all(struct amdgpu_device *adev);
469 int kgd2kfd_stop_sched(struct kfd_dev *kfd, uint32_t node_id);
470 int kgd2kfd_stop_sched_all_nodes(struct kfd_dev *kfd);
471 int amdgpu_amdkfd_stop_sched_all(struct amdgpu_device *adev);
472 bool kgd2kfd_compute_active(struct kfd_dev *kfd, uint32_t node_id);
473 bool kgd2kfd_vmfault_fast_path(struct amdgpu_device *adev, struct amdgpu_iv_entry *entry,
474 			       bool retry_fault);
475 void kgd2kfd_lock_kfd(void);
476 void kgd2kfd_teardown_processes(struct amdgpu_device *adev);
477 int kgd2kfd_reset_mes_queue(struct kfd_dev *kfd, uint32_t node_id,
478 			    int queue_type, int pipe, int queue,
479 			    unsigned int db);
480 
481 #else
482 static inline int kgd2kfd_init(void)
483 {
484 	return -ENOENT;
485 }
486 
487 static inline void kgd2kfd_exit(void)
488 {
489 }
490 
491 static inline
492 struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
493 {
494 	return NULL;
495 }
496 
497 static inline
498 bool kgd2kfd_device_init(struct kfd_dev *kfd,
499 				const struct kgd2kfd_shared_resources *gpu_resources)
500 {
501 	return false;
502 }
503 
504 static inline void kgd2kfd_device_exit(struct kfd_dev *kfd)
505 {
506 }
507 
508 static inline void kgd2kfd_device_fini(struct kfd_dev *kfd)
509 {
510 }
511 
512 static inline void kgd2kfd_suspend(struct kfd_dev *kfd, bool suspend_proc)
513 {
514 }
515 
516 static inline int kgd2kfd_resume(struct kfd_dev *kfd, bool resume_proc)
517 {
518 	return 0;
519 }
520 
521 static inline void kgd2kfd_suspend_process(struct kfd_dev *kfd)
522 {
523 }
524 
525 static inline int kgd2kfd_resume_process(struct kfd_dev *kfd)
526 {
527 	return 0;
528 }
529 
530 static inline int kgd2kfd_pre_reset(struct kfd_dev *kfd,
531 				    struct amdgpu_reset_context *reset_context)
532 {
533 	return 0;
534 }
535 
536 static inline int kgd2kfd_post_reset(struct kfd_dev *kfd)
537 {
538 	return 0;
539 }
540 
541 static inline
542 void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry)
543 {
544 }
545 
546 static inline
547 void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd)
548 {
549 }
550 
551 static inline
552 void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask)
553 {
554 }
555 
556 static inline int kgd2kfd_check_and_lock_kfd(struct kfd_dev *kfd)
557 {
558 	return 0;
559 }
560 
561 static inline void kgd2kfd_unlock_kfd(struct kfd_dev *kfd)
562 {
563 }
564 
565 static inline int kgd2kfd_start_sched(struct kfd_dev *kfd, uint32_t node_id)
566 {
567 	return 0;
568 }
569 
570 static inline int kgd2kfd_start_sched_all_nodes(struct kfd_dev *kfd)
571 {
572 	return 0;
573 }
574 
575 static inline int amdgpu_amdkfd_start_sched_all(struct amdgpu_device *adev)
576 {
577 	return 0;
578 }
579 
580 static inline int kgd2kfd_stop_sched(struct kfd_dev *kfd, uint32_t node_id)
581 {
582 	return 0;
583 }
584 
585 static inline int kgd2kfd_stop_sched_all_nodes(struct kfd_dev *kfd)
586 {
587 	return 0;
588 }
589 
590 static inline int amdgpu_amdkfd_stop_sched_all(struct amdgpu_device *adev)
591 {
592 	return 0;
593 }
594 
595 static inline bool kgd2kfd_compute_active(struct kfd_dev *kfd, uint32_t node_id)
596 {
597 	return false;
598 }
599 
600 static inline bool kgd2kfd_vmfault_fast_path(struct amdgpu_device *adev, struct amdgpu_iv_entry *entry,
601 				      bool retry_fault)
602 {
603 	return false;
604 }
605 
606 static inline void kgd2kfd_lock_kfd(void)
607 {
608 }
609 
610 static inline void kgd2kfd_teardown_processes(struct amdgpu_device *adev)
611 {
612 }
613 
614 static inline int kgd2kfd_reset_mes_queue(struct kfd_dev *kfd, uint32_t node_id,
615 					  int queue_type, int pipe, int queue,
616 					  unsigned int db)
617 {
618 	return 0;
619 }
620 
621 #endif
622 #endif /* AMDGPU_AMDKFD_H_INCLUDED */
623