blob: 44fd8c80b6d6506743873d3d47508765b49a83a5 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferris24f97eb2019-05-20 12:58:13 -07007#ifndef HABANALABS_H_
8#define HABANALABS_H_
9#include <linux/types.h>
10#include <linux/ioctl.h>
11#define GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START 0x8000
Christopher Ferris8177cdf2020-08-03 11:53:55 -070012#define GAUDI_DRIVER_SRAM_RESERVED_SIZE_FROM_START 0x80
Christopher Ferris05667cd2021-02-16 16:01:34 -080013#define GAUDI_FIRST_AVAILABLE_W_S_SYNC_OBJECT 144
14#define GAUDI_FIRST_AVAILABLE_W_S_MONITOR 72
Christopher Ferris10a76e62022-06-08 13:31:52 -070015#define TS_MAX_ELEMENTS_NUM (1 << 20)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070016enum goya_queue_id {
17 GOYA_QUEUE_ID_DMA_0 = 0,
Christopher Ferris9584fa42019-12-09 15:36:13 -080018 GOYA_QUEUE_ID_DMA_1 = 1,
19 GOYA_QUEUE_ID_DMA_2 = 2,
20 GOYA_QUEUE_ID_DMA_3 = 3,
21 GOYA_QUEUE_ID_DMA_4 = 4,
22 GOYA_QUEUE_ID_CPU_PQ = 5,
23 GOYA_QUEUE_ID_MME = 6,
24 GOYA_QUEUE_ID_TPC0 = 7,
25 GOYA_QUEUE_ID_TPC1 = 8,
26 GOYA_QUEUE_ID_TPC2 = 9,
27 GOYA_QUEUE_ID_TPC3 = 10,
28 GOYA_QUEUE_ID_TPC4 = 11,
29 GOYA_QUEUE_ID_TPC5 = 12,
30 GOYA_QUEUE_ID_TPC6 = 13,
31 GOYA_QUEUE_ID_TPC7 = 14,
Christopher Ferris24f97eb2019-05-20 12:58:13 -070032 GOYA_QUEUE_ID_SIZE
33};
Christopher Ferris8177cdf2020-08-03 11:53:55 -070034enum gaudi_queue_id {
35 GAUDI_QUEUE_ID_DMA_0_0 = 0,
36 GAUDI_QUEUE_ID_DMA_0_1 = 1,
37 GAUDI_QUEUE_ID_DMA_0_2 = 2,
38 GAUDI_QUEUE_ID_DMA_0_3 = 3,
39 GAUDI_QUEUE_ID_DMA_1_0 = 4,
40 GAUDI_QUEUE_ID_DMA_1_1 = 5,
41 GAUDI_QUEUE_ID_DMA_1_2 = 6,
42 GAUDI_QUEUE_ID_DMA_1_3 = 7,
43 GAUDI_QUEUE_ID_CPU_PQ = 8,
44 GAUDI_QUEUE_ID_DMA_2_0 = 9,
45 GAUDI_QUEUE_ID_DMA_2_1 = 10,
46 GAUDI_QUEUE_ID_DMA_2_2 = 11,
47 GAUDI_QUEUE_ID_DMA_2_3 = 12,
48 GAUDI_QUEUE_ID_DMA_3_0 = 13,
49 GAUDI_QUEUE_ID_DMA_3_1 = 14,
50 GAUDI_QUEUE_ID_DMA_3_2 = 15,
51 GAUDI_QUEUE_ID_DMA_3_3 = 16,
52 GAUDI_QUEUE_ID_DMA_4_0 = 17,
53 GAUDI_QUEUE_ID_DMA_4_1 = 18,
54 GAUDI_QUEUE_ID_DMA_4_2 = 19,
55 GAUDI_QUEUE_ID_DMA_4_3 = 20,
56 GAUDI_QUEUE_ID_DMA_5_0 = 21,
57 GAUDI_QUEUE_ID_DMA_5_1 = 22,
58 GAUDI_QUEUE_ID_DMA_5_2 = 23,
59 GAUDI_QUEUE_ID_DMA_5_3 = 24,
60 GAUDI_QUEUE_ID_DMA_6_0 = 25,
61 GAUDI_QUEUE_ID_DMA_6_1 = 26,
62 GAUDI_QUEUE_ID_DMA_6_2 = 27,
63 GAUDI_QUEUE_ID_DMA_6_3 = 28,
64 GAUDI_QUEUE_ID_DMA_7_0 = 29,
65 GAUDI_QUEUE_ID_DMA_7_1 = 30,
66 GAUDI_QUEUE_ID_DMA_7_2 = 31,
67 GAUDI_QUEUE_ID_DMA_7_3 = 32,
68 GAUDI_QUEUE_ID_MME_0_0 = 33,
69 GAUDI_QUEUE_ID_MME_0_1 = 34,
70 GAUDI_QUEUE_ID_MME_0_2 = 35,
71 GAUDI_QUEUE_ID_MME_0_3 = 36,
72 GAUDI_QUEUE_ID_MME_1_0 = 37,
73 GAUDI_QUEUE_ID_MME_1_1 = 38,
74 GAUDI_QUEUE_ID_MME_1_2 = 39,
75 GAUDI_QUEUE_ID_MME_1_3 = 40,
76 GAUDI_QUEUE_ID_TPC_0_0 = 41,
77 GAUDI_QUEUE_ID_TPC_0_1 = 42,
78 GAUDI_QUEUE_ID_TPC_0_2 = 43,
79 GAUDI_QUEUE_ID_TPC_0_3 = 44,
80 GAUDI_QUEUE_ID_TPC_1_0 = 45,
81 GAUDI_QUEUE_ID_TPC_1_1 = 46,
82 GAUDI_QUEUE_ID_TPC_1_2 = 47,
83 GAUDI_QUEUE_ID_TPC_1_3 = 48,
84 GAUDI_QUEUE_ID_TPC_2_0 = 49,
85 GAUDI_QUEUE_ID_TPC_2_1 = 50,
86 GAUDI_QUEUE_ID_TPC_2_2 = 51,
87 GAUDI_QUEUE_ID_TPC_2_3 = 52,
88 GAUDI_QUEUE_ID_TPC_3_0 = 53,
89 GAUDI_QUEUE_ID_TPC_3_1 = 54,
90 GAUDI_QUEUE_ID_TPC_3_2 = 55,
91 GAUDI_QUEUE_ID_TPC_3_3 = 56,
92 GAUDI_QUEUE_ID_TPC_4_0 = 57,
93 GAUDI_QUEUE_ID_TPC_4_1 = 58,
94 GAUDI_QUEUE_ID_TPC_4_2 = 59,
95 GAUDI_QUEUE_ID_TPC_4_3 = 60,
96 GAUDI_QUEUE_ID_TPC_5_0 = 61,
97 GAUDI_QUEUE_ID_TPC_5_1 = 62,
98 GAUDI_QUEUE_ID_TPC_5_2 = 63,
99 GAUDI_QUEUE_ID_TPC_5_3 = 64,
100 GAUDI_QUEUE_ID_TPC_6_0 = 65,
101 GAUDI_QUEUE_ID_TPC_6_1 = 66,
102 GAUDI_QUEUE_ID_TPC_6_2 = 67,
103 GAUDI_QUEUE_ID_TPC_6_3 = 68,
104 GAUDI_QUEUE_ID_TPC_7_0 = 69,
105 GAUDI_QUEUE_ID_TPC_7_1 = 70,
106 GAUDI_QUEUE_ID_TPC_7_2 = 71,
107 GAUDI_QUEUE_ID_TPC_7_3 = 72,
108 GAUDI_QUEUE_ID_NIC_0_0 = 73,
109 GAUDI_QUEUE_ID_NIC_0_1 = 74,
110 GAUDI_QUEUE_ID_NIC_0_2 = 75,
111 GAUDI_QUEUE_ID_NIC_0_3 = 76,
112 GAUDI_QUEUE_ID_NIC_1_0 = 77,
113 GAUDI_QUEUE_ID_NIC_1_1 = 78,
114 GAUDI_QUEUE_ID_NIC_1_2 = 79,
115 GAUDI_QUEUE_ID_NIC_1_3 = 80,
116 GAUDI_QUEUE_ID_NIC_2_0 = 81,
117 GAUDI_QUEUE_ID_NIC_2_1 = 82,
118 GAUDI_QUEUE_ID_NIC_2_2 = 83,
119 GAUDI_QUEUE_ID_NIC_2_3 = 84,
120 GAUDI_QUEUE_ID_NIC_3_0 = 85,
121 GAUDI_QUEUE_ID_NIC_3_1 = 86,
122 GAUDI_QUEUE_ID_NIC_3_2 = 87,
123 GAUDI_QUEUE_ID_NIC_3_3 = 88,
124 GAUDI_QUEUE_ID_NIC_4_0 = 89,
125 GAUDI_QUEUE_ID_NIC_4_1 = 90,
126 GAUDI_QUEUE_ID_NIC_4_2 = 91,
127 GAUDI_QUEUE_ID_NIC_4_3 = 92,
128 GAUDI_QUEUE_ID_NIC_5_0 = 93,
129 GAUDI_QUEUE_ID_NIC_5_1 = 94,
130 GAUDI_QUEUE_ID_NIC_5_2 = 95,
131 GAUDI_QUEUE_ID_NIC_5_3 = 96,
132 GAUDI_QUEUE_ID_NIC_6_0 = 97,
133 GAUDI_QUEUE_ID_NIC_6_1 = 98,
134 GAUDI_QUEUE_ID_NIC_6_2 = 99,
135 GAUDI_QUEUE_ID_NIC_6_3 = 100,
136 GAUDI_QUEUE_ID_NIC_7_0 = 101,
137 GAUDI_QUEUE_ID_NIC_7_1 = 102,
138 GAUDI_QUEUE_ID_NIC_7_2 = 103,
139 GAUDI_QUEUE_ID_NIC_7_3 = 104,
140 GAUDI_QUEUE_ID_NIC_8_0 = 105,
141 GAUDI_QUEUE_ID_NIC_8_1 = 106,
142 GAUDI_QUEUE_ID_NIC_8_2 = 107,
143 GAUDI_QUEUE_ID_NIC_8_3 = 108,
144 GAUDI_QUEUE_ID_NIC_9_0 = 109,
145 GAUDI_QUEUE_ID_NIC_9_1 = 110,
146 GAUDI_QUEUE_ID_NIC_9_2 = 111,
147 GAUDI_QUEUE_ID_NIC_9_3 = 112,
148 GAUDI_QUEUE_ID_SIZE
149};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700150enum gaudi2_queue_id {
151 GAUDI2_QUEUE_ID_PDMA_0_0 = 0,
152 GAUDI2_QUEUE_ID_PDMA_0_1 = 1,
153 GAUDI2_QUEUE_ID_PDMA_0_2 = 2,
154 GAUDI2_QUEUE_ID_PDMA_0_3 = 3,
155 GAUDI2_QUEUE_ID_PDMA_1_0 = 4,
156 GAUDI2_QUEUE_ID_PDMA_1_1 = 5,
157 GAUDI2_QUEUE_ID_PDMA_1_2 = 6,
158 GAUDI2_QUEUE_ID_PDMA_1_3 = 7,
159 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_0 = 8,
160 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_1 = 9,
161 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_2 = 10,
162 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_3 = 11,
163 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_0 = 12,
164 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_1 = 13,
165 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_2 = 14,
166 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_3 = 15,
167 GAUDI2_QUEUE_ID_DCORE0_MME_0_0 = 16,
168 GAUDI2_QUEUE_ID_DCORE0_MME_0_1 = 17,
169 GAUDI2_QUEUE_ID_DCORE0_MME_0_2 = 18,
170 GAUDI2_QUEUE_ID_DCORE0_MME_0_3 = 19,
171 GAUDI2_QUEUE_ID_DCORE0_TPC_0_0 = 20,
172 GAUDI2_QUEUE_ID_DCORE0_TPC_0_1 = 21,
173 GAUDI2_QUEUE_ID_DCORE0_TPC_0_2 = 22,
174 GAUDI2_QUEUE_ID_DCORE0_TPC_0_3 = 23,
175 GAUDI2_QUEUE_ID_DCORE0_TPC_1_0 = 24,
176 GAUDI2_QUEUE_ID_DCORE0_TPC_1_1 = 25,
177 GAUDI2_QUEUE_ID_DCORE0_TPC_1_2 = 26,
178 GAUDI2_QUEUE_ID_DCORE0_TPC_1_3 = 27,
179 GAUDI2_QUEUE_ID_DCORE0_TPC_2_0 = 28,
180 GAUDI2_QUEUE_ID_DCORE0_TPC_2_1 = 29,
181 GAUDI2_QUEUE_ID_DCORE0_TPC_2_2 = 30,
182 GAUDI2_QUEUE_ID_DCORE0_TPC_2_3 = 31,
183 GAUDI2_QUEUE_ID_DCORE0_TPC_3_0 = 32,
184 GAUDI2_QUEUE_ID_DCORE0_TPC_3_1 = 33,
185 GAUDI2_QUEUE_ID_DCORE0_TPC_3_2 = 34,
186 GAUDI2_QUEUE_ID_DCORE0_TPC_3_3 = 35,
187 GAUDI2_QUEUE_ID_DCORE0_TPC_4_0 = 36,
188 GAUDI2_QUEUE_ID_DCORE0_TPC_4_1 = 37,
189 GAUDI2_QUEUE_ID_DCORE0_TPC_4_2 = 38,
190 GAUDI2_QUEUE_ID_DCORE0_TPC_4_3 = 39,
191 GAUDI2_QUEUE_ID_DCORE0_TPC_5_0 = 40,
192 GAUDI2_QUEUE_ID_DCORE0_TPC_5_1 = 41,
193 GAUDI2_QUEUE_ID_DCORE0_TPC_5_2 = 42,
194 GAUDI2_QUEUE_ID_DCORE0_TPC_5_3 = 43,
195 GAUDI2_QUEUE_ID_DCORE0_TPC_6_0 = 44,
196 GAUDI2_QUEUE_ID_DCORE0_TPC_6_1 = 45,
197 GAUDI2_QUEUE_ID_DCORE0_TPC_6_2 = 46,
198 GAUDI2_QUEUE_ID_DCORE0_TPC_6_3 = 47,
199 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_0 = 48,
200 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_1 = 49,
201 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_2 = 50,
202 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_3 = 51,
203 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_0 = 52,
204 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_1 = 53,
205 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_2 = 54,
206 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_3 = 55,
207 GAUDI2_QUEUE_ID_DCORE1_MME_0_0 = 56,
208 GAUDI2_QUEUE_ID_DCORE1_MME_0_1 = 57,
209 GAUDI2_QUEUE_ID_DCORE1_MME_0_2 = 58,
210 GAUDI2_QUEUE_ID_DCORE1_MME_0_3 = 59,
211 GAUDI2_QUEUE_ID_DCORE1_TPC_0_0 = 60,
212 GAUDI2_QUEUE_ID_DCORE1_TPC_0_1 = 61,
213 GAUDI2_QUEUE_ID_DCORE1_TPC_0_2 = 62,
214 GAUDI2_QUEUE_ID_DCORE1_TPC_0_3 = 63,
215 GAUDI2_QUEUE_ID_DCORE1_TPC_1_0 = 64,
216 GAUDI2_QUEUE_ID_DCORE1_TPC_1_1 = 65,
217 GAUDI2_QUEUE_ID_DCORE1_TPC_1_2 = 66,
218 GAUDI2_QUEUE_ID_DCORE1_TPC_1_3 = 67,
219 GAUDI2_QUEUE_ID_DCORE1_TPC_2_0 = 68,
220 GAUDI2_QUEUE_ID_DCORE1_TPC_2_1 = 69,
221 GAUDI2_QUEUE_ID_DCORE1_TPC_2_2 = 70,
222 GAUDI2_QUEUE_ID_DCORE1_TPC_2_3 = 71,
223 GAUDI2_QUEUE_ID_DCORE1_TPC_3_0 = 72,
224 GAUDI2_QUEUE_ID_DCORE1_TPC_3_1 = 73,
225 GAUDI2_QUEUE_ID_DCORE1_TPC_3_2 = 74,
226 GAUDI2_QUEUE_ID_DCORE1_TPC_3_3 = 75,
227 GAUDI2_QUEUE_ID_DCORE1_TPC_4_0 = 76,
228 GAUDI2_QUEUE_ID_DCORE1_TPC_4_1 = 77,
229 GAUDI2_QUEUE_ID_DCORE1_TPC_4_2 = 78,
230 GAUDI2_QUEUE_ID_DCORE1_TPC_4_3 = 79,
231 GAUDI2_QUEUE_ID_DCORE1_TPC_5_0 = 80,
232 GAUDI2_QUEUE_ID_DCORE1_TPC_5_1 = 81,
233 GAUDI2_QUEUE_ID_DCORE1_TPC_5_2 = 82,
234 GAUDI2_QUEUE_ID_DCORE1_TPC_5_3 = 83,
235 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_0 = 84,
236 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_1 = 85,
237 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_2 = 86,
238 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_3 = 87,
239 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_0 = 88,
240 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_1 = 89,
241 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_2 = 90,
242 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_3 = 91,
243 GAUDI2_QUEUE_ID_DCORE2_MME_0_0 = 92,
244 GAUDI2_QUEUE_ID_DCORE2_MME_0_1 = 93,
245 GAUDI2_QUEUE_ID_DCORE2_MME_0_2 = 94,
246 GAUDI2_QUEUE_ID_DCORE2_MME_0_3 = 95,
247 GAUDI2_QUEUE_ID_DCORE2_TPC_0_0 = 96,
248 GAUDI2_QUEUE_ID_DCORE2_TPC_0_1 = 97,
249 GAUDI2_QUEUE_ID_DCORE2_TPC_0_2 = 98,
250 GAUDI2_QUEUE_ID_DCORE2_TPC_0_3 = 99,
251 GAUDI2_QUEUE_ID_DCORE2_TPC_1_0 = 100,
252 GAUDI2_QUEUE_ID_DCORE2_TPC_1_1 = 101,
253 GAUDI2_QUEUE_ID_DCORE2_TPC_1_2 = 102,
254 GAUDI2_QUEUE_ID_DCORE2_TPC_1_3 = 103,
255 GAUDI2_QUEUE_ID_DCORE2_TPC_2_0 = 104,
256 GAUDI2_QUEUE_ID_DCORE2_TPC_2_1 = 105,
257 GAUDI2_QUEUE_ID_DCORE2_TPC_2_2 = 106,
258 GAUDI2_QUEUE_ID_DCORE2_TPC_2_3 = 107,
259 GAUDI2_QUEUE_ID_DCORE2_TPC_3_0 = 108,
260 GAUDI2_QUEUE_ID_DCORE2_TPC_3_1 = 109,
261 GAUDI2_QUEUE_ID_DCORE2_TPC_3_2 = 110,
262 GAUDI2_QUEUE_ID_DCORE2_TPC_3_3 = 111,
263 GAUDI2_QUEUE_ID_DCORE2_TPC_4_0 = 112,
264 GAUDI2_QUEUE_ID_DCORE2_TPC_4_1 = 113,
265 GAUDI2_QUEUE_ID_DCORE2_TPC_4_2 = 114,
266 GAUDI2_QUEUE_ID_DCORE2_TPC_4_3 = 115,
267 GAUDI2_QUEUE_ID_DCORE2_TPC_5_0 = 116,
268 GAUDI2_QUEUE_ID_DCORE2_TPC_5_1 = 117,
269 GAUDI2_QUEUE_ID_DCORE2_TPC_5_2 = 118,
270 GAUDI2_QUEUE_ID_DCORE2_TPC_5_3 = 119,
271 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_0 = 120,
272 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_1 = 121,
273 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_2 = 122,
274 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_3 = 123,
275 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_0 = 124,
276 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_1 = 125,
277 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_2 = 126,
278 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_3 = 127,
279 GAUDI2_QUEUE_ID_DCORE3_MME_0_0 = 128,
280 GAUDI2_QUEUE_ID_DCORE3_MME_0_1 = 129,
281 GAUDI2_QUEUE_ID_DCORE3_MME_0_2 = 130,
282 GAUDI2_QUEUE_ID_DCORE3_MME_0_3 = 131,
283 GAUDI2_QUEUE_ID_DCORE3_TPC_0_0 = 132,
284 GAUDI2_QUEUE_ID_DCORE3_TPC_0_1 = 133,
285 GAUDI2_QUEUE_ID_DCORE3_TPC_0_2 = 134,
286 GAUDI2_QUEUE_ID_DCORE3_TPC_0_3 = 135,
287 GAUDI2_QUEUE_ID_DCORE3_TPC_1_0 = 136,
288 GAUDI2_QUEUE_ID_DCORE3_TPC_1_1 = 137,
289 GAUDI2_QUEUE_ID_DCORE3_TPC_1_2 = 138,
290 GAUDI2_QUEUE_ID_DCORE3_TPC_1_3 = 139,
291 GAUDI2_QUEUE_ID_DCORE3_TPC_2_0 = 140,
292 GAUDI2_QUEUE_ID_DCORE3_TPC_2_1 = 141,
293 GAUDI2_QUEUE_ID_DCORE3_TPC_2_2 = 142,
294 GAUDI2_QUEUE_ID_DCORE3_TPC_2_3 = 143,
295 GAUDI2_QUEUE_ID_DCORE3_TPC_3_0 = 144,
296 GAUDI2_QUEUE_ID_DCORE3_TPC_3_1 = 145,
297 GAUDI2_QUEUE_ID_DCORE3_TPC_3_2 = 146,
298 GAUDI2_QUEUE_ID_DCORE3_TPC_3_3 = 147,
299 GAUDI2_QUEUE_ID_DCORE3_TPC_4_0 = 148,
300 GAUDI2_QUEUE_ID_DCORE3_TPC_4_1 = 149,
301 GAUDI2_QUEUE_ID_DCORE3_TPC_4_2 = 150,
302 GAUDI2_QUEUE_ID_DCORE3_TPC_4_3 = 151,
303 GAUDI2_QUEUE_ID_DCORE3_TPC_5_0 = 152,
304 GAUDI2_QUEUE_ID_DCORE3_TPC_5_1 = 153,
305 GAUDI2_QUEUE_ID_DCORE3_TPC_5_2 = 154,
306 GAUDI2_QUEUE_ID_DCORE3_TPC_5_3 = 155,
307 GAUDI2_QUEUE_ID_NIC_0_0 = 156,
308 GAUDI2_QUEUE_ID_NIC_0_1 = 157,
309 GAUDI2_QUEUE_ID_NIC_0_2 = 158,
310 GAUDI2_QUEUE_ID_NIC_0_3 = 159,
311 GAUDI2_QUEUE_ID_NIC_1_0 = 160,
312 GAUDI2_QUEUE_ID_NIC_1_1 = 161,
313 GAUDI2_QUEUE_ID_NIC_1_2 = 162,
314 GAUDI2_QUEUE_ID_NIC_1_3 = 163,
315 GAUDI2_QUEUE_ID_NIC_2_0 = 164,
316 GAUDI2_QUEUE_ID_NIC_2_1 = 165,
317 GAUDI2_QUEUE_ID_NIC_2_2 = 166,
318 GAUDI2_QUEUE_ID_NIC_2_3 = 167,
319 GAUDI2_QUEUE_ID_NIC_3_0 = 168,
320 GAUDI2_QUEUE_ID_NIC_3_1 = 169,
321 GAUDI2_QUEUE_ID_NIC_3_2 = 170,
322 GAUDI2_QUEUE_ID_NIC_3_3 = 171,
323 GAUDI2_QUEUE_ID_NIC_4_0 = 172,
324 GAUDI2_QUEUE_ID_NIC_4_1 = 173,
325 GAUDI2_QUEUE_ID_NIC_4_2 = 174,
326 GAUDI2_QUEUE_ID_NIC_4_3 = 175,
327 GAUDI2_QUEUE_ID_NIC_5_0 = 176,
328 GAUDI2_QUEUE_ID_NIC_5_1 = 177,
329 GAUDI2_QUEUE_ID_NIC_5_2 = 178,
330 GAUDI2_QUEUE_ID_NIC_5_3 = 179,
331 GAUDI2_QUEUE_ID_NIC_6_0 = 180,
332 GAUDI2_QUEUE_ID_NIC_6_1 = 181,
333 GAUDI2_QUEUE_ID_NIC_6_2 = 182,
334 GAUDI2_QUEUE_ID_NIC_6_3 = 183,
335 GAUDI2_QUEUE_ID_NIC_7_0 = 184,
336 GAUDI2_QUEUE_ID_NIC_7_1 = 185,
337 GAUDI2_QUEUE_ID_NIC_7_2 = 186,
338 GAUDI2_QUEUE_ID_NIC_7_3 = 187,
339 GAUDI2_QUEUE_ID_NIC_8_0 = 188,
340 GAUDI2_QUEUE_ID_NIC_8_1 = 189,
341 GAUDI2_QUEUE_ID_NIC_8_2 = 190,
342 GAUDI2_QUEUE_ID_NIC_8_3 = 191,
343 GAUDI2_QUEUE_ID_NIC_9_0 = 192,
344 GAUDI2_QUEUE_ID_NIC_9_1 = 193,
345 GAUDI2_QUEUE_ID_NIC_9_2 = 194,
346 GAUDI2_QUEUE_ID_NIC_9_3 = 195,
347 GAUDI2_QUEUE_ID_NIC_10_0 = 196,
348 GAUDI2_QUEUE_ID_NIC_10_1 = 197,
349 GAUDI2_QUEUE_ID_NIC_10_2 = 198,
350 GAUDI2_QUEUE_ID_NIC_10_3 = 199,
351 GAUDI2_QUEUE_ID_NIC_11_0 = 200,
352 GAUDI2_QUEUE_ID_NIC_11_1 = 201,
353 GAUDI2_QUEUE_ID_NIC_11_2 = 202,
354 GAUDI2_QUEUE_ID_NIC_11_3 = 203,
355 GAUDI2_QUEUE_ID_NIC_12_0 = 204,
356 GAUDI2_QUEUE_ID_NIC_12_1 = 205,
357 GAUDI2_QUEUE_ID_NIC_12_2 = 206,
358 GAUDI2_QUEUE_ID_NIC_12_3 = 207,
359 GAUDI2_QUEUE_ID_NIC_13_0 = 208,
360 GAUDI2_QUEUE_ID_NIC_13_1 = 209,
361 GAUDI2_QUEUE_ID_NIC_13_2 = 210,
362 GAUDI2_QUEUE_ID_NIC_13_3 = 211,
363 GAUDI2_QUEUE_ID_NIC_14_0 = 212,
364 GAUDI2_QUEUE_ID_NIC_14_1 = 213,
365 GAUDI2_QUEUE_ID_NIC_14_2 = 214,
366 GAUDI2_QUEUE_ID_NIC_14_3 = 215,
367 GAUDI2_QUEUE_ID_NIC_15_0 = 216,
368 GAUDI2_QUEUE_ID_NIC_15_1 = 217,
369 GAUDI2_QUEUE_ID_NIC_15_2 = 218,
370 GAUDI2_QUEUE_ID_NIC_15_3 = 219,
371 GAUDI2_QUEUE_ID_NIC_16_0 = 220,
372 GAUDI2_QUEUE_ID_NIC_16_1 = 221,
373 GAUDI2_QUEUE_ID_NIC_16_2 = 222,
374 GAUDI2_QUEUE_ID_NIC_16_3 = 223,
375 GAUDI2_QUEUE_ID_NIC_17_0 = 224,
376 GAUDI2_QUEUE_ID_NIC_17_1 = 225,
377 GAUDI2_QUEUE_ID_NIC_17_2 = 226,
378 GAUDI2_QUEUE_ID_NIC_17_3 = 227,
379 GAUDI2_QUEUE_ID_NIC_18_0 = 228,
380 GAUDI2_QUEUE_ID_NIC_18_1 = 229,
381 GAUDI2_QUEUE_ID_NIC_18_2 = 230,
382 GAUDI2_QUEUE_ID_NIC_18_3 = 231,
383 GAUDI2_QUEUE_ID_NIC_19_0 = 232,
384 GAUDI2_QUEUE_ID_NIC_19_1 = 233,
385 GAUDI2_QUEUE_ID_NIC_19_2 = 234,
386 GAUDI2_QUEUE_ID_NIC_19_3 = 235,
387 GAUDI2_QUEUE_ID_NIC_20_0 = 236,
388 GAUDI2_QUEUE_ID_NIC_20_1 = 237,
389 GAUDI2_QUEUE_ID_NIC_20_2 = 238,
390 GAUDI2_QUEUE_ID_NIC_20_3 = 239,
391 GAUDI2_QUEUE_ID_NIC_21_0 = 240,
392 GAUDI2_QUEUE_ID_NIC_21_1 = 241,
393 GAUDI2_QUEUE_ID_NIC_21_2 = 242,
394 GAUDI2_QUEUE_ID_NIC_21_3 = 243,
395 GAUDI2_QUEUE_ID_NIC_22_0 = 244,
396 GAUDI2_QUEUE_ID_NIC_22_1 = 245,
397 GAUDI2_QUEUE_ID_NIC_22_2 = 246,
398 GAUDI2_QUEUE_ID_NIC_22_3 = 247,
399 GAUDI2_QUEUE_ID_NIC_23_0 = 248,
400 GAUDI2_QUEUE_ID_NIC_23_1 = 249,
401 GAUDI2_QUEUE_ID_NIC_23_2 = 250,
402 GAUDI2_QUEUE_ID_NIC_23_3 = 251,
403 GAUDI2_QUEUE_ID_ROT_0_0 = 252,
404 GAUDI2_QUEUE_ID_ROT_0_1 = 253,
405 GAUDI2_QUEUE_ID_ROT_0_2 = 254,
406 GAUDI2_QUEUE_ID_ROT_0_3 = 255,
407 GAUDI2_QUEUE_ID_ROT_1_0 = 256,
408 GAUDI2_QUEUE_ID_ROT_1_1 = 257,
409 GAUDI2_QUEUE_ID_ROT_1_2 = 258,
410 GAUDI2_QUEUE_ID_ROT_1_3 = 259,
411 GAUDI2_QUEUE_ID_CPU_PQ = 260,
412 GAUDI2_QUEUE_ID_SIZE
413};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700414enum goya_engine_id {
415 GOYA_ENGINE_ID_DMA_0 = 0,
416 GOYA_ENGINE_ID_DMA_1,
417 GOYA_ENGINE_ID_DMA_2,
418 GOYA_ENGINE_ID_DMA_3,
419 GOYA_ENGINE_ID_DMA_4,
420 GOYA_ENGINE_ID_MME_0,
421 GOYA_ENGINE_ID_TPC_0,
422 GOYA_ENGINE_ID_TPC_1,
423 GOYA_ENGINE_ID_TPC_2,
424 GOYA_ENGINE_ID_TPC_3,
425 GOYA_ENGINE_ID_TPC_4,
426 GOYA_ENGINE_ID_TPC_5,
427 GOYA_ENGINE_ID_TPC_6,
428 GOYA_ENGINE_ID_TPC_7,
429 GOYA_ENGINE_ID_SIZE
430};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700431enum gaudi_engine_id {
432 GAUDI_ENGINE_ID_DMA_0 = 0,
433 GAUDI_ENGINE_ID_DMA_1,
434 GAUDI_ENGINE_ID_DMA_2,
435 GAUDI_ENGINE_ID_DMA_3,
436 GAUDI_ENGINE_ID_DMA_4,
437 GAUDI_ENGINE_ID_DMA_5,
438 GAUDI_ENGINE_ID_DMA_6,
439 GAUDI_ENGINE_ID_DMA_7,
440 GAUDI_ENGINE_ID_MME_0,
441 GAUDI_ENGINE_ID_MME_1,
442 GAUDI_ENGINE_ID_MME_2,
443 GAUDI_ENGINE_ID_MME_3,
444 GAUDI_ENGINE_ID_TPC_0,
445 GAUDI_ENGINE_ID_TPC_1,
446 GAUDI_ENGINE_ID_TPC_2,
447 GAUDI_ENGINE_ID_TPC_3,
448 GAUDI_ENGINE_ID_TPC_4,
449 GAUDI_ENGINE_ID_TPC_5,
450 GAUDI_ENGINE_ID_TPC_6,
451 GAUDI_ENGINE_ID_TPC_7,
452 GAUDI_ENGINE_ID_NIC_0,
453 GAUDI_ENGINE_ID_NIC_1,
454 GAUDI_ENGINE_ID_NIC_2,
455 GAUDI_ENGINE_ID_NIC_3,
456 GAUDI_ENGINE_ID_NIC_4,
457 GAUDI_ENGINE_ID_NIC_5,
458 GAUDI_ENGINE_ID_NIC_6,
459 GAUDI_ENGINE_ID_NIC_7,
460 GAUDI_ENGINE_ID_NIC_8,
461 GAUDI_ENGINE_ID_NIC_9,
462 GAUDI_ENGINE_ID_SIZE
463};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700464enum gaudi2_engine_id {
465 GAUDI2_DCORE0_ENGINE_ID_EDMA_0 = 0,
466 GAUDI2_DCORE0_ENGINE_ID_EDMA_1,
467 GAUDI2_DCORE0_ENGINE_ID_MME,
468 GAUDI2_DCORE0_ENGINE_ID_TPC_0,
469 GAUDI2_DCORE0_ENGINE_ID_TPC_1,
470 GAUDI2_DCORE0_ENGINE_ID_TPC_2,
471 GAUDI2_DCORE0_ENGINE_ID_TPC_3,
472 GAUDI2_DCORE0_ENGINE_ID_TPC_4,
473 GAUDI2_DCORE0_ENGINE_ID_TPC_5,
474 GAUDI2_DCORE0_ENGINE_ID_DEC_0,
475 GAUDI2_DCORE0_ENGINE_ID_DEC_1,
476 GAUDI2_DCORE1_ENGINE_ID_EDMA_0,
477 GAUDI2_DCORE1_ENGINE_ID_EDMA_1,
478 GAUDI2_DCORE1_ENGINE_ID_MME,
479 GAUDI2_DCORE1_ENGINE_ID_TPC_0,
480 GAUDI2_DCORE1_ENGINE_ID_TPC_1,
481 GAUDI2_DCORE1_ENGINE_ID_TPC_2,
482 GAUDI2_DCORE1_ENGINE_ID_TPC_3,
483 GAUDI2_DCORE1_ENGINE_ID_TPC_4,
484 GAUDI2_DCORE1_ENGINE_ID_TPC_5,
485 GAUDI2_DCORE1_ENGINE_ID_DEC_0,
486 GAUDI2_DCORE1_ENGINE_ID_DEC_1,
487 GAUDI2_DCORE2_ENGINE_ID_EDMA_0,
488 GAUDI2_DCORE2_ENGINE_ID_EDMA_1,
489 GAUDI2_DCORE2_ENGINE_ID_MME,
490 GAUDI2_DCORE2_ENGINE_ID_TPC_0,
491 GAUDI2_DCORE2_ENGINE_ID_TPC_1,
492 GAUDI2_DCORE2_ENGINE_ID_TPC_2,
493 GAUDI2_DCORE2_ENGINE_ID_TPC_3,
494 GAUDI2_DCORE2_ENGINE_ID_TPC_4,
495 GAUDI2_DCORE2_ENGINE_ID_TPC_5,
496 GAUDI2_DCORE2_ENGINE_ID_DEC_0,
497 GAUDI2_DCORE2_ENGINE_ID_DEC_1,
498 GAUDI2_DCORE3_ENGINE_ID_EDMA_0,
499 GAUDI2_DCORE3_ENGINE_ID_EDMA_1,
500 GAUDI2_DCORE3_ENGINE_ID_MME,
501 GAUDI2_DCORE3_ENGINE_ID_TPC_0,
502 GAUDI2_DCORE3_ENGINE_ID_TPC_1,
503 GAUDI2_DCORE3_ENGINE_ID_TPC_2,
504 GAUDI2_DCORE3_ENGINE_ID_TPC_3,
505 GAUDI2_DCORE3_ENGINE_ID_TPC_4,
506 GAUDI2_DCORE3_ENGINE_ID_TPC_5,
507 GAUDI2_DCORE3_ENGINE_ID_DEC_0,
508 GAUDI2_DCORE3_ENGINE_ID_DEC_1,
509 GAUDI2_DCORE0_ENGINE_ID_TPC_6,
510 GAUDI2_ENGINE_ID_PDMA_0,
511 GAUDI2_ENGINE_ID_PDMA_1,
512 GAUDI2_ENGINE_ID_ROT_0,
513 GAUDI2_ENGINE_ID_ROT_1,
514 GAUDI2_PCIE_ENGINE_ID_DEC_0,
515 GAUDI2_PCIE_ENGINE_ID_DEC_1,
516 GAUDI2_ENGINE_ID_NIC0_0,
517 GAUDI2_ENGINE_ID_NIC0_1,
518 GAUDI2_ENGINE_ID_NIC1_0,
519 GAUDI2_ENGINE_ID_NIC1_1,
520 GAUDI2_ENGINE_ID_NIC2_0,
521 GAUDI2_ENGINE_ID_NIC2_1,
522 GAUDI2_ENGINE_ID_NIC3_0,
523 GAUDI2_ENGINE_ID_NIC3_1,
524 GAUDI2_ENGINE_ID_NIC4_0,
525 GAUDI2_ENGINE_ID_NIC4_1,
526 GAUDI2_ENGINE_ID_NIC5_0,
527 GAUDI2_ENGINE_ID_NIC5_1,
528 GAUDI2_ENGINE_ID_NIC6_0,
529 GAUDI2_ENGINE_ID_NIC6_1,
530 GAUDI2_ENGINE_ID_NIC7_0,
531 GAUDI2_ENGINE_ID_NIC7_1,
532 GAUDI2_ENGINE_ID_NIC8_0,
533 GAUDI2_ENGINE_ID_NIC8_1,
534 GAUDI2_ENGINE_ID_NIC9_0,
535 GAUDI2_ENGINE_ID_NIC9_1,
536 GAUDI2_ENGINE_ID_NIC10_0,
537 GAUDI2_ENGINE_ID_NIC10_1,
538 GAUDI2_ENGINE_ID_NIC11_0,
539 GAUDI2_ENGINE_ID_NIC11_1,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800540 GAUDI2_ENGINE_ID_PCIE,
541 GAUDI2_ENGINE_ID_PSOC,
542 GAUDI2_ENGINE_ID_ARC_FARM,
543 GAUDI2_ENGINE_ID_KDMA,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700544 GAUDI2_ENGINE_ID_SIZE
545};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000546enum hl_goya_pll_index {
547 HL_GOYA_CPU_PLL = 0,
548 HL_GOYA_IC_PLL,
549 HL_GOYA_MC_PLL,
550 HL_GOYA_MME_PLL,
551 HL_GOYA_PCI_PLL,
552 HL_GOYA_EMMC_PLL,
553 HL_GOYA_TPC_PLL,
554 HL_GOYA_PLL_MAX
555};
556enum hl_gaudi_pll_index {
557 HL_GAUDI_CPU_PLL = 0,
558 HL_GAUDI_PCI_PLL,
559 HL_GAUDI_SRAM_PLL,
560 HL_GAUDI_HBM_PLL,
561 HL_GAUDI_NIC_PLL,
562 HL_GAUDI_DMA_PLL,
563 HL_GAUDI_MESH_PLL,
564 HL_GAUDI_MME_PLL,
565 HL_GAUDI_TPC_PLL,
566 HL_GAUDI_IF_PLL,
567 HL_GAUDI_PLL_MAX
568};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700569enum hl_gaudi2_pll_index {
570 HL_GAUDI2_CPU_PLL = 0,
571 HL_GAUDI2_PCI_PLL,
572 HL_GAUDI2_SRAM_PLL,
573 HL_GAUDI2_HBM_PLL,
574 HL_GAUDI2_NIC_PLL,
575 HL_GAUDI2_DMA_PLL,
576 HL_GAUDI2_MESH_PLL,
577 HL_GAUDI2_MME_PLL,
578 HL_GAUDI2_TPC_PLL,
579 HL_GAUDI2_IF_PLL,
580 HL_GAUDI2_VID_PLL,
581 HL_GAUDI2_MSS_PLL,
582 HL_GAUDI2_PLL_MAX
583};
584enum hl_goya_dma_direction {
585 HL_DMA_HOST_TO_DRAM,
586 HL_DMA_HOST_TO_SRAM,
587 HL_DMA_DRAM_TO_SRAM,
588 HL_DMA_SRAM_TO_DRAM,
589 HL_DMA_SRAM_TO_HOST,
590 HL_DMA_DRAM_TO_HOST,
591 HL_DMA_DRAM_TO_DRAM,
592 HL_DMA_SRAM_TO_SRAM,
593 HL_DMA_ENUM_MAX
594};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700595enum hl_device_status {
596 HL_DEVICE_STATUS_OPERATIONAL,
597 HL_DEVICE_STATUS_IN_RESET,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800598 HL_DEVICE_STATUS_MALFUNCTION,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700599 HL_DEVICE_STATUS_NEEDS_RESET,
600 HL_DEVICE_STATUS_IN_DEVICE_CREATION,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700601 HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE,
602 HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700603};
604enum hl_server_type {
605 HL_SERVER_TYPE_UNKNOWN = 0,
606 HL_SERVER_GAUDI_HLS1 = 1,
607 HL_SERVER_GAUDI_HLS1H = 2,
608 HL_SERVER_GAUDI_TYPE1 = 3,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700609 HL_SERVER_GAUDI_TYPE2 = 4,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700610 HL_SERVER_GAUDI2_HLS2 = 5,
611 HL_SERVER_GAUDI2_TYPE1 = 7
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700612};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000613#define HL_NOTIFIER_EVENT_TPC_ASSERT (1ULL << 0)
614#define HL_NOTIFIER_EVENT_UNDEFINED_OPCODE (1ULL << 1)
615#define HL_NOTIFIER_EVENT_DEVICE_RESET (1ULL << 2)
616#define HL_NOTIFIER_EVENT_CS_TIMEOUT (1ULL << 3)
617#define HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE (1ULL << 4)
618#define HL_NOTIFIER_EVENT_USER_ENGINE_ERR (1ULL << 5)
619#define HL_NOTIFIER_EVENT_GENERAL_HW_ERR (1ULL << 6)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800620#define HL_NOTIFIER_EVENT_RAZWI (1ULL << 7)
621#define HL_NOTIFIER_EVENT_PAGE_FAULT (1ULL << 8)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700622#define HL_NOTIFIER_EVENT_CRITICL_HW_ERR (1ULL << 9)
623#define HL_NOTIFIER_EVENT_CRITICL_FW_ERR (1ULL << 10)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700624#define HL_INFO_HW_IP_INFO 0
625#define HL_INFO_HW_EVENTS 1
626#define HL_INFO_DRAM_USAGE 2
627#define HL_INFO_HW_IDLE 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700628#define HL_INFO_DEVICE_STATUS 4
Christopher Ferris9584fa42019-12-09 15:36:13 -0800629#define HL_INFO_DEVICE_UTILIZATION 6
630#define HL_INFO_HW_EVENTS_AGGREGATE 7
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800631#define HL_INFO_CLK_RATE 8
632#define HL_INFO_RESET_COUNT 9
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700633#define HL_INFO_TIME_SYNC 10
Christopher Ferris25c18d42020-10-14 17:42:58 -0700634#define HL_INFO_CS_COUNTERS 11
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800635#define HL_INFO_PCI_COUNTERS 12
636#define HL_INFO_CLK_THROTTLE_REASON 13
637#define HL_INFO_SYNC_MANAGER 14
638#define HL_INFO_TOTAL_ENERGY 15
Christopher Ferris05667cd2021-02-16 16:01:34 -0800639#define HL_INFO_PLL_FREQUENCY 16
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000640#define HL_INFO_POWER 17
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000641#define HL_INFO_OPEN_STATS 18
Christopher Ferris1ed55342022-03-22 16:06:25 -0700642#define HL_INFO_DRAM_REPLACED_ROWS 21
643#define HL_INFO_DRAM_PENDING_ROWS 22
644#define HL_INFO_LAST_ERR_OPEN_DEV_TIME 23
645#define HL_INFO_CS_TIMEOUT_EVENT 24
646#define HL_INFO_RAZWI_EVENT 25
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700647#define HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES 26
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000648#define HL_INFO_SECURED_ATTESTATION 27
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700649#define HL_INFO_REGISTER_EVENTFD 28
650#define HL_INFO_UNREGISTER_EVENTFD 29
651#define HL_INFO_GET_EVENTS 30
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700652#define HL_INFO_UNDEFINED_OPCODE_EVENT 31
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000653#define HL_INFO_ENGINE_STATUS 32
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800654#define HL_INFO_PAGE_FAULT_EVENT 33
655#define HL_INFO_USER_MAPPINGS 34
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000656#define HL_INFO_FW_GENERIC_REQ 35
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700657#define HL_INFO_HW_ERR_EVENT 36
658#define HL_INFO_FW_ERR_EVENT 37
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700659#define HL_INFO_VERSION_MAX_LEN 128
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800660#define HL_INFO_CARD_NAME_MAX_LEN 16
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000661#define HL_ENGINES_DATA_MAX_SIZE SZ_1M
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700662struct hl_info_hw_ip_info {
663 __u64 sram_base_address;
664 __u64 dram_base_address;
665 __u64 dram_size;
666 __u32 sram_size;
667 __u32 num_of_events;
668 __u32 device_id;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700669 __u32 module_id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700670 __u32 decoder_enabled_mask;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700671 __u16 first_available_interrupt_id;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700672 __u16 server_type;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800673 __u32 cpld_version;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700674 __u32 psoc_pci_pll_nr;
675 __u32 psoc_pci_pll_nf;
676 __u32 psoc_pci_pll_od;
677 __u32 psoc_pci_pll_div_factor;
678 __u8 tpc_enabled_mask;
679 __u8 dram_enabled;
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000680 __u8 security_enabled;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700681 __u8 mme_master_slave_mode;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800682 __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN];
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800683 __u8 card_name[HL_INFO_CARD_NAME_MAX_LEN];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700684 __u64 tpc_enabled_mask_ext;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700685 __u64 dram_page_size;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700686 __u32 edma_enabled_mask;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700687 __u16 number_of_user_interrupts;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700688 __u8 reserved1;
689 __u8 reserved2;
690 __u64 reserved3;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700691 __u64 device_mem_alloc_default_page_size;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700692 __u64 reserved4;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800693 __u64 reserved5;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700694 __u32 reserved6;
695 __u8 reserved7;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800696 __u8 revision_id;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700697 __u16 tpc_interrupt_id;
698 __u32 rotator_enabled_mask;
699 __u32 reserved9;
700 __u64 engine_core_interrupt_reg_addr;
701 __u64 reserved_dram_size;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700702};
703struct hl_info_dram_usage {
704 __u64 dram_free_mem;
705 __u64 ctx_dram_mem;
706};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800707#define HL_BUSY_ENGINES_MASK_EXT_SIZE 4
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700708struct hl_info_hw_idle {
709 __u32 is_idle;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700710 __u32 busy_engines_mask;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700711 __u64 busy_engines_mask_ext[HL_BUSY_ENGINES_MASK_EXT_SIZE];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700712};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700713struct hl_info_device_status {
714 __u32 status;
715 __u32 pad;
716};
Christopher Ferris9584fa42019-12-09 15:36:13 -0800717struct hl_info_device_utilization {
718 __u32 utilization;
719 __u32 pad;
720};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800721struct hl_info_clk_rate {
722 __u32 cur_clk_rate_mhz;
723 __u32 max_clk_rate_mhz;
724};
725struct hl_info_reset_count {
726 __u32 hard_reset_cnt;
727 __u32 soft_reset_cnt;
728};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700729struct hl_info_time_sync {
730 __u64 device_time;
731 __u64 host_time;
732};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800733struct hl_info_pci_counters {
734 __u64 rx_throughput;
735 __u64 tx_throughput;
736 __u64 replay_cnt;
737};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700738enum hl_clk_throttling_type {
739 HL_CLK_THROTTLE_TYPE_POWER,
740 HL_CLK_THROTTLE_TYPE_THERMAL,
741 HL_CLK_THROTTLE_TYPE_MAX
742};
743#define HL_CLK_THROTTLE_POWER (1 << HL_CLK_THROTTLE_TYPE_POWER)
744#define HL_CLK_THROTTLE_THERMAL (1 << HL_CLK_THROTTLE_TYPE_THERMAL)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800745struct hl_info_clk_throttle {
746 __u32 clk_throttling_reason;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700747 __u32 pad;
748 __u64 clk_throttling_timestamp_us[HL_CLK_THROTTLE_TYPE_MAX];
749 __u64 clk_throttling_duration_ns[HL_CLK_THROTTLE_TYPE_MAX];
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800750};
751struct hl_info_energy {
752 __u64 total_energy_consumption;
753};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800754#define HL_PLL_NUM_OUTPUTS 4
755struct hl_pll_frequency_info {
756 __u16 output[HL_PLL_NUM_OUTPUTS];
757};
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000758struct hl_open_stats_info {
759 __u64 open_counter;
760 __u64 last_open_period_ms;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700761 __u8 is_compute_ctx_active;
762 __u8 compute_ctx_in_release;
763 __u8 pad[6];
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000764};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000765struct hl_power_info {
766 __u64 power;
767};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800768struct hl_info_sync_manager {
769 __u32 first_available_sync_object;
770 __u32 first_available_monitor;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700771 __u32 first_available_cq;
772 __u32 reserved;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800773};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700774struct hl_info_cs_counters {
Christopher Ferris05667cd2021-02-16 16:01:34 -0800775 __u64 total_out_of_mem_drop_cnt;
776 __u64 ctx_out_of_mem_drop_cnt;
777 __u64 total_parsing_drop_cnt;
778 __u64 ctx_parsing_drop_cnt;
779 __u64 total_queue_full_drop_cnt;
780 __u64 ctx_queue_full_drop_cnt;
781 __u64 total_device_in_reset_drop_cnt;
782 __u64 ctx_device_in_reset_drop_cnt;
783 __u64 total_max_cs_in_flight_drop_cnt;
784 __u64 ctx_max_cs_in_flight_drop_cnt;
785 __u64 total_validation_drop_cnt;
786 __u64 ctx_validation_drop_cnt;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700787};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700788struct hl_info_last_err_open_dev_time {
789 __s64 timestamp;
790};
791struct hl_info_cs_timeout_event {
792 __s64 timestamp;
793 __u64 seq;
794};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800795#define HL_RAZWI_NA_ENG_ID U16_MAX
796#define HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR 128
797#define HL_RAZWI_READ BIT(0)
798#define HL_RAZWI_WRITE BIT(1)
799#define HL_RAZWI_LBW BIT(2)
800#define HL_RAZWI_HBW BIT(3)
801#define HL_RAZWI_RR BIT(4)
802#define HL_RAZWI_ADDR_DEC BIT(5)
Christopher Ferris1ed55342022-03-22 16:06:25 -0700803struct hl_info_razwi_event {
804 __s64 timestamp;
805 __u64 addr;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800806 __u16 engine_id[HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR];
807 __u16 num_of_possible_engines;
808 __u8 flags;
809 __u8 pad[5];
Christopher Ferris1ed55342022-03-22 16:06:25 -0700810};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700811#define MAX_QMAN_STREAMS_INFO 4
812#define OPCODE_INFO_MAX_ADDR_SIZE 8
813struct hl_info_undefined_opcode_event {
814 __s64 timestamp;
815 __u64 cb_addr_streams[MAX_QMAN_STREAMS_INFO][OPCODE_INFO_MAX_ADDR_SIZE];
816 __u64 cq_addr;
817 __u32 cq_size;
818 __u32 cb_addr_streams_len;
819 __u32 engine_id;
820 __u32 stream_id;
821};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700822struct hl_info_hw_err_event {
823 __s64 timestamp;
824 __u16 event_id;
825 __u16 pad[3];
826};
827enum hl_info_fw_err_type {
828 HL_INFO_FW_HEARTBEAT_ERR,
829 HL_INFO_FW_REPORTED_ERR,
830};
831struct hl_info_fw_err_event {
832 __s64 timestamp;
833 __u16 err_type;
834 __u16 event_id;
835 __u32 pad;
836};
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700837struct hl_info_dev_memalloc_page_sizes {
838 __u64 page_order_bitmask;
839};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000840#define SEC_PCR_DATA_BUF_SZ 256
841#define SEC_PCR_QUOTE_BUF_SZ 510
842#define SEC_SIGNATURE_BUF_SZ 255
843#define SEC_PUB_DATA_BUF_SZ 510
844#define SEC_CERTIFICATE_BUF_SZ 2046
845struct hl_info_sec_attest {
846 __u32 nonce;
847 __u16 pcr_quote_len;
848 __u16 pub_data_len;
849 __u16 certificate_len;
850 __u8 pcr_num_reg;
851 __u8 pcr_reg_len;
852 __u8 quote_sig_len;
853 __u8 pcr_data[SEC_PCR_DATA_BUF_SZ];
854 __u8 pcr_quote[SEC_PCR_QUOTE_BUF_SZ];
855 __u8 quote_sig[SEC_SIGNATURE_BUF_SZ];
856 __u8 public_data[SEC_PUB_DATA_BUF_SZ];
857 __u8 certificate[SEC_CERTIFICATE_BUF_SZ];
858 __u8 pad0[2];
859};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800860struct hl_page_fault_info {
861 __s64 timestamp;
862 __u64 addr;
863 __u16 engine_id;
864 __u8 pad[6];
865};
866struct hl_user_mapping {
867 __u64 dev_va;
868 __u64 size;
869};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800870enum gaudi_dcores {
871 HL_GAUDI_WS_DCORE,
872 HL_GAUDI_WN_DCORE,
873 HL_GAUDI_EN_DCORE,
874 HL_GAUDI_ES_DCORE
875};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700876struct hl_info_args {
877 __u64 return_pointer;
878 __u32 return_size;
879 __u32 op;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800880 union {
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800881 __u32 dcore_id;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800882 __u32 ctx_id;
883 __u32 period_ms;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800884 __u32 pll_index;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700885 __u32 eventfd;
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000886 __u32 user_buffer_actual_size;
887 __u32 sec_attest_nonce;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800888 __u32 array_size;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000889 __u32 fw_sub_opcode;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800890 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700891 __u32 pad;
892};
893#define HL_CB_OP_CREATE 0
894#define HL_CB_OP_DESTROY 1
Christopher Ferris05667cd2021-02-16 16:01:34 -0800895#define HL_CB_OP_INFO 2
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700896#define HL_MAX_CB_SIZE (0x200000 - 32)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800897#define HL_CB_FLAGS_MAP 0x1
Christopher Ferris1ed55342022-03-22 16:06:25 -0700898#define HL_CB_FLAGS_GET_DEVICE_VA 0x2
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700899struct hl_cb_in {
900 __u64 cb_handle;
901 __u32 op;
902 __u32 cb_size;
903 __u32 ctx_id;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800904 __u32 flags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700905};
906struct hl_cb_out {
Christopher Ferris05667cd2021-02-16 16:01:34 -0800907 union {
908 __u64 cb_handle;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700909 union {
910 struct {
911 __u32 usage_cnt;
912 __u32 pad;
913 };
914 __u64 device_va;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800915 };
916 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700917};
918union hl_cb_args {
919 struct hl_cb_in in;
920 struct hl_cb_out out;
921};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800922#define HL_CS_CHUNK_FLAGS_USER_ALLOC_CB 0x1
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700923struct hl_cs_chunk {
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700924 union {
925 __u64 cb_handle;
926 __u64 signal_seq_arr;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700927 __u64 encaps_signal_seq;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700928 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700929 __u32 queue_index;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700930 union {
931 __u32 cb_size;
932 __u32 num_signal_seq_arr;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700933 __u32 encaps_signal_offset;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700934 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700935 __u32 cs_chunk_flags;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800936 __u32 collective_engine_id;
937 __u32 pad[10];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700938};
939#define HL_CS_FLAGS_FORCE_RESTORE 0x1
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700940#define HL_CS_FLAGS_SIGNAL 0x2
941#define HL_CS_FLAGS_WAIT 0x4
Christopher Ferris05667cd2021-02-16 16:01:34 -0800942#define HL_CS_FLAGS_COLLECTIVE_WAIT 0x8
943#define HL_CS_FLAGS_TIMESTAMP 0x20
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700944#define HL_CS_FLAGS_STAGED_SUBMISSION 0x40
945#define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80
946#define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000947#define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000948#define HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT 0x400
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700949#define HL_CS_FLAGS_ENCAP_SIGNALS 0x800
950#define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000
951#define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000952#define HL_CS_FLAGS_ENGINE_CORE_COMMAND 0x4000
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000953#define HL_CS_FLAGS_FLUSH_PCI_HBW_WRITES 0x8000
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700954#define HL_CS_FLAGS_ENGINES_COMMAND 0x10000
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700955#define HL_CS_STATUS_SUCCESS 0
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800956#define HL_MAX_JOBS_PER_CS 512
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700957enum hl_engine_command {
958 HL_ENGINE_CORE_HALT = 1,
959 HL_ENGINE_CORE_RUN = 2,
960 HL_ENGINE_STALL = 3,
961 HL_ENGINE_RESUME = 4,
962 HL_ENGINE_COMMAND_MAX
963};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700964struct hl_cs_in {
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000965 union {
966 struct {
967 __u64 chunks_restore;
968 __u64 chunks_execute;
969 };
970 struct {
971 __u64 engine_cores;
972 __u32 num_engine_cores;
973 __u32 core_command;
974 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700975 struct {
976 __u64 engines;
977 __u32 num_engines;
978 __u32 engine_command;
979 };
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000980 };
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700981 union {
982 __u64 seq;
983 __u32 encaps_sig_handle_id;
984 struct {
985 __u32 encaps_signals_count;
986 __u32 encaps_signals_q_idx;
987 };
988 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700989 __u32 num_chunks_restore;
990 __u32 num_chunks_execute;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000991 __u32 timeout;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700992 __u32 cs_flags;
993 __u32 ctx_id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700994 __u8 pad[4];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700995};
996struct hl_cs_out {
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700997 union {
998 __u64 seq;
999 struct {
1000 __u32 handle_id;
1001 __u32 count;
1002 };
1003 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001004 __u32 status;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001005 __u32 sob_base_addr_offset;
Christopher Ferris1ed55342022-03-22 16:06:25 -07001006 __u16 sob_count_before_submission;
1007 __u16 pad[3];
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001008};
1009union hl_cs_args {
1010 struct hl_cs_in in;
1011 struct hl_cs_out out;
1012};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001013#define HL_WAIT_CS_FLAGS_INTERRUPT 0x2
1014#define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001015#define HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT 0xFFF00000
1016#define HL_WAIT_CS_FLAGS_ANY_DEC_INTERRUPT 0xFFE00000
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001017#define HL_WAIT_CS_FLAGS_MULTI_CS 0x4
Christopher Ferris1ed55342022-03-22 16:06:25 -07001018#define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10
Christopher Ferris10a76e62022-06-08 13:31:52 -07001019#define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001020#define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001021struct hl_wait_cs_in {
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001022 union {
1023 struct {
1024 __u64 seq;
1025 __u64 timeout_us;
1026 };
1027 struct {
Christopher Ferris1ed55342022-03-22 16:06:25 -07001028 union {
1029 __u64 addr;
1030 __u64 cq_counters_handle;
1031 };
Christopher Ferrisa4792612022-01-10 13:51:15 -08001032 __u64 target;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001033 };
1034 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001035 __u32 ctx_id;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001036 __u32 flags;
Christopher Ferris1ed55342022-03-22 16:06:25 -07001037 union {
1038 struct {
1039 __u8 seq_arr_len;
1040 __u8 pad[7];
1041 };
1042 __u64 interrupt_timeout_us;
1043 };
1044 __u64 cq_counters_offset;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001045 __u64 timestamp_handle;
1046 __u64 timestamp_offset;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001047};
1048#define HL_WAIT_CS_STATUS_COMPLETED 0
1049#define HL_WAIT_CS_STATUS_BUSY 1
1050#define HL_WAIT_CS_STATUS_TIMEDOUT 2
1051#define HL_WAIT_CS_STATUS_ABORTED 3
Christopher Ferris05667cd2021-02-16 16:01:34 -08001052#define HL_WAIT_CS_STATUS_FLAG_GONE 0x1
1053#define HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD 0x2
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001054struct hl_wait_cs_out {
1055 __u32 status;
Christopher Ferris05667cd2021-02-16 16:01:34 -08001056 __u32 flags;
1057 __s64 timestamp_nsec;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001058 __u32 cs_completion_map;
1059 __u32 pad;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001060};
1061union hl_wait_cs_args {
1062 struct hl_wait_cs_in in;
1063 struct hl_wait_cs_out out;
1064};
1065#define HL_MEM_OP_ALLOC 0
1066#define HL_MEM_OP_FREE 1
1067#define HL_MEM_OP_MAP 2
1068#define HL_MEM_OP_UNMAP 3
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001069#define HL_MEM_OP_MAP_BLOCK 4
Christopher Ferrisa4792612022-01-10 13:51:15 -08001070#define HL_MEM_OP_EXPORT_DMABUF_FD 5
Christopher Ferris10a76e62022-06-08 13:31:52 -07001071#define HL_MEM_OP_TS_ALLOC 6
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001072#define HL_MEM_CONTIGUOUS 0x1
1073#define HL_MEM_SHARED 0x2
1074#define HL_MEM_USERPTR 0x4
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001075#define HL_MEM_FORCE_HINT 0x8
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001076#define HL_MEM_PREFETCH 0x40
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001077struct hl_mem_in {
1078 union {
1079 struct {
1080 __u64 mem_size;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001081 __u64 page_size;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001082 } alloc;
1083 struct {
1084 __u64 handle;
1085 } free;
1086 struct {
1087 __u64 hint_addr;
1088 __u64 handle;
1089 } map_device;
1090 struct {
1091 __u64 host_virt_addr;
1092 __u64 hint_addr;
1093 __u64 mem_size;
1094 } map_host;
1095 struct {
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001096 __u64 block_addr;
1097 } map_block;
1098 struct {
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001099 __u64 device_virt_addr;
1100 } unmap;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001101 struct {
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001102 __u64 addr;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001103 __u64 mem_size;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001104 __u64 offset;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001105 } export_dmabuf_fd;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001106 };
1107 __u32 op;
1108 __u32 flags;
1109 __u32 ctx_id;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001110 __u32 num_of_elements;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001111};
1112struct hl_mem_out {
1113 union {
1114 __u64 device_virt_addr;
1115 __u64 handle;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001116 struct {
1117 __u64 block_handle;
1118 __u32 block_size;
1119 __u32 pad;
1120 };
Christopher Ferrisa4792612022-01-10 13:51:15 -08001121 __s32 fd;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001122 };
1123};
1124union hl_mem_args {
1125 struct hl_mem_in in;
1126 struct hl_mem_out out;
1127};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001128#define HL_DEBUG_MAX_AUX_VALUES 10
1129struct hl_debug_params_etr {
1130 __u64 buffer_address;
1131 __u64 buffer_size;
1132 __u32 sink_mode;
1133 __u32 pad;
1134};
1135struct hl_debug_params_etf {
1136 __u64 buffer_address;
1137 __u64 buffer_size;
1138 __u32 sink_mode;
1139 __u32 pad;
1140};
1141struct hl_debug_params_stm {
1142 __u64 he_mask;
1143 __u64 sp_mask;
1144 __u32 id;
1145 __u32 frequency;
1146};
1147struct hl_debug_params_bmon {
1148 __u64 start_addr0;
1149 __u64 addr_mask0;
1150 __u64 start_addr1;
1151 __u64 addr_mask1;
1152 __u32 bw_win;
1153 __u32 win_capture;
1154 __u32 id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001155 __u32 control;
1156 __u64 start_addr2;
1157 __u64 end_addr2;
1158 __u64 start_addr3;
1159 __u64 end_addr3;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001160};
1161struct hl_debug_params_spmu {
1162 __u64 event_types[HL_DEBUG_MAX_AUX_VALUES];
1163 __u32 event_types_num;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001164 __u32 pmtrc_val;
1165 __u32 trc_ctrl_host_val;
1166 __u32 trc_en_host_val;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001167};
1168#define HL_DEBUG_OP_ETR 0
1169#define HL_DEBUG_OP_ETF 1
1170#define HL_DEBUG_OP_STM 2
1171#define HL_DEBUG_OP_FUNNEL 3
1172#define HL_DEBUG_OP_BMON 4
1173#define HL_DEBUG_OP_SPMU 5
1174#define HL_DEBUG_OP_TIMESTAMP 6
1175#define HL_DEBUG_OP_SET_MODE 7
1176struct hl_debug_args {
1177 __u64 input_ptr;
1178 __u64 output_ptr;
1179 __u32 input_size;
1180 __u32 output_size;
1181 __u32 op;
1182 __u32 reg_idx;
1183 __u32 enable;
1184 __u32 ctx_id;
1185};
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001186#define HL_IOCTL_INFO _IOWR('H', 0x01, struct hl_info_args)
1187#define HL_IOCTL_CB _IOWR('H', 0x02, union hl_cb_args)
1188#define HL_IOCTL_CS _IOWR('H', 0x03, union hl_cs_args)
1189#define HL_IOCTL_WAIT_CS _IOWR('H', 0x04, union hl_wait_cs_args)
1190#define HL_IOCTL_MEMORY _IOWR('H', 0x05, union hl_mem_args)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001191#define HL_IOCTL_DEBUG _IOWR('H', 0x06, struct hl_debug_args)
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001192#define HL_COMMAND_START 0x01
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001193#define HL_COMMAND_END 0x07
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001194#endif