blob: 75ec29352b81c0d8986a51a79abae5bb110a3d7b [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
Christopher Ferris8177cdf2020-08-03 11:53:55 -070024#define GAUDI_DRIVER_SRAM_RESERVED_SIZE_FROM_START 0x80
Christopher Ferris05667cd2021-02-16 16:01:34 -080025#define GAUDI_FIRST_AVAILABLE_W_S_SYNC_OBJECT 144
26#define GAUDI_FIRST_AVAILABLE_W_S_MONITOR 72
Christopher Ferris10a76e62022-06-08 13:31:52 -070027#define TS_MAX_ELEMENTS_NUM (1 << 20)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070028enum goya_queue_id {
29 GOYA_QUEUE_ID_DMA_0 = 0,
Christopher Ferris9584fa42019-12-09 15:36:13 -080030 GOYA_QUEUE_ID_DMA_1 = 1,
31 GOYA_QUEUE_ID_DMA_2 = 2,
32 GOYA_QUEUE_ID_DMA_3 = 3,
33 GOYA_QUEUE_ID_DMA_4 = 4,
34 GOYA_QUEUE_ID_CPU_PQ = 5,
35 GOYA_QUEUE_ID_MME = 6,
36 GOYA_QUEUE_ID_TPC0 = 7,
37 GOYA_QUEUE_ID_TPC1 = 8,
38 GOYA_QUEUE_ID_TPC2 = 9,
39 GOYA_QUEUE_ID_TPC3 = 10,
40 GOYA_QUEUE_ID_TPC4 = 11,
41 GOYA_QUEUE_ID_TPC5 = 12,
42 GOYA_QUEUE_ID_TPC6 = 13,
43 GOYA_QUEUE_ID_TPC7 = 14,
Christopher Ferris24f97eb2019-05-20 12:58:13 -070044 GOYA_QUEUE_ID_SIZE
45};
Christopher Ferris8177cdf2020-08-03 11:53:55 -070046enum gaudi_queue_id {
47 GAUDI_QUEUE_ID_DMA_0_0 = 0,
48 GAUDI_QUEUE_ID_DMA_0_1 = 1,
49 GAUDI_QUEUE_ID_DMA_0_2 = 2,
50 GAUDI_QUEUE_ID_DMA_0_3 = 3,
51 GAUDI_QUEUE_ID_DMA_1_0 = 4,
52 GAUDI_QUEUE_ID_DMA_1_1 = 5,
53 GAUDI_QUEUE_ID_DMA_1_2 = 6,
54 GAUDI_QUEUE_ID_DMA_1_3 = 7,
55 GAUDI_QUEUE_ID_CPU_PQ = 8,
56 GAUDI_QUEUE_ID_DMA_2_0 = 9,
57 GAUDI_QUEUE_ID_DMA_2_1 = 10,
58 GAUDI_QUEUE_ID_DMA_2_2 = 11,
59 GAUDI_QUEUE_ID_DMA_2_3 = 12,
60 GAUDI_QUEUE_ID_DMA_3_0 = 13,
61 GAUDI_QUEUE_ID_DMA_3_1 = 14,
62 GAUDI_QUEUE_ID_DMA_3_2 = 15,
63 GAUDI_QUEUE_ID_DMA_3_3 = 16,
64 GAUDI_QUEUE_ID_DMA_4_0 = 17,
65 GAUDI_QUEUE_ID_DMA_4_1 = 18,
66 GAUDI_QUEUE_ID_DMA_4_2 = 19,
67 GAUDI_QUEUE_ID_DMA_4_3 = 20,
68 GAUDI_QUEUE_ID_DMA_5_0 = 21,
69 GAUDI_QUEUE_ID_DMA_5_1 = 22,
70 GAUDI_QUEUE_ID_DMA_5_2 = 23,
71 GAUDI_QUEUE_ID_DMA_5_3 = 24,
72 GAUDI_QUEUE_ID_DMA_6_0 = 25,
73 GAUDI_QUEUE_ID_DMA_6_1 = 26,
74 GAUDI_QUEUE_ID_DMA_6_2 = 27,
75 GAUDI_QUEUE_ID_DMA_6_3 = 28,
76 GAUDI_QUEUE_ID_DMA_7_0 = 29,
77 GAUDI_QUEUE_ID_DMA_7_1 = 30,
78 GAUDI_QUEUE_ID_DMA_7_2 = 31,
79 GAUDI_QUEUE_ID_DMA_7_3 = 32,
80 GAUDI_QUEUE_ID_MME_0_0 = 33,
81 GAUDI_QUEUE_ID_MME_0_1 = 34,
82 GAUDI_QUEUE_ID_MME_0_2 = 35,
83 GAUDI_QUEUE_ID_MME_0_3 = 36,
84 GAUDI_QUEUE_ID_MME_1_0 = 37,
85 GAUDI_QUEUE_ID_MME_1_1 = 38,
86 GAUDI_QUEUE_ID_MME_1_2 = 39,
87 GAUDI_QUEUE_ID_MME_1_3 = 40,
88 GAUDI_QUEUE_ID_TPC_0_0 = 41,
89 GAUDI_QUEUE_ID_TPC_0_1 = 42,
90 GAUDI_QUEUE_ID_TPC_0_2 = 43,
91 GAUDI_QUEUE_ID_TPC_0_3 = 44,
92 GAUDI_QUEUE_ID_TPC_1_0 = 45,
93 GAUDI_QUEUE_ID_TPC_1_1 = 46,
94 GAUDI_QUEUE_ID_TPC_1_2 = 47,
95 GAUDI_QUEUE_ID_TPC_1_3 = 48,
96 GAUDI_QUEUE_ID_TPC_2_0 = 49,
97 GAUDI_QUEUE_ID_TPC_2_1 = 50,
98 GAUDI_QUEUE_ID_TPC_2_2 = 51,
99 GAUDI_QUEUE_ID_TPC_2_3 = 52,
100 GAUDI_QUEUE_ID_TPC_3_0 = 53,
101 GAUDI_QUEUE_ID_TPC_3_1 = 54,
102 GAUDI_QUEUE_ID_TPC_3_2 = 55,
103 GAUDI_QUEUE_ID_TPC_3_3 = 56,
104 GAUDI_QUEUE_ID_TPC_4_0 = 57,
105 GAUDI_QUEUE_ID_TPC_4_1 = 58,
106 GAUDI_QUEUE_ID_TPC_4_2 = 59,
107 GAUDI_QUEUE_ID_TPC_4_3 = 60,
108 GAUDI_QUEUE_ID_TPC_5_0 = 61,
109 GAUDI_QUEUE_ID_TPC_5_1 = 62,
110 GAUDI_QUEUE_ID_TPC_5_2 = 63,
111 GAUDI_QUEUE_ID_TPC_5_3 = 64,
112 GAUDI_QUEUE_ID_TPC_6_0 = 65,
113 GAUDI_QUEUE_ID_TPC_6_1 = 66,
114 GAUDI_QUEUE_ID_TPC_6_2 = 67,
115 GAUDI_QUEUE_ID_TPC_6_3 = 68,
116 GAUDI_QUEUE_ID_TPC_7_0 = 69,
117 GAUDI_QUEUE_ID_TPC_7_1 = 70,
118 GAUDI_QUEUE_ID_TPC_7_2 = 71,
119 GAUDI_QUEUE_ID_TPC_7_3 = 72,
120 GAUDI_QUEUE_ID_NIC_0_0 = 73,
121 GAUDI_QUEUE_ID_NIC_0_1 = 74,
122 GAUDI_QUEUE_ID_NIC_0_2 = 75,
123 GAUDI_QUEUE_ID_NIC_0_3 = 76,
124 GAUDI_QUEUE_ID_NIC_1_0 = 77,
125 GAUDI_QUEUE_ID_NIC_1_1 = 78,
126 GAUDI_QUEUE_ID_NIC_1_2 = 79,
127 GAUDI_QUEUE_ID_NIC_1_3 = 80,
128 GAUDI_QUEUE_ID_NIC_2_0 = 81,
129 GAUDI_QUEUE_ID_NIC_2_1 = 82,
130 GAUDI_QUEUE_ID_NIC_2_2 = 83,
131 GAUDI_QUEUE_ID_NIC_2_3 = 84,
132 GAUDI_QUEUE_ID_NIC_3_0 = 85,
133 GAUDI_QUEUE_ID_NIC_3_1 = 86,
134 GAUDI_QUEUE_ID_NIC_3_2 = 87,
135 GAUDI_QUEUE_ID_NIC_3_3 = 88,
136 GAUDI_QUEUE_ID_NIC_4_0 = 89,
137 GAUDI_QUEUE_ID_NIC_4_1 = 90,
138 GAUDI_QUEUE_ID_NIC_4_2 = 91,
139 GAUDI_QUEUE_ID_NIC_4_3 = 92,
140 GAUDI_QUEUE_ID_NIC_5_0 = 93,
141 GAUDI_QUEUE_ID_NIC_5_1 = 94,
142 GAUDI_QUEUE_ID_NIC_5_2 = 95,
143 GAUDI_QUEUE_ID_NIC_5_3 = 96,
144 GAUDI_QUEUE_ID_NIC_6_0 = 97,
145 GAUDI_QUEUE_ID_NIC_6_1 = 98,
146 GAUDI_QUEUE_ID_NIC_6_2 = 99,
147 GAUDI_QUEUE_ID_NIC_6_3 = 100,
148 GAUDI_QUEUE_ID_NIC_7_0 = 101,
149 GAUDI_QUEUE_ID_NIC_7_1 = 102,
150 GAUDI_QUEUE_ID_NIC_7_2 = 103,
151 GAUDI_QUEUE_ID_NIC_7_3 = 104,
152 GAUDI_QUEUE_ID_NIC_8_0 = 105,
153 GAUDI_QUEUE_ID_NIC_8_1 = 106,
154 GAUDI_QUEUE_ID_NIC_8_2 = 107,
155 GAUDI_QUEUE_ID_NIC_8_3 = 108,
156 GAUDI_QUEUE_ID_NIC_9_0 = 109,
157 GAUDI_QUEUE_ID_NIC_9_1 = 110,
158 GAUDI_QUEUE_ID_NIC_9_2 = 111,
159 GAUDI_QUEUE_ID_NIC_9_3 = 112,
160 GAUDI_QUEUE_ID_SIZE
161};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700162enum gaudi2_queue_id {
163 GAUDI2_QUEUE_ID_PDMA_0_0 = 0,
164 GAUDI2_QUEUE_ID_PDMA_0_1 = 1,
165 GAUDI2_QUEUE_ID_PDMA_0_2 = 2,
166 GAUDI2_QUEUE_ID_PDMA_0_3 = 3,
167 GAUDI2_QUEUE_ID_PDMA_1_0 = 4,
168 GAUDI2_QUEUE_ID_PDMA_1_1 = 5,
169 GAUDI2_QUEUE_ID_PDMA_1_2 = 6,
170 GAUDI2_QUEUE_ID_PDMA_1_3 = 7,
171 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_0 = 8,
172 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_1 = 9,
173 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_2 = 10,
174 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_3 = 11,
175 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_0 = 12,
176 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_1 = 13,
177 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_2 = 14,
178 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_3 = 15,
179 GAUDI2_QUEUE_ID_DCORE0_MME_0_0 = 16,
180 GAUDI2_QUEUE_ID_DCORE0_MME_0_1 = 17,
181 GAUDI2_QUEUE_ID_DCORE0_MME_0_2 = 18,
182 GAUDI2_QUEUE_ID_DCORE0_MME_0_3 = 19,
183 GAUDI2_QUEUE_ID_DCORE0_TPC_0_0 = 20,
184 GAUDI2_QUEUE_ID_DCORE0_TPC_0_1 = 21,
185 GAUDI2_QUEUE_ID_DCORE0_TPC_0_2 = 22,
186 GAUDI2_QUEUE_ID_DCORE0_TPC_0_3 = 23,
187 GAUDI2_QUEUE_ID_DCORE0_TPC_1_0 = 24,
188 GAUDI2_QUEUE_ID_DCORE0_TPC_1_1 = 25,
189 GAUDI2_QUEUE_ID_DCORE0_TPC_1_2 = 26,
190 GAUDI2_QUEUE_ID_DCORE0_TPC_1_3 = 27,
191 GAUDI2_QUEUE_ID_DCORE0_TPC_2_0 = 28,
192 GAUDI2_QUEUE_ID_DCORE0_TPC_2_1 = 29,
193 GAUDI2_QUEUE_ID_DCORE0_TPC_2_2 = 30,
194 GAUDI2_QUEUE_ID_DCORE0_TPC_2_3 = 31,
195 GAUDI2_QUEUE_ID_DCORE0_TPC_3_0 = 32,
196 GAUDI2_QUEUE_ID_DCORE0_TPC_3_1 = 33,
197 GAUDI2_QUEUE_ID_DCORE0_TPC_3_2 = 34,
198 GAUDI2_QUEUE_ID_DCORE0_TPC_3_3 = 35,
199 GAUDI2_QUEUE_ID_DCORE0_TPC_4_0 = 36,
200 GAUDI2_QUEUE_ID_DCORE0_TPC_4_1 = 37,
201 GAUDI2_QUEUE_ID_DCORE0_TPC_4_2 = 38,
202 GAUDI2_QUEUE_ID_DCORE0_TPC_4_3 = 39,
203 GAUDI2_QUEUE_ID_DCORE0_TPC_5_0 = 40,
204 GAUDI2_QUEUE_ID_DCORE0_TPC_5_1 = 41,
205 GAUDI2_QUEUE_ID_DCORE0_TPC_5_2 = 42,
206 GAUDI2_QUEUE_ID_DCORE0_TPC_5_3 = 43,
207 GAUDI2_QUEUE_ID_DCORE0_TPC_6_0 = 44,
208 GAUDI2_QUEUE_ID_DCORE0_TPC_6_1 = 45,
209 GAUDI2_QUEUE_ID_DCORE0_TPC_6_2 = 46,
210 GAUDI2_QUEUE_ID_DCORE0_TPC_6_3 = 47,
211 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_0 = 48,
212 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_1 = 49,
213 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_2 = 50,
214 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_3 = 51,
215 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_0 = 52,
216 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_1 = 53,
217 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_2 = 54,
218 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_3 = 55,
219 GAUDI2_QUEUE_ID_DCORE1_MME_0_0 = 56,
220 GAUDI2_QUEUE_ID_DCORE1_MME_0_1 = 57,
221 GAUDI2_QUEUE_ID_DCORE1_MME_0_2 = 58,
222 GAUDI2_QUEUE_ID_DCORE1_MME_0_3 = 59,
223 GAUDI2_QUEUE_ID_DCORE1_TPC_0_0 = 60,
224 GAUDI2_QUEUE_ID_DCORE1_TPC_0_1 = 61,
225 GAUDI2_QUEUE_ID_DCORE1_TPC_0_2 = 62,
226 GAUDI2_QUEUE_ID_DCORE1_TPC_0_3 = 63,
227 GAUDI2_QUEUE_ID_DCORE1_TPC_1_0 = 64,
228 GAUDI2_QUEUE_ID_DCORE1_TPC_1_1 = 65,
229 GAUDI2_QUEUE_ID_DCORE1_TPC_1_2 = 66,
230 GAUDI2_QUEUE_ID_DCORE1_TPC_1_3 = 67,
231 GAUDI2_QUEUE_ID_DCORE1_TPC_2_0 = 68,
232 GAUDI2_QUEUE_ID_DCORE1_TPC_2_1 = 69,
233 GAUDI2_QUEUE_ID_DCORE1_TPC_2_2 = 70,
234 GAUDI2_QUEUE_ID_DCORE1_TPC_2_3 = 71,
235 GAUDI2_QUEUE_ID_DCORE1_TPC_3_0 = 72,
236 GAUDI2_QUEUE_ID_DCORE1_TPC_3_1 = 73,
237 GAUDI2_QUEUE_ID_DCORE1_TPC_3_2 = 74,
238 GAUDI2_QUEUE_ID_DCORE1_TPC_3_3 = 75,
239 GAUDI2_QUEUE_ID_DCORE1_TPC_4_0 = 76,
240 GAUDI2_QUEUE_ID_DCORE1_TPC_4_1 = 77,
241 GAUDI2_QUEUE_ID_DCORE1_TPC_4_2 = 78,
242 GAUDI2_QUEUE_ID_DCORE1_TPC_4_3 = 79,
243 GAUDI2_QUEUE_ID_DCORE1_TPC_5_0 = 80,
244 GAUDI2_QUEUE_ID_DCORE1_TPC_5_1 = 81,
245 GAUDI2_QUEUE_ID_DCORE1_TPC_5_2 = 82,
246 GAUDI2_QUEUE_ID_DCORE1_TPC_5_3 = 83,
247 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_0 = 84,
248 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_1 = 85,
249 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_2 = 86,
250 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_3 = 87,
251 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_0 = 88,
252 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_1 = 89,
253 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_2 = 90,
254 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_3 = 91,
255 GAUDI2_QUEUE_ID_DCORE2_MME_0_0 = 92,
256 GAUDI2_QUEUE_ID_DCORE2_MME_0_1 = 93,
257 GAUDI2_QUEUE_ID_DCORE2_MME_0_2 = 94,
258 GAUDI2_QUEUE_ID_DCORE2_MME_0_3 = 95,
259 GAUDI2_QUEUE_ID_DCORE2_TPC_0_0 = 96,
260 GAUDI2_QUEUE_ID_DCORE2_TPC_0_1 = 97,
261 GAUDI2_QUEUE_ID_DCORE2_TPC_0_2 = 98,
262 GAUDI2_QUEUE_ID_DCORE2_TPC_0_3 = 99,
263 GAUDI2_QUEUE_ID_DCORE2_TPC_1_0 = 100,
264 GAUDI2_QUEUE_ID_DCORE2_TPC_1_1 = 101,
265 GAUDI2_QUEUE_ID_DCORE2_TPC_1_2 = 102,
266 GAUDI2_QUEUE_ID_DCORE2_TPC_1_3 = 103,
267 GAUDI2_QUEUE_ID_DCORE2_TPC_2_0 = 104,
268 GAUDI2_QUEUE_ID_DCORE2_TPC_2_1 = 105,
269 GAUDI2_QUEUE_ID_DCORE2_TPC_2_2 = 106,
270 GAUDI2_QUEUE_ID_DCORE2_TPC_2_3 = 107,
271 GAUDI2_QUEUE_ID_DCORE2_TPC_3_0 = 108,
272 GAUDI2_QUEUE_ID_DCORE2_TPC_3_1 = 109,
273 GAUDI2_QUEUE_ID_DCORE2_TPC_3_2 = 110,
274 GAUDI2_QUEUE_ID_DCORE2_TPC_3_3 = 111,
275 GAUDI2_QUEUE_ID_DCORE2_TPC_4_0 = 112,
276 GAUDI2_QUEUE_ID_DCORE2_TPC_4_1 = 113,
277 GAUDI2_QUEUE_ID_DCORE2_TPC_4_2 = 114,
278 GAUDI2_QUEUE_ID_DCORE2_TPC_4_3 = 115,
279 GAUDI2_QUEUE_ID_DCORE2_TPC_5_0 = 116,
280 GAUDI2_QUEUE_ID_DCORE2_TPC_5_1 = 117,
281 GAUDI2_QUEUE_ID_DCORE2_TPC_5_2 = 118,
282 GAUDI2_QUEUE_ID_DCORE2_TPC_5_3 = 119,
283 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_0 = 120,
284 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_1 = 121,
285 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_2 = 122,
286 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_3 = 123,
287 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_0 = 124,
288 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_1 = 125,
289 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_2 = 126,
290 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_3 = 127,
291 GAUDI2_QUEUE_ID_DCORE3_MME_0_0 = 128,
292 GAUDI2_QUEUE_ID_DCORE3_MME_0_1 = 129,
293 GAUDI2_QUEUE_ID_DCORE3_MME_0_2 = 130,
294 GAUDI2_QUEUE_ID_DCORE3_MME_0_3 = 131,
295 GAUDI2_QUEUE_ID_DCORE3_TPC_0_0 = 132,
296 GAUDI2_QUEUE_ID_DCORE3_TPC_0_1 = 133,
297 GAUDI2_QUEUE_ID_DCORE3_TPC_0_2 = 134,
298 GAUDI2_QUEUE_ID_DCORE3_TPC_0_3 = 135,
299 GAUDI2_QUEUE_ID_DCORE3_TPC_1_0 = 136,
300 GAUDI2_QUEUE_ID_DCORE3_TPC_1_1 = 137,
301 GAUDI2_QUEUE_ID_DCORE3_TPC_1_2 = 138,
302 GAUDI2_QUEUE_ID_DCORE3_TPC_1_3 = 139,
303 GAUDI2_QUEUE_ID_DCORE3_TPC_2_0 = 140,
304 GAUDI2_QUEUE_ID_DCORE3_TPC_2_1 = 141,
305 GAUDI2_QUEUE_ID_DCORE3_TPC_2_2 = 142,
306 GAUDI2_QUEUE_ID_DCORE3_TPC_2_3 = 143,
307 GAUDI2_QUEUE_ID_DCORE3_TPC_3_0 = 144,
308 GAUDI2_QUEUE_ID_DCORE3_TPC_3_1 = 145,
309 GAUDI2_QUEUE_ID_DCORE3_TPC_3_2 = 146,
310 GAUDI2_QUEUE_ID_DCORE3_TPC_3_3 = 147,
311 GAUDI2_QUEUE_ID_DCORE3_TPC_4_0 = 148,
312 GAUDI2_QUEUE_ID_DCORE3_TPC_4_1 = 149,
313 GAUDI2_QUEUE_ID_DCORE3_TPC_4_2 = 150,
314 GAUDI2_QUEUE_ID_DCORE3_TPC_4_3 = 151,
315 GAUDI2_QUEUE_ID_DCORE3_TPC_5_0 = 152,
316 GAUDI2_QUEUE_ID_DCORE3_TPC_5_1 = 153,
317 GAUDI2_QUEUE_ID_DCORE3_TPC_5_2 = 154,
318 GAUDI2_QUEUE_ID_DCORE3_TPC_5_3 = 155,
319 GAUDI2_QUEUE_ID_NIC_0_0 = 156,
320 GAUDI2_QUEUE_ID_NIC_0_1 = 157,
321 GAUDI2_QUEUE_ID_NIC_0_2 = 158,
322 GAUDI2_QUEUE_ID_NIC_0_3 = 159,
323 GAUDI2_QUEUE_ID_NIC_1_0 = 160,
324 GAUDI2_QUEUE_ID_NIC_1_1 = 161,
325 GAUDI2_QUEUE_ID_NIC_1_2 = 162,
326 GAUDI2_QUEUE_ID_NIC_1_3 = 163,
327 GAUDI2_QUEUE_ID_NIC_2_0 = 164,
328 GAUDI2_QUEUE_ID_NIC_2_1 = 165,
329 GAUDI2_QUEUE_ID_NIC_2_2 = 166,
330 GAUDI2_QUEUE_ID_NIC_2_3 = 167,
331 GAUDI2_QUEUE_ID_NIC_3_0 = 168,
332 GAUDI2_QUEUE_ID_NIC_3_1 = 169,
333 GAUDI2_QUEUE_ID_NIC_3_2 = 170,
334 GAUDI2_QUEUE_ID_NIC_3_3 = 171,
335 GAUDI2_QUEUE_ID_NIC_4_0 = 172,
336 GAUDI2_QUEUE_ID_NIC_4_1 = 173,
337 GAUDI2_QUEUE_ID_NIC_4_2 = 174,
338 GAUDI2_QUEUE_ID_NIC_4_3 = 175,
339 GAUDI2_QUEUE_ID_NIC_5_0 = 176,
340 GAUDI2_QUEUE_ID_NIC_5_1 = 177,
341 GAUDI2_QUEUE_ID_NIC_5_2 = 178,
342 GAUDI2_QUEUE_ID_NIC_5_3 = 179,
343 GAUDI2_QUEUE_ID_NIC_6_0 = 180,
344 GAUDI2_QUEUE_ID_NIC_6_1 = 181,
345 GAUDI2_QUEUE_ID_NIC_6_2 = 182,
346 GAUDI2_QUEUE_ID_NIC_6_3 = 183,
347 GAUDI2_QUEUE_ID_NIC_7_0 = 184,
348 GAUDI2_QUEUE_ID_NIC_7_1 = 185,
349 GAUDI2_QUEUE_ID_NIC_7_2 = 186,
350 GAUDI2_QUEUE_ID_NIC_7_3 = 187,
351 GAUDI2_QUEUE_ID_NIC_8_0 = 188,
352 GAUDI2_QUEUE_ID_NIC_8_1 = 189,
353 GAUDI2_QUEUE_ID_NIC_8_2 = 190,
354 GAUDI2_QUEUE_ID_NIC_8_3 = 191,
355 GAUDI2_QUEUE_ID_NIC_9_0 = 192,
356 GAUDI2_QUEUE_ID_NIC_9_1 = 193,
357 GAUDI2_QUEUE_ID_NIC_9_2 = 194,
358 GAUDI2_QUEUE_ID_NIC_9_3 = 195,
359 GAUDI2_QUEUE_ID_NIC_10_0 = 196,
360 GAUDI2_QUEUE_ID_NIC_10_1 = 197,
361 GAUDI2_QUEUE_ID_NIC_10_2 = 198,
362 GAUDI2_QUEUE_ID_NIC_10_3 = 199,
363 GAUDI2_QUEUE_ID_NIC_11_0 = 200,
364 GAUDI2_QUEUE_ID_NIC_11_1 = 201,
365 GAUDI2_QUEUE_ID_NIC_11_2 = 202,
366 GAUDI2_QUEUE_ID_NIC_11_3 = 203,
367 GAUDI2_QUEUE_ID_NIC_12_0 = 204,
368 GAUDI2_QUEUE_ID_NIC_12_1 = 205,
369 GAUDI2_QUEUE_ID_NIC_12_2 = 206,
370 GAUDI2_QUEUE_ID_NIC_12_3 = 207,
371 GAUDI2_QUEUE_ID_NIC_13_0 = 208,
372 GAUDI2_QUEUE_ID_NIC_13_1 = 209,
373 GAUDI2_QUEUE_ID_NIC_13_2 = 210,
374 GAUDI2_QUEUE_ID_NIC_13_3 = 211,
375 GAUDI2_QUEUE_ID_NIC_14_0 = 212,
376 GAUDI2_QUEUE_ID_NIC_14_1 = 213,
377 GAUDI2_QUEUE_ID_NIC_14_2 = 214,
378 GAUDI2_QUEUE_ID_NIC_14_3 = 215,
379 GAUDI2_QUEUE_ID_NIC_15_0 = 216,
380 GAUDI2_QUEUE_ID_NIC_15_1 = 217,
381 GAUDI2_QUEUE_ID_NIC_15_2 = 218,
382 GAUDI2_QUEUE_ID_NIC_15_3 = 219,
383 GAUDI2_QUEUE_ID_NIC_16_0 = 220,
384 GAUDI2_QUEUE_ID_NIC_16_1 = 221,
385 GAUDI2_QUEUE_ID_NIC_16_2 = 222,
386 GAUDI2_QUEUE_ID_NIC_16_3 = 223,
387 GAUDI2_QUEUE_ID_NIC_17_0 = 224,
388 GAUDI2_QUEUE_ID_NIC_17_1 = 225,
389 GAUDI2_QUEUE_ID_NIC_17_2 = 226,
390 GAUDI2_QUEUE_ID_NIC_17_3 = 227,
391 GAUDI2_QUEUE_ID_NIC_18_0 = 228,
392 GAUDI2_QUEUE_ID_NIC_18_1 = 229,
393 GAUDI2_QUEUE_ID_NIC_18_2 = 230,
394 GAUDI2_QUEUE_ID_NIC_18_3 = 231,
395 GAUDI2_QUEUE_ID_NIC_19_0 = 232,
396 GAUDI2_QUEUE_ID_NIC_19_1 = 233,
397 GAUDI2_QUEUE_ID_NIC_19_2 = 234,
398 GAUDI2_QUEUE_ID_NIC_19_3 = 235,
399 GAUDI2_QUEUE_ID_NIC_20_0 = 236,
400 GAUDI2_QUEUE_ID_NIC_20_1 = 237,
401 GAUDI2_QUEUE_ID_NIC_20_2 = 238,
402 GAUDI2_QUEUE_ID_NIC_20_3 = 239,
403 GAUDI2_QUEUE_ID_NIC_21_0 = 240,
404 GAUDI2_QUEUE_ID_NIC_21_1 = 241,
405 GAUDI2_QUEUE_ID_NIC_21_2 = 242,
406 GAUDI2_QUEUE_ID_NIC_21_3 = 243,
407 GAUDI2_QUEUE_ID_NIC_22_0 = 244,
408 GAUDI2_QUEUE_ID_NIC_22_1 = 245,
409 GAUDI2_QUEUE_ID_NIC_22_2 = 246,
410 GAUDI2_QUEUE_ID_NIC_22_3 = 247,
411 GAUDI2_QUEUE_ID_NIC_23_0 = 248,
412 GAUDI2_QUEUE_ID_NIC_23_1 = 249,
413 GAUDI2_QUEUE_ID_NIC_23_2 = 250,
414 GAUDI2_QUEUE_ID_NIC_23_3 = 251,
415 GAUDI2_QUEUE_ID_ROT_0_0 = 252,
416 GAUDI2_QUEUE_ID_ROT_0_1 = 253,
417 GAUDI2_QUEUE_ID_ROT_0_2 = 254,
418 GAUDI2_QUEUE_ID_ROT_0_3 = 255,
419 GAUDI2_QUEUE_ID_ROT_1_0 = 256,
420 GAUDI2_QUEUE_ID_ROT_1_1 = 257,
421 GAUDI2_QUEUE_ID_ROT_1_2 = 258,
422 GAUDI2_QUEUE_ID_ROT_1_3 = 259,
423 GAUDI2_QUEUE_ID_CPU_PQ = 260,
424 GAUDI2_QUEUE_ID_SIZE
425};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700426enum goya_engine_id {
427 GOYA_ENGINE_ID_DMA_0 = 0,
428 GOYA_ENGINE_ID_DMA_1,
429 GOYA_ENGINE_ID_DMA_2,
430 GOYA_ENGINE_ID_DMA_3,
431 GOYA_ENGINE_ID_DMA_4,
432 GOYA_ENGINE_ID_MME_0,
433 GOYA_ENGINE_ID_TPC_0,
434 GOYA_ENGINE_ID_TPC_1,
435 GOYA_ENGINE_ID_TPC_2,
436 GOYA_ENGINE_ID_TPC_3,
437 GOYA_ENGINE_ID_TPC_4,
438 GOYA_ENGINE_ID_TPC_5,
439 GOYA_ENGINE_ID_TPC_6,
440 GOYA_ENGINE_ID_TPC_7,
441 GOYA_ENGINE_ID_SIZE
442};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700443enum gaudi_engine_id {
444 GAUDI_ENGINE_ID_DMA_0 = 0,
445 GAUDI_ENGINE_ID_DMA_1,
446 GAUDI_ENGINE_ID_DMA_2,
447 GAUDI_ENGINE_ID_DMA_3,
448 GAUDI_ENGINE_ID_DMA_4,
449 GAUDI_ENGINE_ID_DMA_5,
450 GAUDI_ENGINE_ID_DMA_6,
451 GAUDI_ENGINE_ID_DMA_7,
452 GAUDI_ENGINE_ID_MME_0,
453 GAUDI_ENGINE_ID_MME_1,
454 GAUDI_ENGINE_ID_MME_2,
455 GAUDI_ENGINE_ID_MME_3,
456 GAUDI_ENGINE_ID_TPC_0,
457 GAUDI_ENGINE_ID_TPC_1,
458 GAUDI_ENGINE_ID_TPC_2,
459 GAUDI_ENGINE_ID_TPC_3,
460 GAUDI_ENGINE_ID_TPC_4,
461 GAUDI_ENGINE_ID_TPC_5,
462 GAUDI_ENGINE_ID_TPC_6,
463 GAUDI_ENGINE_ID_TPC_7,
464 GAUDI_ENGINE_ID_NIC_0,
465 GAUDI_ENGINE_ID_NIC_1,
466 GAUDI_ENGINE_ID_NIC_2,
467 GAUDI_ENGINE_ID_NIC_3,
468 GAUDI_ENGINE_ID_NIC_4,
469 GAUDI_ENGINE_ID_NIC_5,
470 GAUDI_ENGINE_ID_NIC_6,
471 GAUDI_ENGINE_ID_NIC_7,
472 GAUDI_ENGINE_ID_NIC_8,
473 GAUDI_ENGINE_ID_NIC_9,
474 GAUDI_ENGINE_ID_SIZE
475};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700476enum gaudi2_engine_id {
477 GAUDI2_DCORE0_ENGINE_ID_EDMA_0 = 0,
478 GAUDI2_DCORE0_ENGINE_ID_EDMA_1,
479 GAUDI2_DCORE0_ENGINE_ID_MME,
480 GAUDI2_DCORE0_ENGINE_ID_TPC_0,
481 GAUDI2_DCORE0_ENGINE_ID_TPC_1,
482 GAUDI2_DCORE0_ENGINE_ID_TPC_2,
483 GAUDI2_DCORE0_ENGINE_ID_TPC_3,
484 GAUDI2_DCORE0_ENGINE_ID_TPC_4,
485 GAUDI2_DCORE0_ENGINE_ID_TPC_5,
486 GAUDI2_DCORE0_ENGINE_ID_DEC_0,
487 GAUDI2_DCORE0_ENGINE_ID_DEC_1,
488 GAUDI2_DCORE1_ENGINE_ID_EDMA_0,
489 GAUDI2_DCORE1_ENGINE_ID_EDMA_1,
490 GAUDI2_DCORE1_ENGINE_ID_MME,
491 GAUDI2_DCORE1_ENGINE_ID_TPC_0,
492 GAUDI2_DCORE1_ENGINE_ID_TPC_1,
493 GAUDI2_DCORE1_ENGINE_ID_TPC_2,
494 GAUDI2_DCORE1_ENGINE_ID_TPC_3,
495 GAUDI2_DCORE1_ENGINE_ID_TPC_4,
496 GAUDI2_DCORE1_ENGINE_ID_TPC_5,
497 GAUDI2_DCORE1_ENGINE_ID_DEC_0,
498 GAUDI2_DCORE1_ENGINE_ID_DEC_1,
499 GAUDI2_DCORE2_ENGINE_ID_EDMA_0,
500 GAUDI2_DCORE2_ENGINE_ID_EDMA_1,
501 GAUDI2_DCORE2_ENGINE_ID_MME,
502 GAUDI2_DCORE2_ENGINE_ID_TPC_0,
503 GAUDI2_DCORE2_ENGINE_ID_TPC_1,
504 GAUDI2_DCORE2_ENGINE_ID_TPC_2,
505 GAUDI2_DCORE2_ENGINE_ID_TPC_3,
506 GAUDI2_DCORE2_ENGINE_ID_TPC_4,
507 GAUDI2_DCORE2_ENGINE_ID_TPC_5,
508 GAUDI2_DCORE2_ENGINE_ID_DEC_0,
509 GAUDI2_DCORE2_ENGINE_ID_DEC_1,
510 GAUDI2_DCORE3_ENGINE_ID_EDMA_0,
511 GAUDI2_DCORE3_ENGINE_ID_EDMA_1,
512 GAUDI2_DCORE3_ENGINE_ID_MME,
513 GAUDI2_DCORE3_ENGINE_ID_TPC_0,
514 GAUDI2_DCORE3_ENGINE_ID_TPC_1,
515 GAUDI2_DCORE3_ENGINE_ID_TPC_2,
516 GAUDI2_DCORE3_ENGINE_ID_TPC_3,
517 GAUDI2_DCORE3_ENGINE_ID_TPC_4,
518 GAUDI2_DCORE3_ENGINE_ID_TPC_5,
519 GAUDI2_DCORE3_ENGINE_ID_DEC_0,
520 GAUDI2_DCORE3_ENGINE_ID_DEC_1,
521 GAUDI2_DCORE0_ENGINE_ID_TPC_6,
522 GAUDI2_ENGINE_ID_PDMA_0,
523 GAUDI2_ENGINE_ID_PDMA_1,
524 GAUDI2_ENGINE_ID_ROT_0,
525 GAUDI2_ENGINE_ID_ROT_1,
526 GAUDI2_PCIE_ENGINE_ID_DEC_0,
527 GAUDI2_PCIE_ENGINE_ID_DEC_1,
528 GAUDI2_ENGINE_ID_NIC0_0,
529 GAUDI2_ENGINE_ID_NIC0_1,
530 GAUDI2_ENGINE_ID_NIC1_0,
531 GAUDI2_ENGINE_ID_NIC1_1,
532 GAUDI2_ENGINE_ID_NIC2_0,
533 GAUDI2_ENGINE_ID_NIC2_1,
534 GAUDI2_ENGINE_ID_NIC3_0,
535 GAUDI2_ENGINE_ID_NIC3_1,
536 GAUDI2_ENGINE_ID_NIC4_0,
537 GAUDI2_ENGINE_ID_NIC4_1,
538 GAUDI2_ENGINE_ID_NIC5_0,
539 GAUDI2_ENGINE_ID_NIC5_1,
540 GAUDI2_ENGINE_ID_NIC6_0,
541 GAUDI2_ENGINE_ID_NIC6_1,
542 GAUDI2_ENGINE_ID_NIC7_0,
543 GAUDI2_ENGINE_ID_NIC7_1,
544 GAUDI2_ENGINE_ID_NIC8_0,
545 GAUDI2_ENGINE_ID_NIC8_1,
546 GAUDI2_ENGINE_ID_NIC9_0,
547 GAUDI2_ENGINE_ID_NIC9_1,
548 GAUDI2_ENGINE_ID_NIC10_0,
549 GAUDI2_ENGINE_ID_NIC10_1,
550 GAUDI2_ENGINE_ID_NIC11_0,
551 GAUDI2_ENGINE_ID_NIC11_1,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800552 GAUDI2_ENGINE_ID_PCIE,
553 GAUDI2_ENGINE_ID_PSOC,
554 GAUDI2_ENGINE_ID_ARC_FARM,
555 GAUDI2_ENGINE_ID_KDMA,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700556 GAUDI2_ENGINE_ID_SIZE
557};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000558enum hl_goya_pll_index {
559 HL_GOYA_CPU_PLL = 0,
560 HL_GOYA_IC_PLL,
561 HL_GOYA_MC_PLL,
562 HL_GOYA_MME_PLL,
563 HL_GOYA_PCI_PLL,
564 HL_GOYA_EMMC_PLL,
565 HL_GOYA_TPC_PLL,
566 HL_GOYA_PLL_MAX
567};
568enum hl_gaudi_pll_index {
569 HL_GAUDI_CPU_PLL = 0,
570 HL_GAUDI_PCI_PLL,
571 HL_GAUDI_SRAM_PLL,
572 HL_GAUDI_HBM_PLL,
573 HL_GAUDI_NIC_PLL,
574 HL_GAUDI_DMA_PLL,
575 HL_GAUDI_MESH_PLL,
576 HL_GAUDI_MME_PLL,
577 HL_GAUDI_TPC_PLL,
578 HL_GAUDI_IF_PLL,
579 HL_GAUDI_PLL_MAX
580};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700581enum hl_gaudi2_pll_index {
582 HL_GAUDI2_CPU_PLL = 0,
583 HL_GAUDI2_PCI_PLL,
584 HL_GAUDI2_SRAM_PLL,
585 HL_GAUDI2_HBM_PLL,
586 HL_GAUDI2_NIC_PLL,
587 HL_GAUDI2_DMA_PLL,
588 HL_GAUDI2_MESH_PLL,
589 HL_GAUDI2_MME_PLL,
590 HL_GAUDI2_TPC_PLL,
591 HL_GAUDI2_IF_PLL,
592 HL_GAUDI2_VID_PLL,
593 HL_GAUDI2_MSS_PLL,
594 HL_GAUDI2_PLL_MAX
595};
596enum hl_goya_dma_direction {
597 HL_DMA_HOST_TO_DRAM,
598 HL_DMA_HOST_TO_SRAM,
599 HL_DMA_DRAM_TO_SRAM,
600 HL_DMA_SRAM_TO_DRAM,
601 HL_DMA_SRAM_TO_HOST,
602 HL_DMA_DRAM_TO_HOST,
603 HL_DMA_DRAM_TO_DRAM,
604 HL_DMA_SRAM_TO_SRAM,
605 HL_DMA_ENUM_MAX
606};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700607enum hl_device_status {
608 HL_DEVICE_STATUS_OPERATIONAL,
609 HL_DEVICE_STATUS_IN_RESET,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800610 HL_DEVICE_STATUS_MALFUNCTION,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700611 HL_DEVICE_STATUS_NEEDS_RESET,
612 HL_DEVICE_STATUS_IN_DEVICE_CREATION,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700613 HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE,
614 HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700615};
616enum hl_server_type {
617 HL_SERVER_TYPE_UNKNOWN = 0,
618 HL_SERVER_GAUDI_HLS1 = 1,
619 HL_SERVER_GAUDI_HLS1H = 2,
620 HL_SERVER_GAUDI_TYPE1 = 3,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700621 HL_SERVER_GAUDI_TYPE2 = 4,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700622 HL_SERVER_GAUDI2_HLS2 = 5,
623 HL_SERVER_GAUDI2_TYPE1 = 7
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700624};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000625#define HL_NOTIFIER_EVENT_TPC_ASSERT (1ULL << 0)
626#define HL_NOTIFIER_EVENT_UNDEFINED_OPCODE (1ULL << 1)
627#define HL_NOTIFIER_EVENT_DEVICE_RESET (1ULL << 2)
628#define HL_NOTIFIER_EVENT_CS_TIMEOUT (1ULL << 3)
629#define HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE (1ULL << 4)
630#define HL_NOTIFIER_EVENT_USER_ENGINE_ERR (1ULL << 5)
631#define HL_NOTIFIER_EVENT_GENERAL_HW_ERR (1ULL << 6)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800632#define HL_NOTIFIER_EVENT_RAZWI (1ULL << 7)
633#define HL_NOTIFIER_EVENT_PAGE_FAULT (1ULL << 8)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700634#define HL_NOTIFIER_EVENT_CRITICL_HW_ERR (1ULL << 9)
635#define HL_NOTIFIER_EVENT_CRITICL_FW_ERR (1ULL << 10)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700636#define HL_INFO_HW_IP_INFO 0
637#define HL_INFO_HW_EVENTS 1
638#define HL_INFO_DRAM_USAGE 2
639#define HL_INFO_HW_IDLE 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700640#define HL_INFO_DEVICE_STATUS 4
Christopher Ferris9584fa42019-12-09 15:36:13 -0800641#define HL_INFO_DEVICE_UTILIZATION 6
642#define HL_INFO_HW_EVENTS_AGGREGATE 7
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800643#define HL_INFO_CLK_RATE 8
644#define HL_INFO_RESET_COUNT 9
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700645#define HL_INFO_TIME_SYNC 10
Christopher Ferris25c18d42020-10-14 17:42:58 -0700646#define HL_INFO_CS_COUNTERS 11
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800647#define HL_INFO_PCI_COUNTERS 12
648#define HL_INFO_CLK_THROTTLE_REASON 13
649#define HL_INFO_SYNC_MANAGER 14
650#define HL_INFO_TOTAL_ENERGY 15
Christopher Ferris05667cd2021-02-16 16:01:34 -0800651#define HL_INFO_PLL_FREQUENCY 16
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000652#define HL_INFO_POWER 17
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000653#define HL_INFO_OPEN_STATS 18
Christopher Ferris1ed55342022-03-22 16:06:25 -0700654#define HL_INFO_DRAM_REPLACED_ROWS 21
655#define HL_INFO_DRAM_PENDING_ROWS 22
656#define HL_INFO_LAST_ERR_OPEN_DEV_TIME 23
657#define HL_INFO_CS_TIMEOUT_EVENT 24
658#define HL_INFO_RAZWI_EVENT 25
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700659#define HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES 26
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000660#define HL_INFO_SECURED_ATTESTATION 27
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700661#define HL_INFO_REGISTER_EVENTFD 28
662#define HL_INFO_UNREGISTER_EVENTFD 29
663#define HL_INFO_GET_EVENTS 30
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700664#define HL_INFO_UNDEFINED_OPCODE_EVENT 31
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000665#define HL_INFO_ENGINE_STATUS 32
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800666#define HL_INFO_PAGE_FAULT_EVENT 33
667#define HL_INFO_USER_MAPPINGS 34
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000668#define HL_INFO_FW_GENERIC_REQ 35
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700669#define HL_INFO_HW_ERR_EVENT 36
670#define HL_INFO_FW_ERR_EVENT 37
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700671#define HL_INFO_VERSION_MAX_LEN 128
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800672#define HL_INFO_CARD_NAME_MAX_LEN 16
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000673#define HL_ENGINES_DATA_MAX_SIZE SZ_1M
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700674struct hl_info_hw_ip_info {
675 __u64 sram_base_address;
676 __u64 dram_base_address;
677 __u64 dram_size;
678 __u32 sram_size;
679 __u32 num_of_events;
680 __u32 device_id;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700681 __u32 module_id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700682 __u32 decoder_enabled_mask;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700683 __u16 first_available_interrupt_id;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700684 __u16 server_type;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800685 __u32 cpld_version;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700686 __u32 psoc_pci_pll_nr;
687 __u32 psoc_pci_pll_nf;
688 __u32 psoc_pci_pll_od;
689 __u32 psoc_pci_pll_div_factor;
690 __u8 tpc_enabled_mask;
691 __u8 dram_enabled;
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000692 __u8 security_enabled;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700693 __u8 mme_master_slave_mode;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800694 __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN];
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800695 __u8 card_name[HL_INFO_CARD_NAME_MAX_LEN];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700696 __u64 tpc_enabled_mask_ext;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700697 __u64 dram_page_size;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700698 __u32 edma_enabled_mask;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700699 __u16 number_of_user_interrupts;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700700 __u8 reserved1;
701 __u8 reserved2;
702 __u64 reserved3;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700703 __u64 device_mem_alloc_default_page_size;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700704 __u64 reserved4;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800705 __u64 reserved5;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700706 __u32 reserved6;
707 __u8 reserved7;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800708 __u8 revision_id;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700709 __u16 tpc_interrupt_id;
710 __u32 rotator_enabled_mask;
711 __u32 reserved9;
712 __u64 engine_core_interrupt_reg_addr;
713 __u64 reserved_dram_size;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700714};
715struct hl_info_dram_usage {
716 __u64 dram_free_mem;
717 __u64 ctx_dram_mem;
718};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800719#define HL_BUSY_ENGINES_MASK_EXT_SIZE 4
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700720struct hl_info_hw_idle {
721 __u32 is_idle;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700722 __u32 busy_engines_mask;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700723 __u64 busy_engines_mask_ext[HL_BUSY_ENGINES_MASK_EXT_SIZE];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700724};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700725struct hl_info_device_status {
726 __u32 status;
727 __u32 pad;
728};
Christopher Ferris9584fa42019-12-09 15:36:13 -0800729struct hl_info_device_utilization {
730 __u32 utilization;
731 __u32 pad;
732};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800733struct hl_info_clk_rate {
734 __u32 cur_clk_rate_mhz;
735 __u32 max_clk_rate_mhz;
736};
737struct hl_info_reset_count {
738 __u32 hard_reset_cnt;
739 __u32 soft_reset_cnt;
740};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700741struct hl_info_time_sync {
742 __u64 device_time;
743 __u64 host_time;
744};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800745struct hl_info_pci_counters {
746 __u64 rx_throughput;
747 __u64 tx_throughput;
748 __u64 replay_cnt;
749};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700750enum hl_clk_throttling_type {
751 HL_CLK_THROTTLE_TYPE_POWER,
752 HL_CLK_THROTTLE_TYPE_THERMAL,
753 HL_CLK_THROTTLE_TYPE_MAX
754};
755#define HL_CLK_THROTTLE_POWER (1 << HL_CLK_THROTTLE_TYPE_POWER)
756#define HL_CLK_THROTTLE_THERMAL (1 << HL_CLK_THROTTLE_TYPE_THERMAL)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800757struct hl_info_clk_throttle {
758 __u32 clk_throttling_reason;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700759 __u32 pad;
760 __u64 clk_throttling_timestamp_us[HL_CLK_THROTTLE_TYPE_MAX];
761 __u64 clk_throttling_duration_ns[HL_CLK_THROTTLE_TYPE_MAX];
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800762};
763struct hl_info_energy {
764 __u64 total_energy_consumption;
765};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800766#define HL_PLL_NUM_OUTPUTS 4
767struct hl_pll_frequency_info {
768 __u16 output[HL_PLL_NUM_OUTPUTS];
769};
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000770struct hl_open_stats_info {
771 __u64 open_counter;
772 __u64 last_open_period_ms;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700773 __u8 is_compute_ctx_active;
774 __u8 compute_ctx_in_release;
775 __u8 pad[6];
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000776};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000777struct hl_power_info {
778 __u64 power;
779};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800780struct hl_info_sync_manager {
781 __u32 first_available_sync_object;
782 __u32 first_available_monitor;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700783 __u32 first_available_cq;
784 __u32 reserved;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800785};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700786struct hl_info_cs_counters {
Christopher Ferris05667cd2021-02-16 16:01:34 -0800787 __u64 total_out_of_mem_drop_cnt;
788 __u64 ctx_out_of_mem_drop_cnt;
789 __u64 total_parsing_drop_cnt;
790 __u64 ctx_parsing_drop_cnt;
791 __u64 total_queue_full_drop_cnt;
792 __u64 ctx_queue_full_drop_cnt;
793 __u64 total_device_in_reset_drop_cnt;
794 __u64 ctx_device_in_reset_drop_cnt;
795 __u64 total_max_cs_in_flight_drop_cnt;
796 __u64 ctx_max_cs_in_flight_drop_cnt;
797 __u64 total_validation_drop_cnt;
798 __u64 ctx_validation_drop_cnt;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700799};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700800struct hl_info_last_err_open_dev_time {
801 __s64 timestamp;
802};
803struct hl_info_cs_timeout_event {
804 __s64 timestamp;
805 __u64 seq;
806};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800807#define HL_RAZWI_NA_ENG_ID U16_MAX
808#define HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR 128
809#define HL_RAZWI_READ BIT(0)
810#define HL_RAZWI_WRITE BIT(1)
811#define HL_RAZWI_LBW BIT(2)
812#define HL_RAZWI_HBW BIT(3)
813#define HL_RAZWI_RR BIT(4)
814#define HL_RAZWI_ADDR_DEC BIT(5)
Christopher Ferris1ed55342022-03-22 16:06:25 -0700815struct hl_info_razwi_event {
816 __s64 timestamp;
817 __u64 addr;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800818 __u16 engine_id[HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR];
819 __u16 num_of_possible_engines;
820 __u8 flags;
821 __u8 pad[5];
Christopher Ferris1ed55342022-03-22 16:06:25 -0700822};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700823#define MAX_QMAN_STREAMS_INFO 4
824#define OPCODE_INFO_MAX_ADDR_SIZE 8
825struct hl_info_undefined_opcode_event {
826 __s64 timestamp;
827 __u64 cb_addr_streams[MAX_QMAN_STREAMS_INFO][OPCODE_INFO_MAX_ADDR_SIZE];
828 __u64 cq_addr;
829 __u32 cq_size;
830 __u32 cb_addr_streams_len;
831 __u32 engine_id;
832 __u32 stream_id;
833};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700834struct hl_info_hw_err_event {
835 __s64 timestamp;
836 __u16 event_id;
837 __u16 pad[3];
838};
839enum hl_info_fw_err_type {
840 HL_INFO_FW_HEARTBEAT_ERR,
841 HL_INFO_FW_REPORTED_ERR,
842};
843struct hl_info_fw_err_event {
844 __s64 timestamp;
845 __u16 err_type;
846 __u16 event_id;
847 __u32 pad;
848};
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700849struct hl_info_dev_memalloc_page_sizes {
850 __u64 page_order_bitmask;
851};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000852#define SEC_PCR_DATA_BUF_SZ 256
853#define SEC_PCR_QUOTE_BUF_SZ 510
854#define SEC_SIGNATURE_BUF_SZ 255
855#define SEC_PUB_DATA_BUF_SZ 510
856#define SEC_CERTIFICATE_BUF_SZ 2046
857struct hl_info_sec_attest {
858 __u32 nonce;
859 __u16 pcr_quote_len;
860 __u16 pub_data_len;
861 __u16 certificate_len;
862 __u8 pcr_num_reg;
863 __u8 pcr_reg_len;
864 __u8 quote_sig_len;
865 __u8 pcr_data[SEC_PCR_DATA_BUF_SZ];
866 __u8 pcr_quote[SEC_PCR_QUOTE_BUF_SZ];
867 __u8 quote_sig[SEC_SIGNATURE_BUF_SZ];
868 __u8 public_data[SEC_PUB_DATA_BUF_SZ];
869 __u8 certificate[SEC_CERTIFICATE_BUF_SZ];
870 __u8 pad0[2];
871};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800872struct hl_page_fault_info {
873 __s64 timestamp;
874 __u64 addr;
875 __u16 engine_id;
876 __u8 pad[6];
877};
878struct hl_user_mapping {
879 __u64 dev_va;
880 __u64 size;
881};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800882enum gaudi_dcores {
883 HL_GAUDI_WS_DCORE,
884 HL_GAUDI_WN_DCORE,
885 HL_GAUDI_EN_DCORE,
886 HL_GAUDI_ES_DCORE
887};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700888struct hl_info_args {
889 __u64 return_pointer;
890 __u32 return_size;
891 __u32 op;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800892 union {
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800893 __u32 dcore_id;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800894 __u32 ctx_id;
895 __u32 period_ms;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800896 __u32 pll_index;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700897 __u32 eventfd;
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000898 __u32 user_buffer_actual_size;
899 __u32 sec_attest_nonce;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800900 __u32 array_size;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000901 __u32 fw_sub_opcode;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800902 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700903 __u32 pad;
904};
905#define HL_CB_OP_CREATE 0
906#define HL_CB_OP_DESTROY 1
Christopher Ferris05667cd2021-02-16 16:01:34 -0800907#define HL_CB_OP_INFO 2
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700908#define HL_MAX_CB_SIZE (0x200000 - 32)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800909#define HL_CB_FLAGS_MAP 0x1
Christopher Ferris1ed55342022-03-22 16:06:25 -0700910#define HL_CB_FLAGS_GET_DEVICE_VA 0x2
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700911struct hl_cb_in {
912 __u64 cb_handle;
913 __u32 op;
914 __u32 cb_size;
915 __u32 ctx_id;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800916 __u32 flags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700917};
918struct hl_cb_out {
Christopher Ferris05667cd2021-02-16 16:01:34 -0800919 union {
920 __u64 cb_handle;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700921 union {
922 struct {
923 __u32 usage_cnt;
924 __u32 pad;
925 };
926 __u64 device_va;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800927 };
928 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700929};
930union hl_cb_args {
931 struct hl_cb_in in;
932 struct hl_cb_out out;
933};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800934#define HL_CS_CHUNK_FLAGS_USER_ALLOC_CB 0x1
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700935struct hl_cs_chunk {
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700936 union {
937 __u64 cb_handle;
938 __u64 signal_seq_arr;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700939 __u64 encaps_signal_seq;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700940 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700941 __u32 queue_index;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700942 union {
943 __u32 cb_size;
944 __u32 num_signal_seq_arr;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700945 __u32 encaps_signal_offset;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700946 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700947 __u32 cs_chunk_flags;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800948 __u32 collective_engine_id;
949 __u32 pad[10];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700950};
951#define HL_CS_FLAGS_FORCE_RESTORE 0x1
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700952#define HL_CS_FLAGS_SIGNAL 0x2
953#define HL_CS_FLAGS_WAIT 0x4
Christopher Ferris05667cd2021-02-16 16:01:34 -0800954#define HL_CS_FLAGS_COLLECTIVE_WAIT 0x8
955#define HL_CS_FLAGS_TIMESTAMP 0x20
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700956#define HL_CS_FLAGS_STAGED_SUBMISSION 0x40
957#define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80
958#define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000959#define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000960#define HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT 0x400
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700961#define HL_CS_FLAGS_ENCAP_SIGNALS 0x800
962#define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000
963#define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000964#define HL_CS_FLAGS_ENGINE_CORE_COMMAND 0x4000
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000965#define HL_CS_FLAGS_FLUSH_PCI_HBW_WRITES 0x8000
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700966#define HL_CS_FLAGS_ENGINES_COMMAND 0x10000
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700967#define HL_CS_STATUS_SUCCESS 0
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800968#define HL_MAX_JOBS_PER_CS 512
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700969enum hl_engine_command {
970 HL_ENGINE_CORE_HALT = 1,
971 HL_ENGINE_CORE_RUN = 2,
972 HL_ENGINE_STALL = 3,
973 HL_ENGINE_RESUME = 4,
974 HL_ENGINE_COMMAND_MAX
975};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700976struct hl_cs_in {
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000977 union {
978 struct {
979 __u64 chunks_restore;
980 __u64 chunks_execute;
981 };
982 struct {
983 __u64 engine_cores;
984 __u32 num_engine_cores;
985 __u32 core_command;
986 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700987 struct {
988 __u64 engines;
989 __u32 num_engines;
990 __u32 engine_command;
991 };
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000992 };
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700993 union {
994 __u64 seq;
995 __u32 encaps_sig_handle_id;
996 struct {
997 __u32 encaps_signals_count;
998 __u32 encaps_signals_q_idx;
999 };
1000 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001001 __u32 num_chunks_restore;
1002 __u32 num_chunks_execute;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001003 __u32 timeout;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001004 __u32 cs_flags;
1005 __u32 ctx_id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001006 __u8 pad[4];
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001007};
1008struct hl_cs_out {
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001009 union {
1010 __u64 seq;
1011 struct {
1012 __u32 handle_id;
1013 __u32 count;
1014 };
1015 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001016 __u32 status;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001017 __u32 sob_base_addr_offset;
Christopher Ferris1ed55342022-03-22 16:06:25 -07001018 __u16 sob_count_before_submission;
1019 __u16 pad[3];
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001020};
1021union hl_cs_args {
1022 struct hl_cs_in in;
1023 struct hl_cs_out out;
1024};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001025#define HL_WAIT_CS_FLAGS_INTERRUPT 0x2
1026#define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001027#define HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT 0xFFF00000
1028#define HL_WAIT_CS_FLAGS_ANY_DEC_INTERRUPT 0xFFE00000
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001029#define HL_WAIT_CS_FLAGS_MULTI_CS 0x4
Christopher Ferris1ed55342022-03-22 16:06:25 -07001030#define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10
Christopher Ferris10a76e62022-06-08 13:31:52 -07001031#define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001032#define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001033struct hl_wait_cs_in {
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001034 union {
1035 struct {
1036 __u64 seq;
1037 __u64 timeout_us;
1038 };
1039 struct {
Christopher Ferris1ed55342022-03-22 16:06:25 -07001040 union {
1041 __u64 addr;
1042 __u64 cq_counters_handle;
1043 };
Christopher Ferrisa4792612022-01-10 13:51:15 -08001044 __u64 target;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001045 };
1046 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001047 __u32 ctx_id;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001048 __u32 flags;
Christopher Ferris1ed55342022-03-22 16:06:25 -07001049 union {
1050 struct {
1051 __u8 seq_arr_len;
1052 __u8 pad[7];
1053 };
1054 __u64 interrupt_timeout_us;
1055 };
1056 __u64 cq_counters_offset;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001057 __u64 timestamp_handle;
1058 __u64 timestamp_offset;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001059};
1060#define HL_WAIT_CS_STATUS_COMPLETED 0
1061#define HL_WAIT_CS_STATUS_BUSY 1
1062#define HL_WAIT_CS_STATUS_TIMEDOUT 2
1063#define HL_WAIT_CS_STATUS_ABORTED 3
Christopher Ferris05667cd2021-02-16 16:01:34 -08001064#define HL_WAIT_CS_STATUS_FLAG_GONE 0x1
1065#define HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD 0x2
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001066struct hl_wait_cs_out {
1067 __u32 status;
Christopher Ferris05667cd2021-02-16 16:01:34 -08001068 __u32 flags;
1069 __s64 timestamp_nsec;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001070 __u32 cs_completion_map;
1071 __u32 pad;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001072};
1073union hl_wait_cs_args {
1074 struct hl_wait_cs_in in;
1075 struct hl_wait_cs_out out;
1076};
1077#define HL_MEM_OP_ALLOC 0
1078#define HL_MEM_OP_FREE 1
1079#define HL_MEM_OP_MAP 2
1080#define HL_MEM_OP_UNMAP 3
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001081#define HL_MEM_OP_MAP_BLOCK 4
Christopher Ferrisa4792612022-01-10 13:51:15 -08001082#define HL_MEM_OP_EXPORT_DMABUF_FD 5
Christopher Ferris10a76e62022-06-08 13:31:52 -07001083#define HL_MEM_OP_TS_ALLOC 6
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001084#define HL_MEM_CONTIGUOUS 0x1
1085#define HL_MEM_SHARED 0x2
1086#define HL_MEM_USERPTR 0x4
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001087#define HL_MEM_FORCE_HINT 0x8
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001088#define HL_MEM_PREFETCH 0x40
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001089struct hl_mem_in {
1090 union {
1091 struct {
1092 __u64 mem_size;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001093 __u64 page_size;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001094 } alloc;
1095 struct {
1096 __u64 handle;
1097 } free;
1098 struct {
1099 __u64 hint_addr;
1100 __u64 handle;
1101 } map_device;
1102 struct {
1103 __u64 host_virt_addr;
1104 __u64 hint_addr;
1105 __u64 mem_size;
1106 } map_host;
1107 struct {
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001108 __u64 block_addr;
1109 } map_block;
1110 struct {
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001111 __u64 device_virt_addr;
1112 } unmap;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001113 struct {
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001114 __u64 addr;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001115 __u64 mem_size;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001116 __u64 offset;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001117 } export_dmabuf_fd;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001118 };
1119 __u32 op;
1120 __u32 flags;
1121 __u32 ctx_id;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001122 __u32 num_of_elements;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001123};
1124struct hl_mem_out {
1125 union {
1126 __u64 device_virt_addr;
1127 __u64 handle;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001128 struct {
1129 __u64 block_handle;
1130 __u32 block_size;
1131 __u32 pad;
1132 };
Christopher Ferrisa4792612022-01-10 13:51:15 -08001133 __s32 fd;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001134 };
1135};
1136union hl_mem_args {
1137 struct hl_mem_in in;
1138 struct hl_mem_out out;
1139};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001140#define HL_DEBUG_MAX_AUX_VALUES 10
1141struct hl_debug_params_etr {
1142 __u64 buffer_address;
1143 __u64 buffer_size;
1144 __u32 sink_mode;
1145 __u32 pad;
1146};
1147struct hl_debug_params_etf {
1148 __u64 buffer_address;
1149 __u64 buffer_size;
1150 __u32 sink_mode;
1151 __u32 pad;
1152};
1153struct hl_debug_params_stm {
1154 __u64 he_mask;
1155 __u64 sp_mask;
1156 __u32 id;
1157 __u32 frequency;
1158};
1159struct hl_debug_params_bmon {
1160 __u64 start_addr0;
1161 __u64 addr_mask0;
1162 __u64 start_addr1;
1163 __u64 addr_mask1;
1164 __u32 bw_win;
1165 __u32 win_capture;
1166 __u32 id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001167 __u32 control;
1168 __u64 start_addr2;
1169 __u64 end_addr2;
1170 __u64 start_addr3;
1171 __u64 end_addr3;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001172};
1173struct hl_debug_params_spmu {
1174 __u64 event_types[HL_DEBUG_MAX_AUX_VALUES];
1175 __u32 event_types_num;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001176 __u32 pmtrc_val;
1177 __u32 trc_ctrl_host_val;
1178 __u32 trc_en_host_val;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001179};
1180#define HL_DEBUG_OP_ETR 0
1181#define HL_DEBUG_OP_ETF 1
1182#define HL_DEBUG_OP_STM 2
1183#define HL_DEBUG_OP_FUNNEL 3
1184#define HL_DEBUG_OP_BMON 4
1185#define HL_DEBUG_OP_SPMU 5
1186#define HL_DEBUG_OP_TIMESTAMP 6
1187#define HL_DEBUG_OP_SET_MODE 7
1188struct hl_debug_args {
1189 __u64 input_ptr;
1190 __u64 output_ptr;
1191 __u32 input_size;
1192 __u32 output_size;
1193 __u32 op;
1194 __u32 reg_idx;
1195 __u32 enable;
1196 __u32 ctx_id;
1197};
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001198#define HL_IOCTL_INFO _IOWR('H', 0x01, struct hl_info_args)
1199#define HL_IOCTL_CB _IOWR('H', 0x02, union hl_cb_args)
1200#define HL_IOCTL_CS _IOWR('H', 0x03, union hl_cs_args)
1201#define HL_IOCTL_WAIT_CS _IOWR('H', 0x04, union hl_wait_cs_args)
1202#define HL_IOCTL_MEMORY _IOWR('H', 0x05, union hl_mem_args)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001203#define HL_IOCTL_DEBUG _IOWR('H', 0x06, struct hl_debug_args)
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001204#define HL_COMMAND_START 0x01
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001205#define HL_COMMAND_END 0x07
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001206#endif