blob: 1029a672deac60d6f5ae033609a617baf790d55d [file] [log] [blame]
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001/****************************************************************************
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 HABANALABS_H_
20#define HABANALABS_H_
21#include <linux/types.h>
22#include <linux/ioctl.h>
23#define GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START 0x8000
24enum goya_queue_id {
25 GOYA_QUEUE_ID_DMA_0 = 0,
26 GOYA_QUEUE_ID_DMA_1,
27 GOYA_QUEUE_ID_DMA_2,
28 GOYA_QUEUE_ID_DMA_3,
29 GOYA_QUEUE_ID_DMA_4,
30 GOYA_QUEUE_ID_CPU_PQ,
31 GOYA_QUEUE_ID_MME,
32 GOYA_QUEUE_ID_TPC0,
33 GOYA_QUEUE_ID_TPC1,
34 GOYA_QUEUE_ID_TPC2,
35 GOYA_QUEUE_ID_TPC3,
36 GOYA_QUEUE_ID_TPC4,
37 GOYA_QUEUE_ID_TPC5,
38 GOYA_QUEUE_ID_TPC6,
39 GOYA_QUEUE_ID_TPC7,
40 GOYA_QUEUE_ID_SIZE
41};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070042enum hl_device_status {
43 HL_DEVICE_STATUS_OPERATIONAL,
44 HL_DEVICE_STATUS_IN_RESET,
45 HL_DEVICE_STATUS_MALFUNCTION
46};
Christopher Ferris24f97eb2019-05-20 12:58:13 -070047#define HL_INFO_HW_IP_INFO 0
48#define HL_INFO_HW_EVENTS 1
49#define HL_INFO_DRAM_USAGE 2
50#define HL_INFO_HW_IDLE 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070051#define HL_INFO_DEVICE_STATUS 4
Christopher Ferris24f97eb2019-05-20 12:58:13 -070052#define HL_INFO_VERSION_MAX_LEN 128
53struct hl_info_hw_ip_info {
54 __u64 sram_base_address;
55 __u64 dram_base_address;
56 __u64 dram_size;
57 __u32 sram_size;
58 __u32 num_of_events;
59 __u32 device_id;
60 __u32 reserved[3];
61 __u32 armcp_cpld_version;
62 __u32 psoc_pci_pll_nr;
63 __u32 psoc_pci_pll_nf;
64 __u32 psoc_pci_pll_od;
65 __u32 psoc_pci_pll_div_factor;
66 __u8 tpc_enabled_mask;
67 __u8 dram_enabled;
68 __u8 pad[2];
69 __u8 armcp_version[HL_INFO_VERSION_MAX_LEN];
70};
71struct hl_info_dram_usage {
72 __u64 dram_free_mem;
73 __u64 ctx_dram_mem;
74};
75struct hl_info_hw_idle {
76 __u32 is_idle;
77 __u32 pad;
78};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070079struct hl_info_device_status {
80 __u32 status;
81 __u32 pad;
82};
Christopher Ferris24f97eb2019-05-20 12:58:13 -070083struct hl_info_args {
84 __u64 return_pointer;
85 __u32 return_size;
86 __u32 op;
87 __u32 ctx_id;
88 __u32 pad;
89};
90#define HL_CB_OP_CREATE 0
91#define HL_CB_OP_DESTROY 1
92struct hl_cb_in {
93 __u64 cb_handle;
94 __u32 op;
95 __u32 cb_size;
96 __u32 ctx_id;
97 __u32 pad;
98};
99struct hl_cb_out {
100 __u64 cb_handle;
101};
102union hl_cb_args {
103 struct hl_cb_in in;
104 struct hl_cb_out out;
105};
106struct hl_cs_chunk {
107 __u64 cb_handle;
108 __u32 queue_index;
109 __u32 cb_size;
110 __u32 cs_chunk_flags;
111 __u32 pad[11];
112};
113#define HL_CS_FLAGS_FORCE_RESTORE 0x1
114#define HL_CS_STATUS_SUCCESS 0
115struct hl_cs_in {
116 __u64 chunks_restore;
117 __u64 chunks_execute;
118 __u64 chunks_store;
119 __u32 num_chunks_restore;
120 __u32 num_chunks_execute;
121 __u32 num_chunks_store;
122 __u32 cs_flags;
123 __u32 ctx_id;
124};
125struct hl_cs_out {
126 __u64 seq;
127 __u32 status;
128 __u32 pad;
129};
130union hl_cs_args {
131 struct hl_cs_in in;
132 struct hl_cs_out out;
133};
134struct hl_wait_cs_in {
135 __u64 seq;
136 __u64 timeout_us;
137 __u32 ctx_id;
138 __u32 pad;
139};
140#define HL_WAIT_CS_STATUS_COMPLETED 0
141#define HL_WAIT_CS_STATUS_BUSY 1
142#define HL_WAIT_CS_STATUS_TIMEDOUT 2
143#define HL_WAIT_CS_STATUS_ABORTED 3
144#define HL_WAIT_CS_STATUS_INTERRUPTED 4
145struct hl_wait_cs_out {
146 __u32 status;
147 __u32 pad;
148};
149union hl_wait_cs_args {
150 struct hl_wait_cs_in in;
151 struct hl_wait_cs_out out;
152};
153#define HL_MEM_OP_ALLOC 0
154#define HL_MEM_OP_FREE 1
155#define HL_MEM_OP_MAP 2
156#define HL_MEM_OP_UNMAP 3
157#define HL_MEM_CONTIGUOUS 0x1
158#define HL_MEM_SHARED 0x2
159#define HL_MEM_USERPTR 0x4
160struct hl_mem_in {
161 union {
162 struct {
163 __u64 mem_size;
164 } alloc;
165 struct {
166 __u64 handle;
167 } free;
168 struct {
169 __u64 hint_addr;
170 __u64 handle;
171 } map_device;
172 struct {
173 __u64 host_virt_addr;
174 __u64 hint_addr;
175 __u64 mem_size;
176 } map_host;
177 struct {
178 __u64 device_virt_addr;
179 } unmap;
180 };
181 __u32 op;
182 __u32 flags;
183 __u32 ctx_id;
184 __u32 pad;
185};
186struct hl_mem_out {
187 union {
188 __u64 device_virt_addr;
189 __u64 handle;
190 };
191};
192union hl_mem_args {
193 struct hl_mem_in in;
194 struct hl_mem_out out;
195};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700196#define HL_DEBUG_MAX_AUX_VALUES 10
197struct hl_debug_params_etr {
198 __u64 buffer_address;
199 __u64 buffer_size;
200 __u32 sink_mode;
201 __u32 pad;
202};
203struct hl_debug_params_etf {
204 __u64 buffer_address;
205 __u64 buffer_size;
206 __u32 sink_mode;
207 __u32 pad;
208};
209struct hl_debug_params_stm {
210 __u64 he_mask;
211 __u64 sp_mask;
212 __u32 id;
213 __u32 frequency;
214};
215struct hl_debug_params_bmon {
216 __u64 start_addr0;
217 __u64 addr_mask0;
218 __u64 start_addr1;
219 __u64 addr_mask1;
220 __u32 bw_win;
221 __u32 win_capture;
222 __u32 id;
223 __u32 pad;
224};
225struct hl_debug_params_spmu {
226 __u64 event_types[HL_DEBUG_MAX_AUX_VALUES];
227 __u32 event_types_num;
228 __u32 pad;
229};
230#define HL_DEBUG_OP_ETR 0
231#define HL_DEBUG_OP_ETF 1
232#define HL_DEBUG_OP_STM 2
233#define HL_DEBUG_OP_FUNNEL 3
234#define HL_DEBUG_OP_BMON 4
235#define HL_DEBUG_OP_SPMU 5
236#define HL_DEBUG_OP_TIMESTAMP 6
237#define HL_DEBUG_OP_SET_MODE 7
238struct hl_debug_args {
239 __u64 input_ptr;
240 __u64 output_ptr;
241 __u32 input_size;
242 __u32 output_size;
243 __u32 op;
244 __u32 reg_idx;
245 __u32 enable;
246 __u32 ctx_id;
247};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700248#define HL_IOCTL_INFO _IOWR('H', 0x01, struct hl_info_args)
249#define HL_IOCTL_CB _IOWR('H', 0x02, union hl_cb_args)
250#define HL_IOCTL_CS _IOWR('H', 0x03, union hl_cs_args)
251#define HL_IOCTL_WAIT_CS _IOWR('H', 0x04, union hl_wait_cs_args)
252#define HL_IOCTL_MEMORY _IOWR('H', 0x05, union hl_mem_args)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700253#define HL_IOCTL_DEBUG _IOWR('H', 0x06, struct hl_debug_args)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700254#define HL_COMMAND_START 0x01
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700255#define HL_COMMAND_END 0x07
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700256#endif