xref: /linux/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h (revision 4dd10fbbeb9c33709edc89916e19c03c780a0751)
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 
349 int amdgpu_amdkfd_gpuvm_restore_process_bos(void *process_info,
350 					    struct dma_fence __rcu **ef);
351 int amdgpu_amdkfd_gpuvm_get_vm_fault_info(struct amdgpu_device *adev,
352 					      struct kfd_vm_fault_info *info);
353 int amdgpu_amdkfd_gpuvm_import_dmabuf_fd(struct amdgpu_device *adev, int fd,
354 					 uint64_t va, void *drm_priv,
355 					 struct kgd_mem **mem, uint64_t *size,
356 					 uint64_t *mmap_offset);
357 int amdgpu_amdkfd_gpuvm_export_dmabuf(struct kgd_mem *mem,
358 				      struct dma_buf **dmabuf);
359 void amdgpu_amdkfd_debug_mem_fence(struct amdgpu_device *adev);
360 int amdgpu_amdkfd_get_tile_config(struct amdgpu_device *adev,
361 				struct tile_config *config);
362 void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev,
363 			enum amdgpu_ras_block block, uint32_t reset);
364 
365 void amdgpu_amdkfd_ras_pasid_poison_consumption_handler(struct amdgpu_device *adev,
366 			enum amdgpu_ras_block block, uint16_t pasid,
367 			pasid_notify pasid_fn, void *data, uint32_t reset);
368 
369 bool amdgpu_amdkfd_is_fed(struct amdgpu_device *adev);
370 bool amdgpu_amdkfd_bo_mapped_to_dev(void *drm_priv, struct kgd_mem *mem);
371 void amdgpu_amdkfd_block_mmu_notifications(void *p);
372 int amdgpu_amdkfd_criu_resume(void *p);
373 int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
374 		uint64_t size, u32 alloc_flag, int8_t xcp_id);
375 void amdgpu_amdkfd_unreserve_mem_limit(struct amdgpu_device *adev,
376 		uint64_t size, u32 alloc_flag, int8_t xcp_id);
377 void amdgpu_amdkfd_clear_kfd_mapping(struct amdgpu_device *adev);
378 
379 u64 amdgpu_amdkfd_xcp_memory_size(struct amdgpu_device *adev, int xcp_id);
380 
381 #define KFD_XCP_MEM_ID(adev, xcp_id) \
382 		((adev)->xcp_mgr && (xcp_id) >= 0 ?\
383 		(adev)->xcp_mgr->xcp[(xcp_id)].mem_id : -1)
384 
385 #define KFD_XCP_MEMORY_SIZE(adev, xcp_id) amdgpu_amdkfd_xcp_memory_size((adev), (xcp_id))
386 
387 
388 #if IS_ENABLED(CONFIG_HSA_AMD)
389 void amdgpu_amdkfd_gpuvm_init_mem_limits(void);
390 void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
391 				struct amdgpu_vm *vm);
392 
393 /**
394  * @amdgpu_amdkfd_release_notify() - Notify KFD when GEM object is released
395  *
396  * Allows KFD to release its resources associated with the GEM object.
397  */
398 void amdgpu_amdkfd_release_notify(struct amdgpu_bo *bo);
399 void amdgpu_amdkfd_account_vram_pin(struct amdgpu_bo *bo, int xcp_id);
400 void amdgpu_amdkfd_account_vram_unpin(struct amdgpu_bo *bo, int xcp_id);
401 void amdgpu_amdkfd_reserve_system_mem(uint64_t size);
402 #else
403 static inline
404 void amdgpu_amdkfd_gpuvm_init_mem_limits(void)
405 {
406 }
407 
408 static inline
409 void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
410 					struct amdgpu_vm *vm)
411 {
412 }
413 
414 static inline
415 void amdgpu_amdkfd_release_notify(struct amdgpu_bo *bo)
416 {
417 }
418 
419 static inline
420 void amdgpu_amdkfd_account_vram_pin(struct amdgpu_bo *bo, int xcp_id)
421 {
422 }
423 
424 static inline
425 void amdgpu_amdkfd_account_vram_unpin(struct amdgpu_bo *bo, int xcp_id)
426 {
427 }
428 #endif
429 
430 #if IS_ENABLED(CONFIG_HSA_AMD_SVM)
431 int kgd2kfd_init_zone_device(struct amdgpu_device *adev);
432 #else
433 static inline
434 int kgd2kfd_init_zone_device(struct amdgpu_device *adev)
435 {
436 	return 0;
437 }
438 #endif
439 
440 /* KGD2KFD callbacks */
441 int kgd2kfd_quiesce_mm(struct mm_struct *mm, uint32_t trigger);
442 int kgd2kfd_resume_mm(struct mm_struct *mm);
443 int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
444 					       u16 context_id, struct dma_fence *fence);
445 #if IS_ENABLED(CONFIG_HSA_AMD)
446 int kgd2kfd_init(void);
447 void kgd2kfd_exit(void);
448 struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf);
449 bool kgd2kfd_device_init(struct kfd_dev *kfd,
450 			 const struct kgd2kfd_shared_resources *gpu_resources);
451 void kgd2kfd_device_exit(struct kfd_dev *kfd);
452 void kgd2kfd_device_fini(struct kfd_dev *kfd);
453 void kgd2kfd_suspend(struct kfd_dev *kfd, bool suspend_proc);
454 int kgd2kfd_resume(struct kfd_dev *kfd, bool resume_proc);
455 void kgd2kfd_suspend_process(struct kfd_dev *kfd);
456 int kgd2kfd_resume_process(struct kfd_dev *kfd);
457 int kgd2kfd_pre_reset(struct kfd_dev *kfd,
458 		      struct amdgpu_reset_context *reset_context);
459 int kgd2kfd_post_reset(struct kfd_dev *kfd);
460 void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry);
461 void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd);
462 void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask);
463 int kgd2kfd_check_and_lock_kfd(struct kfd_dev *kfd);
464 void kgd2kfd_unlock_kfd(struct kfd_dev *kfd);
465 int kgd2kfd_start_sched(struct kfd_dev *kfd, uint32_t node_id);
466 int kgd2kfd_start_sched_all_nodes(struct kfd_dev *kfd);
467 int amdgpu_amdkfd_start_sched_all(struct amdgpu_device *adev);
468 int kgd2kfd_stop_sched(struct kfd_dev *kfd, uint32_t node_id);
469 int kgd2kfd_stop_sched_all_nodes(struct kfd_dev *kfd);
470 int amdgpu_amdkfd_stop_sched_all(struct amdgpu_device *adev);
471 bool kgd2kfd_compute_active(struct kfd_dev *kfd, uint32_t node_id);
472 bool kgd2kfd_vmfault_fast_path(struct amdgpu_device *adev, struct amdgpu_iv_entry *entry,
473 			       bool retry_fault);
474 void kgd2kfd_lock_kfd(void);
475 void kgd2kfd_teardown_processes(struct amdgpu_device *adev);
476 int kgd2kfd_reset_mes_queue(struct kfd_dev *kfd, uint32_t node_id,
477 			    int queue_type, int pipe, int queue,
478 			    unsigned int db);
479 
480 #else
481 static inline int kgd2kfd_init(void)
482 {
483 	return -ENOENT;
484 }
485 
486 static inline void kgd2kfd_exit(void)
487 {
488 }
489 
490 static inline
491 struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
492 {
493 	return NULL;
494 }
495 
496 static inline
497 bool kgd2kfd_device_init(struct kfd_dev *kfd,
498 				const struct kgd2kfd_shared_resources *gpu_resources)
499 {
500 	return false;
501 }
502 
503 static inline void kgd2kfd_device_exit(struct kfd_dev *kfd)
504 {
505 }
506 
507 static inline void kgd2kfd_device_fini(struct kfd_dev *kfd)
508 {
509 }
510 
511 static inline void kgd2kfd_suspend(struct kfd_dev *kfd, bool suspend_proc)
512 {
513 }
514 
515 static inline int kgd2kfd_resume(struct kfd_dev *kfd, bool resume_proc)
516 {
517 	return 0;
518 }
519 
520 static inline void kgd2kfd_suspend_process(struct kfd_dev *kfd)
521 {
522 }
523 
524 static inline int kgd2kfd_resume_process(struct kfd_dev *kfd)
525 {
526 	return 0;
527 }
528 
529 static inline int kgd2kfd_pre_reset(struct kfd_dev *kfd,
530 				    struct amdgpu_reset_context *reset_context)
531 {
532 	return 0;
533 }
534 
535 static inline int kgd2kfd_post_reset(struct kfd_dev *kfd)
536 {
537 	return 0;
538 }
539 
540 static inline
541 void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry)
542 {
543 }
544 
545 static inline
546 void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd)
547 {
548 }
549 
550 static inline
551 void kgd2kfd_smi_event_throttle(struct kfd_dev *kfd, uint64_t throttle_bitmask)
552 {
553 }
554 
555 static inline int kgd2kfd_check_and_lock_kfd(struct kfd_dev *kfd)
556 {
557 	return 0;
558 }
559 
560 static inline void kgd2kfd_unlock_kfd(struct kfd_dev *kfd)
561 {
562 }
563 
564 static inline int kgd2kfd_start_sched(struct kfd_dev *kfd, uint32_t node_id)
565 {
566 	return 0;
567 }
568 
569 static inline int kgd2kfd_start_sched_all_nodes(struct kfd_dev *kfd)
570 {
571 	return 0;
572 }
573 
574 static inline int amdgpu_amdkfd_start_sched_all(struct amdgpu_device *adev)
575 {
576 	return 0;
577 }
578 
579 static inline int kgd2kfd_stop_sched(struct kfd_dev *kfd, uint32_t node_id)
580 {
581 	return 0;
582 }
583 
584 static inline int kgd2kfd_stop_sched_all_nodes(struct kfd_dev *kfd)
585 {
586 	return 0;
587 }
588 
589 static inline int amdgpu_amdkfd_stop_sched_all(struct amdgpu_device *adev)
590 {
591 	return 0;
592 }
593 
594 static inline bool kgd2kfd_compute_active(struct kfd_dev *kfd, uint32_t node_id)
595 {
596 	return false;
597 }
598 
599 static inline bool kgd2kfd_vmfault_fast_path(struct amdgpu_device *adev, struct amdgpu_iv_entry *entry,
600 				      bool retry_fault)
601 {
602 	return false;
603 }
604 
605 static inline void kgd2kfd_lock_kfd(void)
606 {
607 }
608 
609 static inline void kgd2kfd_teardown_processes(struct amdgpu_device *adev)
610 {
611 }
612 
613 static inline int kgd2kfd_reset_mes_queue(struct kfd_dev *kfd, uint32_t node_id,
614 					  int queue_type, int pipe, int queue,
615 					  unsigned int db)
616 {
617 	return 0;
618 }
619 
620 #endif
621 #endif /* AMDGPU_AMDKFD_H_INCLUDED */
622