xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: amdgpu_amdkfd_gfx_v9.h,v 1.2 2021/12/18 23:44:58 riastradh Exp $	*/
2 
3 /*
4  * Copyright 2019 Advanced Micro Devices, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 
26 
27 void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
28 		uint32_t sh_mem_config,
29 		uint32_t sh_mem_ape1_base, uint32_t sh_mem_ape1_limit,
30 		uint32_t sh_mem_bases);
31 int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid,
32 		unsigned int vmid);
33 int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id);
34 int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
35 			uint32_t queue_id, uint32_t __user *wptr,
36 			uint32_t wptr_shift, uint32_t wptr_mask,
37 			struct mm_struct *mm);
38 int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd,
39 			    uint32_t pipe_id, uint32_t queue_id,
40 			    uint32_t doorbell_off);
41 int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd,
42 			uint32_t pipe_id, uint32_t queue_id,
43 			uint32_t (**dump)[2], uint32_t *n_regs);
44 bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,
45 		uint32_t pipe_id, uint32_t queue_id);
46 int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,
47 				enum kfd_preempt_type reset_type,
48 				unsigned int utimeout, uint32_t pipe_id,
49 				uint32_t queue_id);
50 int kgd_gfx_v9_address_watch_disable(struct kgd_dev *kgd);
51 int kgd_gfx_v9_address_watch_execute(struct kgd_dev *kgd,
52 					unsigned int watch_point_id,
53 					uint32_t cntl_val,
54 					uint32_t addr_hi,
55 					uint32_t addr_lo);
56 int kgd_gfx_v9_wave_control_execute(struct kgd_dev *kgd,
57 					uint32_t gfx_index_val,
58 					uint32_t sq_cmd);
59 uint32_t kgd_gfx_v9_address_watch_get_offset(struct kgd_dev *kgd,
60 					unsigned int watch_point_id,
61 					unsigned int reg_offset);
62 
63 bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
64 					uint8_t vmid, uint16_t *p_pasid);
65 int kgd_gfx_v9_get_tile_config(struct kgd_dev *kgd,
66 		struct tile_config *config);
67