blob: 158e937ed2eac68d4b84c8763d6ede4d67285c13 [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_
Christopher Ferris0f795212024-01-17 14:17:28 -08009#include <drm/drm.h>
Christopher Ferris24f97eb2019-05-20 12:58:13 -070010#define GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START 0x8000
Christopher Ferris8177cdf2020-08-03 11:53:55 -070011#define GAUDI_DRIVER_SRAM_RESERVED_SIZE_FROM_START 0x80
Christopher Ferris05667cd2021-02-16 16:01:34 -080012#define GAUDI_FIRST_AVAILABLE_W_S_SYNC_OBJECT 144
13#define GAUDI_FIRST_AVAILABLE_W_S_MONITOR 72
Christopher Ferris10a76e62022-06-08 13:31:52 -070014#define TS_MAX_ELEMENTS_NUM (1 << 20)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070015enum goya_queue_id {
16 GOYA_QUEUE_ID_DMA_0 = 0,
Christopher Ferris9584fa42019-12-09 15:36:13 -080017 GOYA_QUEUE_ID_DMA_1 = 1,
18 GOYA_QUEUE_ID_DMA_2 = 2,
19 GOYA_QUEUE_ID_DMA_3 = 3,
20 GOYA_QUEUE_ID_DMA_4 = 4,
21 GOYA_QUEUE_ID_CPU_PQ = 5,
22 GOYA_QUEUE_ID_MME = 6,
23 GOYA_QUEUE_ID_TPC0 = 7,
24 GOYA_QUEUE_ID_TPC1 = 8,
25 GOYA_QUEUE_ID_TPC2 = 9,
26 GOYA_QUEUE_ID_TPC3 = 10,
27 GOYA_QUEUE_ID_TPC4 = 11,
28 GOYA_QUEUE_ID_TPC5 = 12,
29 GOYA_QUEUE_ID_TPC6 = 13,
30 GOYA_QUEUE_ID_TPC7 = 14,
Christopher Ferris24f97eb2019-05-20 12:58:13 -070031 GOYA_QUEUE_ID_SIZE
32};
Christopher Ferris8177cdf2020-08-03 11:53:55 -070033enum gaudi_queue_id {
34 GAUDI_QUEUE_ID_DMA_0_0 = 0,
35 GAUDI_QUEUE_ID_DMA_0_1 = 1,
36 GAUDI_QUEUE_ID_DMA_0_2 = 2,
37 GAUDI_QUEUE_ID_DMA_0_3 = 3,
38 GAUDI_QUEUE_ID_DMA_1_0 = 4,
39 GAUDI_QUEUE_ID_DMA_1_1 = 5,
40 GAUDI_QUEUE_ID_DMA_1_2 = 6,
41 GAUDI_QUEUE_ID_DMA_1_3 = 7,
42 GAUDI_QUEUE_ID_CPU_PQ = 8,
43 GAUDI_QUEUE_ID_DMA_2_0 = 9,
44 GAUDI_QUEUE_ID_DMA_2_1 = 10,
45 GAUDI_QUEUE_ID_DMA_2_2 = 11,
46 GAUDI_QUEUE_ID_DMA_2_3 = 12,
47 GAUDI_QUEUE_ID_DMA_3_0 = 13,
48 GAUDI_QUEUE_ID_DMA_3_1 = 14,
49 GAUDI_QUEUE_ID_DMA_3_2 = 15,
50 GAUDI_QUEUE_ID_DMA_3_3 = 16,
51 GAUDI_QUEUE_ID_DMA_4_0 = 17,
52 GAUDI_QUEUE_ID_DMA_4_1 = 18,
53 GAUDI_QUEUE_ID_DMA_4_2 = 19,
54 GAUDI_QUEUE_ID_DMA_4_3 = 20,
55 GAUDI_QUEUE_ID_DMA_5_0 = 21,
56 GAUDI_QUEUE_ID_DMA_5_1 = 22,
57 GAUDI_QUEUE_ID_DMA_5_2 = 23,
58 GAUDI_QUEUE_ID_DMA_5_3 = 24,
59 GAUDI_QUEUE_ID_DMA_6_0 = 25,
60 GAUDI_QUEUE_ID_DMA_6_1 = 26,
61 GAUDI_QUEUE_ID_DMA_6_2 = 27,
62 GAUDI_QUEUE_ID_DMA_6_3 = 28,
63 GAUDI_QUEUE_ID_DMA_7_0 = 29,
64 GAUDI_QUEUE_ID_DMA_7_1 = 30,
65 GAUDI_QUEUE_ID_DMA_7_2 = 31,
66 GAUDI_QUEUE_ID_DMA_7_3 = 32,
67 GAUDI_QUEUE_ID_MME_0_0 = 33,
68 GAUDI_QUEUE_ID_MME_0_1 = 34,
69 GAUDI_QUEUE_ID_MME_0_2 = 35,
70 GAUDI_QUEUE_ID_MME_0_3 = 36,
71 GAUDI_QUEUE_ID_MME_1_0 = 37,
72 GAUDI_QUEUE_ID_MME_1_1 = 38,
73 GAUDI_QUEUE_ID_MME_1_2 = 39,
74 GAUDI_QUEUE_ID_MME_1_3 = 40,
75 GAUDI_QUEUE_ID_TPC_0_0 = 41,
76 GAUDI_QUEUE_ID_TPC_0_1 = 42,
77 GAUDI_QUEUE_ID_TPC_0_2 = 43,
78 GAUDI_QUEUE_ID_TPC_0_3 = 44,
79 GAUDI_QUEUE_ID_TPC_1_0 = 45,
80 GAUDI_QUEUE_ID_TPC_1_1 = 46,
81 GAUDI_QUEUE_ID_TPC_1_2 = 47,
82 GAUDI_QUEUE_ID_TPC_1_3 = 48,
83 GAUDI_QUEUE_ID_TPC_2_0 = 49,
84 GAUDI_QUEUE_ID_TPC_2_1 = 50,
85 GAUDI_QUEUE_ID_TPC_2_2 = 51,
86 GAUDI_QUEUE_ID_TPC_2_3 = 52,
87 GAUDI_QUEUE_ID_TPC_3_0 = 53,
88 GAUDI_QUEUE_ID_TPC_3_1 = 54,
89 GAUDI_QUEUE_ID_TPC_3_2 = 55,
90 GAUDI_QUEUE_ID_TPC_3_3 = 56,
91 GAUDI_QUEUE_ID_TPC_4_0 = 57,
92 GAUDI_QUEUE_ID_TPC_4_1 = 58,
93 GAUDI_QUEUE_ID_TPC_4_2 = 59,
94 GAUDI_QUEUE_ID_TPC_4_3 = 60,
95 GAUDI_QUEUE_ID_TPC_5_0 = 61,
96 GAUDI_QUEUE_ID_TPC_5_1 = 62,
97 GAUDI_QUEUE_ID_TPC_5_2 = 63,
98 GAUDI_QUEUE_ID_TPC_5_3 = 64,
99 GAUDI_QUEUE_ID_TPC_6_0 = 65,
100 GAUDI_QUEUE_ID_TPC_6_1 = 66,
101 GAUDI_QUEUE_ID_TPC_6_2 = 67,
102 GAUDI_QUEUE_ID_TPC_6_3 = 68,
103 GAUDI_QUEUE_ID_TPC_7_0 = 69,
104 GAUDI_QUEUE_ID_TPC_7_1 = 70,
105 GAUDI_QUEUE_ID_TPC_7_2 = 71,
106 GAUDI_QUEUE_ID_TPC_7_3 = 72,
107 GAUDI_QUEUE_ID_NIC_0_0 = 73,
108 GAUDI_QUEUE_ID_NIC_0_1 = 74,
109 GAUDI_QUEUE_ID_NIC_0_2 = 75,
110 GAUDI_QUEUE_ID_NIC_0_3 = 76,
111 GAUDI_QUEUE_ID_NIC_1_0 = 77,
112 GAUDI_QUEUE_ID_NIC_1_1 = 78,
113 GAUDI_QUEUE_ID_NIC_1_2 = 79,
114 GAUDI_QUEUE_ID_NIC_1_3 = 80,
115 GAUDI_QUEUE_ID_NIC_2_0 = 81,
116 GAUDI_QUEUE_ID_NIC_2_1 = 82,
117 GAUDI_QUEUE_ID_NIC_2_2 = 83,
118 GAUDI_QUEUE_ID_NIC_2_3 = 84,
119 GAUDI_QUEUE_ID_NIC_3_0 = 85,
120 GAUDI_QUEUE_ID_NIC_3_1 = 86,
121 GAUDI_QUEUE_ID_NIC_3_2 = 87,
122 GAUDI_QUEUE_ID_NIC_3_3 = 88,
123 GAUDI_QUEUE_ID_NIC_4_0 = 89,
124 GAUDI_QUEUE_ID_NIC_4_1 = 90,
125 GAUDI_QUEUE_ID_NIC_4_2 = 91,
126 GAUDI_QUEUE_ID_NIC_4_3 = 92,
127 GAUDI_QUEUE_ID_NIC_5_0 = 93,
128 GAUDI_QUEUE_ID_NIC_5_1 = 94,
129 GAUDI_QUEUE_ID_NIC_5_2 = 95,
130 GAUDI_QUEUE_ID_NIC_5_3 = 96,
131 GAUDI_QUEUE_ID_NIC_6_0 = 97,
132 GAUDI_QUEUE_ID_NIC_6_1 = 98,
133 GAUDI_QUEUE_ID_NIC_6_2 = 99,
134 GAUDI_QUEUE_ID_NIC_6_3 = 100,
135 GAUDI_QUEUE_ID_NIC_7_0 = 101,
136 GAUDI_QUEUE_ID_NIC_7_1 = 102,
137 GAUDI_QUEUE_ID_NIC_7_2 = 103,
138 GAUDI_QUEUE_ID_NIC_7_3 = 104,
139 GAUDI_QUEUE_ID_NIC_8_0 = 105,
140 GAUDI_QUEUE_ID_NIC_8_1 = 106,
141 GAUDI_QUEUE_ID_NIC_8_2 = 107,
142 GAUDI_QUEUE_ID_NIC_8_3 = 108,
143 GAUDI_QUEUE_ID_NIC_9_0 = 109,
144 GAUDI_QUEUE_ID_NIC_9_1 = 110,
145 GAUDI_QUEUE_ID_NIC_9_2 = 111,
146 GAUDI_QUEUE_ID_NIC_9_3 = 112,
147 GAUDI_QUEUE_ID_SIZE
148};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700149enum gaudi2_queue_id {
150 GAUDI2_QUEUE_ID_PDMA_0_0 = 0,
151 GAUDI2_QUEUE_ID_PDMA_0_1 = 1,
152 GAUDI2_QUEUE_ID_PDMA_0_2 = 2,
153 GAUDI2_QUEUE_ID_PDMA_0_3 = 3,
154 GAUDI2_QUEUE_ID_PDMA_1_0 = 4,
155 GAUDI2_QUEUE_ID_PDMA_1_1 = 5,
156 GAUDI2_QUEUE_ID_PDMA_1_2 = 6,
157 GAUDI2_QUEUE_ID_PDMA_1_3 = 7,
158 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_0 = 8,
159 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_1 = 9,
160 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_2 = 10,
161 GAUDI2_QUEUE_ID_DCORE0_EDMA_0_3 = 11,
162 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_0 = 12,
163 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_1 = 13,
164 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_2 = 14,
165 GAUDI2_QUEUE_ID_DCORE0_EDMA_1_3 = 15,
166 GAUDI2_QUEUE_ID_DCORE0_MME_0_0 = 16,
167 GAUDI2_QUEUE_ID_DCORE0_MME_0_1 = 17,
168 GAUDI2_QUEUE_ID_DCORE0_MME_0_2 = 18,
169 GAUDI2_QUEUE_ID_DCORE0_MME_0_3 = 19,
170 GAUDI2_QUEUE_ID_DCORE0_TPC_0_0 = 20,
171 GAUDI2_QUEUE_ID_DCORE0_TPC_0_1 = 21,
172 GAUDI2_QUEUE_ID_DCORE0_TPC_0_2 = 22,
173 GAUDI2_QUEUE_ID_DCORE0_TPC_0_3 = 23,
174 GAUDI2_QUEUE_ID_DCORE0_TPC_1_0 = 24,
175 GAUDI2_QUEUE_ID_DCORE0_TPC_1_1 = 25,
176 GAUDI2_QUEUE_ID_DCORE0_TPC_1_2 = 26,
177 GAUDI2_QUEUE_ID_DCORE0_TPC_1_3 = 27,
178 GAUDI2_QUEUE_ID_DCORE0_TPC_2_0 = 28,
179 GAUDI2_QUEUE_ID_DCORE0_TPC_2_1 = 29,
180 GAUDI2_QUEUE_ID_DCORE0_TPC_2_2 = 30,
181 GAUDI2_QUEUE_ID_DCORE0_TPC_2_3 = 31,
182 GAUDI2_QUEUE_ID_DCORE0_TPC_3_0 = 32,
183 GAUDI2_QUEUE_ID_DCORE0_TPC_3_1 = 33,
184 GAUDI2_QUEUE_ID_DCORE0_TPC_3_2 = 34,
185 GAUDI2_QUEUE_ID_DCORE0_TPC_3_3 = 35,
186 GAUDI2_QUEUE_ID_DCORE0_TPC_4_0 = 36,
187 GAUDI2_QUEUE_ID_DCORE0_TPC_4_1 = 37,
188 GAUDI2_QUEUE_ID_DCORE0_TPC_4_2 = 38,
189 GAUDI2_QUEUE_ID_DCORE0_TPC_4_3 = 39,
190 GAUDI2_QUEUE_ID_DCORE0_TPC_5_0 = 40,
191 GAUDI2_QUEUE_ID_DCORE0_TPC_5_1 = 41,
192 GAUDI2_QUEUE_ID_DCORE0_TPC_5_2 = 42,
193 GAUDI2_QUEUE_ID_DCORE0_TPC_5_3 = 43,
194 GAUDI2_QUEUE_ID_DCORE0_TPC_6_0 = 44,
195 GAUDI2_QUEUE_ID_DCORE0_TPC_6_1 = 45,
196 GAUDI2_QUEUE_ID_DCORE0_TPC_6_2 = 46,
197 GAUDI2_QUEUE_ID_DCORE0_TPC_6_3 = 47,
198 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_0 = 48,
199 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_1 = 49,
200 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_2 = 50,
201 GAUDI2_QUEUE_ID_DCORE1_EDMA_0_3 = 51,
202 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_0 = 52,
203 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_1 = 53,
204 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_2 = 54,
205 GAUDI2_QUEUE_ID_DCORE1_EDMA_1_3 = 55,
206 GAUDI2_QUEUE_ID_DCORE1_MME_0_0 = 56,
207 GAUDI2_QUEUE_ID_DCORE1_MME_0_1 = 57,
208 GAUDI2_QUEUE_ID_DCORE1_MME_0_2 = 58,
209 GAUDI2_QUEUE_ID_DCORE1_MME_0_3 = 59,
210 GAUDI2_QUEUE_ID_DCORE1_TPC_0_0 = 60,
211 GAUDI2_QUEUE_ID_DCORE1_TPC_0_1 = 61,
212 GAUDI2_QUEUE_ID_DCORE1_TPC_0_2 = 62,
213 GAUDI2_QUEUE_ID_DCORE1_TPC_0_3 = 63,
214 GAUDI2_QUEUE_ID_DCORE1_TPC_1_0 = 64,
215 GAUDI2_QUEUE_ID_DCORE1_TPC_1_1 = 65,
216 GAUDI2_QUEUE_ID_DCORE1_TPC_1_2 = 66,
217 GAUDI2_QUEUE_ID_DCORE1_TPC_1_3 = 67,
218 GAUDI2_QUEUE_ID_DCORE1_TPC_2_0 = 68,
219 GAUDI2_QUEUE_ID_DCORE1_TPC_2_1 = 69,
220 GAUDI2_QUEUE_ID_DCORE1_TPC_2_2 = 70,
221 GAUDI2_QUEUE_ID_DCORE1_TPC_2_3 = 71,
222 GAUDI2_QUEUE_ID_DCORE1_TPC_3_0 = 72,
223 GAUDI2_QUEUE_ID_DCORE1_TPC_3_1 = 73,
224 GAUDI2_QUEUE_ID_DCORE1_TPC_3_2 = 74,
225 GAUDI2_QUEUE_ID_DCORE1_TPC_3_3 = 75,
226 GAUDI2_QUEUE_ID_DCORE1_TPC_4_0 = 76,
227 GAUDI2_QUEUE_ID_DCORE1_TPC_4_1 = 77,
228 GAUDI2_QUEUE_ID_DCORE1_TPC_4_2 = 78,
229 GAUDI2_QUEUE_ID_DCORE1_TPC_4_3 = 79,
230 GAUDI2_QUEUE_ID_DCORE1_TPC_5_0 = 80,
231 GAUDI2_QUEUE_ID_DCORE1_TPC_5_1 = 81,
232 GAUDI2_QUEUE_ID_DCORE1_TPC_5_2 = 82,
233 GAUDI2_QUEUE_ID_DCORE1_TPC_5_3 = 83,
234 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_0 = 84,
235 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_1 = 85,
236 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_2 = 86,
237 GAUDI2_QUEUE_ID_DCORE2_EDMA_0_3 = 87,
238 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_0 = 88,
239 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_1 = 89,
240 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_2 = 90,
241 GAUDI2_QUEUE_ID_DCORE2_EDMA_1_3 = 91,
242 GAUDI2_QUEUE_ID_DCORE2_MME_0_0 = 92,
243 GAUDI2_QUEUE_ID_DCORE2_MME_0_1 = 93,
244 GAUDI2_QUEUE_ID_DCORE2_MME_0_2 = 94,
245 GAUDI2_QUEUE_ID_DCORE2_MME_0_3 = 95,
246 GAUDI2_QUEUE_ID_DCORE2_TPC_0_0 = 96,
247 GAUDI2_QUEUE_ID_DCORE2_TPC_0_1 = 97,
248 GAUDI2_QUEUE_ID_DCORE2_TPC_0_2 = 98,
249 GAUDI2_QUEUE_ID_DCORE2_TPC_0_3 = 99,
250 GAUDI2_QUEUE_ID_DCORE2_TPC_1_0 = 100,
251 GAUDI2_QUEUE_ID_DCORE2_TPC_1_1 = 101,
252 GAUDI2_QUEUE_ID_DCORE2_TPC_1_2 = 102,
253 GAUDI2_QUEUE_ID_DCORE2_TPC_1_3 = 103,
254 GAUDI2_QUEUE_ID_DCORE2_TPC_2_0 = 104,
255 GAUDI2_QUEUE_ID_DCORE2_TPC_2_1 = 105,
256 GAUDI2_QUEUE_ID_DCORE2_TPC_2_2 = 106,
257 GAUDI2_QUEUE_ID_DCORE2_TPC_2_3 = 107,
258 GAUDI2_QUEUE_ID_DCORE2_TPC_3_0 = 108,
259 GAUDI2_QUEUE_ID_DCORE2_TPC_3_1 = 109,
260 GAUDI2_QUEUE_ID_DCORE2_TPC_3_2 = 110,
261 GAUDI2_QUEUE_ID_DCORE2_TPC_3_3 = 111,
262 GAUDI2_QUEUE_ID_DCORE2_TPC_4_0 = 112,
263 GAUDI2_QUEUE_ID_DCORE2_TPC_4_1 = 113,
264 GAUDI2_QUEUE_ID_DCORE2_TPC_4_2 = 114,
265 GAUDI2_QUEUE_ID_DCORE2_TPC_4_3 = 115,
266 GAUDI2_QUEUE_ID_DCORE2_TPC_5_0 = 116,
267 GAUDI2_QUEUE_ID_DCORE2_TPC_5_1 = 117,
268 GAUDI2_QUEUE_ID_DCORE2_TPC_5_2 = 118,
269 GAUDI2_QUEUE_ID_DCORE2_TPC_5_3 = 119,
270 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_0 = 120,
271 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_1 = 121,
272 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_2 = 122,
273 GAUDI2_QUEUE_ID_DCORE3_EDMA_0_3 = 123,
274 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_0 = 124,
275 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_1 = 125,
276 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_2 = 126,
277 GAUDI2_QUEUE_ID_DCORE3_EDMA_1_3 = 127,
278 GAUDI2_QUEUE_ID_DCORE3_MME_0_0 = 128,
279 GAUDI2_QUEUE_ID_DCORE3_MME_0_1 = 129,
280 GAUDI2_QUEUE_ID_DCORE3_MME_0_2 = 130,
281 GAUDI2_QUEUE_ID_DCORE3_MME_0_3 = 131,
282 GAUDI2_QUEUE_ID_DCORE3_TPC_0_0 = 132,
283 GAUDI2_QUEUE_ID_DCORE3_TPC_0_1 = 133,
284 GAUDI2_QUEUE_ID_DCORE3_TPC_0_2 = 134,
285 GAUDI2_QUEUE_ID_DCORE3_TPC_0_3 = 135,
286 GAUDI2_QUEUE_ID_DCORE3_TPC_1_0 = 136,
287 GAUDI2_QUEUE_ID_DCORE3_TPC_1_1 = 137,
288 GAUDI2_QUEUE_ID_DCORE3_TPC_1_2 = 138,
289 GAUDI2_QUEUE_ID_DCORE3_TPC_1_3 = 139,
290 GAUDI2_QUEUE_ID_DCORE3_TPC_2_0 = 140,
291 GAUDI2_QUEUE_ID_DCORE3_TPC_2_1 = 141,
292 GAUDI2_QUEUE_ID_DCORE3_TPC_2_2 = 142,
293 GAUDI2_QUEUE_ID_DCORE3_TPC_2_3 = 143,
294 GAUDI2_QUEUE_ID_DCORE3_TPC_3_0 = 144,
295 GAUDI2_QUEUE_ID_DCORE3_TPC_3_1 = 145,
296 GAUDI2_QUEUE_ID_DCORE3_TPC_3_2 = 146,
297 GAUDI2_QUEUE_ID_DCORE3_TPC_3_3 = 147,
298 GAUDI2_QUEUE_ID_DCORE3_TPC_4_0 = 148,
299 GAUDI2_QUEUE_ID_DCORE3_TPC_4_1 = 149,
300 GAUDI2_QUEUE_ID_DCORE3_TPC_4_2 = 150,
301 GAUDI2_QUEUE_ID_DCORE3_TPC_4_3 = 151,
302 GAUDI2_QUEUE_ID_DCORE3_TPC_5_0 = 152,
303 GAUDI2_QUEUE_ID_DCORE3_TPC_5_1 = 153,
304 GAUDI2_QUEUE_ID_DCORE3_TPC_5_2 = 154,
305 GAUDI2_QUEUE_ID_DCORE3_TPC_5_3 = 155,
306 GAUDI2_QUEUE_ID_NIC_0_0 = 156,
307 GAUDI2_QUEUE_ID_NIC_0_1 = 157,
308 GAUDI2_QUEUE_ID_NIC_0_2 = 158,
309 GAUDI2_QUEUE_ID_NIC_0_3 = 159,
310 GAUDI2_QUEUE_ID_NIC_1_0 = 160,
311 GAUDI2_QUEUE_ID_NIC_1_1 = 161,
312 GAUDI2_QUEUE_ID_NIC_1_2 = 162,
313 GAUDI2_QUEUE_ID_NIC_1_3 = 163,
314 GAUDI2_QUEUE_ID_NIC_2_0 = 164,
315 GAUDI2_QUEUE_ID_NIC_2_1 = 165,
316 GAUDI2_QUEUE_ID_NIC_2_2 = 166,
317 GAUDI2_QUEUE_ID_NIC_2_3 = 167,
318 GAUDI2_QUEUE_ID_NIC_3_0 = 168,
319 GAUDI2_QUEUE_ID_NIC_3_1 = 169,
320 GAUDI2_QUEUE_ID_NIC_3_2 = 170,
321 GAUDI2_QUEUE_ID_NIC_3_3 = 171,
322 GAUDI2_QUEUE_ID_NIC_4_0 = 172,
323 GAUDI2_QUEUE_ID_NIC_4_1 = 173,
324 GAUDI2_QUEUE_ID_NIC_4_2 = 174,
325 GAUDI2_QUEUE_ID_NIC_4_3 = 175,
326 GAUDI2_QUEUE_ID_NIC_5_0 = 176,
327 GAUDI2_QUEUE_ID_NIC_5_1 = 177,
328 GAUDI2_QUEUE_ID_NIC_5_2 = 178,
329 GAUDI2_QUEUE_ID_NIC_5_3 = 179,
330 GAUDI2_QUEUE_ID_NIC_6_0 = 180,
331 GAUDI2_QUEUE_ID_NIC_6_1 = 181,
332 GAUDI2_QUEUE_ID_NIC_6_2 = 182,
333 GAUDI2_QUEUE_ID_NIC_6_3 = 183,
334 GAUDI2_QUEUE_ID_NIC_7_0 = 184,
335 GAUDI2_QUEUE_ID_NIC_7_1 = 185,
336 GAUDI2_QUEUE_ID_NIC_7_2 = 186,
337 GAUDI2_QUEUE_ID_NIC_7_3 = 187,
338 GAUDI2_QUEUE_ID_NIC_8_0 = 188,
339 GAUDI2_QUEUE_ID_NIC_8_1 = 189,
340 GAUDI2_QUEUE_ID_NIC_8_2 = 190,
341 GAUDI2_QUEUE_ID_NIC_8_3 = 191,
342 GAUDI2_QUEUE_ID_NIC_9_0 = 192,
343 GAUDI2_QUEUE_ID_NIC_9_1 = 193,
344 GAUDI2_QUEUE_ID_NIC_9_2 = 194,
345 GAUDI2_QUEUE_ID_NIC_9_3 = 195,
346 GAUDI2_QUEUE_ID_NIC_10_0 = 196,
347 GAUDI2_QUEUE_ID_NIC_10_1 = 197,
348 GAUDI2_QUEUE_ID_NIC_10_2 = 198,
349 GAUDI2_QUEUE_ID_NIC_10_3 = 199,
350 GAUDI2_QUEUE_ID_NIC_11_0 = 200,
351 GAUDI2_QUEUE_ID_NIC_11_1 = 201,
352 GAUDI2_QUEUE_ID_NIC_11_2 = 202,
353 GAUDI2_QUEUE_ID_NIC_11_3 = 203,
354 GAUDI2_QUEUE_ID_NIC_12_0 = 204,
355 GAUDI2_QUEUE_ID_NIC_12_1 = 205,
356 GAUDI2_QUEUE_ID_NIC_12_2 = 206,
357 GAUDI2_QUEUE_ID_NIC_12_3 = 207,
358 GAUDI2_QUEUE_ID_NIC_13_0 = 208,
359 GAUDI2_QUEUE_ID_NIC_13_1 = 209,
360 GAUDI2_QUEUE_ID_NIC_13_2 = 210,
361 GAUDI2_QUEUE_ID_NIC_13_3 = 211,
362 GAUDI2_QUEUE_ID_NIC_14_0 = 212,
363 GAUDI2_QUEUE_ID_NIC_14_1 = 213,
364 GAUDI2_QUEUE_ID_NIC_14_2 = 214,
365 GAUDI2_QUEUE_ID_NIC_14_3 = 215,
366 GAUDI2_QUEUE_ID_NIC_15_0 = 216,
367 GAUDI2_QUEUE_ID_NIC_15_1 = 217,
368 GAUDI2_QUEUE_ID_NIC_15_2 = 218,
369 GAUDI2_QUEUE_ID_NIC_15_3 = 219,
370 GAUDI2_QUEUE_ID_NIC_16_0 = 220,
371 GAUDI2_QUEUE_ID_NIC_16_1 = 221,
372 GAUDI2_QUEUE_ID_NIC_16_2 = 222,
373 GAUDI2_QUEUE_ID_NIC_16_3 = 223,
374 GAUDI2_QUEUE_ID_NIC_17_0 = 224,
375 GAUDI2_QUEUE_ID_NIC_17_1 = 225,
376 GAUDI2_QUEUE_ID_NIC_17_2 = 226,
377 GAUDI2_QUEUE_ID_NIC_17_3 = 227,
378 GAUDI2_QUEUE_ID_NIC_18_0 = 228,
379 GAUDI2_QUEUE_ID_NIC_18_1 = 229,
380 GAUDI2_QUEUE_ID_NIC_18_2 = 230,
381 GAUDI2_QUEUE_ID_NIC_18_3 = 231,
382 GAUDI2_QUEUE_ID_NIC_19_0 = 232,
383 GAUDI2_QUEUE_ID_NIC_19_1 = 233,
384 GAUDI2_QUEUE_ID_NIC_19_2 = 234,
385 GAUDI2_QUEUE_ID_NIC_19_3 = 235,
386 GAUDI2_QUEUE_ID_NIC_20_0 = 236,
387 GAUDI2_QUEUE_ID_NIC_20_1 = 237,
388 GAUDI2_QUEUE_ID_NIC_20_2 = 238,
389 GAUDI2_QUEUE_ID_NIC_20_3 = 239,
390 GAUDI2_QUEUE_ID_NIC_21_0 = 240,
391 GAUDI2_QUEUE_ID_NIC_21_1 = 241,
392 GAUDI2_QUEUE_ID_NIC_21_2 = 242,
393 GAUDI2_QUEUE_ID_NIC_21_3 = 243,
394 GAUDI2_QUEUE_ID_NIC_22_0 = 244,
395 GAUDI2_QUEUE_ID_NIC_22_1 = 245,
396 GAUDI2_QUEUE_ID_NIC_22_2 = 246,
397 GAUDI2_QUEUE_ID_NIC_22_3 = 247,
398 GAUDI2_QUEUE_ID_NIC_23_0 = 248,
399 GAUDI2_QUEUE_ID_NIC_23_1 = 249,
400 GAUDI2_QUEUE_ID_NIC_23_2 = 250,
401 GAUDI2_QUEUE_ID_NIC_23_3 = 251,
402 GAUDI2_QUEUE_ID_ROT_0_0 = 252,
403 GAUDI2_QUEUE_ID_ROT_0_1 = 253,
404 GAUDI2_QUEUE_ID_ROT_0_2 = 254,
405 GAUDI2_QUEUE_ID_ROT_0_3 = 255,
406 GAUDI2_QUEUE_ID_ROT_1_0 = 256,
407 GAUDI2_QUEUE_ID_ROT_1_1 = 257,
408 GAUDI2_QUEUE_ID_ROT_1_2 = 258,
409 GAUDI2_QUEUE_ID_ROT_1_3 = 259,
410 GAUDI2_QUEUE_ID_CPU_PQ = 260,
411 GAUDI2_QUEUE_ID_SIZE
412};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700413enum goya_engine_id {
414 GOYA_ENGINE_ID_DMA_0 = 0,
415 GOYA_ENGINE_ID_DMA_1,
416 GOYA_ENGINE_ID_DMA_2,
417 GOYA_ENGINE_ID_DMA_3,
418 GOYA_ENGINE_ID_DMA_4,
419 GOYA_ENGINE_ID_MME_0,
420 GOYA_ENGINE_ID_TPC_0,
421 GOYA_ENGINE_ID_TPC_1,
422 GOYA_ENGINE_ID_TPC_2,
423 GOYA_ENGINE_ID_TPC_3,
424 GOYA_ENGINE_ID_TPC_4,
425 GOYA_ENGINE_ID_TPC_5,
426 GOYA_ENGINE_ID_TPC_6,
427 GOYA_ENGINE_ID_TPC_7,
428 GOYA_ENGINE_ID_SIZE
429};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700430enum gaudi_engine_id {
431 GAUDI_ENGINE_ID_DMA_0 = 0,
432 GAUDI_ENGINE_ID_DMA_1,
433 GAUDI_ENGINE_ID_DMA_2,
434 GAUDI_ENGINE_ID_DMA_3,
435 GAUDI_ENGINE_ID_DMA_4,
436 GAUDI_ENGINE_ID_DMA_5,
437 GAUDI_ENGINE_ID_DMA_6,
438 GAUDI_ENGINE_ID_DMA_7,
439 GAUDI_ENGINE_ID_MME_0,
440 GAUDI_ENGINE_ID_MME_1,
441 GAUDI_ENGINE_ID_MME_2,
442 GAUDI_ENGINE_ID_MME_3,
443 GAUDI_ENGINE_ID_TPC_0,
444 GAUDI_ENGINE_ID_TPC_1,
445 GAUDI_ENGINE_ID_TPC_2,
446 GAUDI_ENGINE_ID_TPC_3,
447 GAUDI_ENGINE_ID_TPC_4,
448 GAUDI_ENGINE_ID_TPC_5,
449 GAUDI_ENGINE_ID_TPC_6,
450 GAUDI_ENGINE_ID_TPC_7,
451 GAUDI_ENGINE_ID_NIC_0,
452 GAUDI_ENGINE_ID_NIC_1,
453 GAUDI_ENGINE_ID_NIC_2,
454 GAUDI_ENGINE_ID_NIC_3,
455 GAUDI_ENGINE_ID_NIC_4,
456 GAUDI_ENGINE_ID_NIC_5,
457 GAUDI_ENGINE_ID_NIC_6,
458 GAUDI_ENGINE_ID_NIC_7,
459 GAUDI_ENGINE_ID_NIC_8,
460 GAUDI_ENGINE_ID_NIC_9,
461 GAUDI_ENGINE_ID_SIZE
462};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700463enum gaudi2_engine_id {
464 GAUDI2_DCORE0_ENGINE_ID_EDMA_0 = 0,
465 GAUDI2_DCORE0_ENGINE_ID_EDMA_1,
466 GAUDI2_DCORE0_ENGINE_ID_MME,
467 GAUDI2_DCORE0_ENGINE_ID_TPC_0,
468 GAUDI2_DCORE0_ENGINE_ID_TPC_1,
469 GAUDI2_DCORE0_ENGINE_ID_TPC_2,
470 GAUDI2_DCORE0_ENGINE_ID_TPC_3,
471 GAUDI2_DCORE0_ENGINE_ID_TPC_4,
472 GAUDI2_DCORE0_ENGINE_ID_TPC_5,
473 GAUDI2_DCORE0_ENGINE_ID_DEC_0,
474 GAUDI2_DCORE0_ENGINE_ID_DEC_1,
475 GAUDI2_DCORE1_ENGINE_ID_EDMA_0,
476 GAUDI2_DCORE1_ENGINE_ID_EDMA_1,
477 GAUDI2_DCORE1_ENGINE_ID_MME,
478 GAUDI2_DCORE1_ENGINE_ID_TPC_0,
479 GAUDI2_DCORE1_ENGINE_ID_TPC_1,
480 GAUDI2_DCORE1_ENGINE_ID_TPC_2,
481 GAUDI2_DCORE1_ENGINE_ID_TPC_3,
482 GAUDI2_DCORE1_ENGINE_ID_TPC_4,
483 GAUDI2_DCORE1_ENGINE_ID_TPC_5,
484 GAUDI2_DCORE1_ENGINE_ID_DEC_0,
485 GAUDI2_DCORE1_ENGINE_ID_DEC_1,
486 GAUDI2_DCORE2_ENGINE_ID_EDMA_0,
487 GAUDI2_DCORE2_ENGINE_ID_EDMA_1,
488 GAUDI2_DCORE2_ENGINE_ID_MME,
489 GAUDI2_DCORE2_ENGINE_ID_TPC_0,
490 GAUDI2_DCORE2_ENGINE_ID_TPC_1,
491 GAUDI2_DCORE2_ENGINE_ID_TPC_2,
492 GAUDI2_DCORE2_ENGINE_ID_TPC_3,
493 GAUDI2_DCORE2_ENGINE_ID_TPC_4,
494 GAUDI2_DCORE2_ENGINE_ID_TPC_5,
495 GAUDI2_DCORE2_ENGINE_ID_DEC_0,
496 GAUDI2_DCORE2_ENGINE_ID_DEC_1,
497 GAUDI2_DCORE3_ENGINE_ID_EDMA_0,
498 GAUDI2_DCORE3_ENGINE_ID_EDMA_1,
499 GAUDI2_DCORE3_ENGINE_ID_MME,
500 GAUDI2_DCORE3_ENGINE_ID_TPC_0,
501 GAUDI2_DCORE3_ENGINE_ID_TPC_1,
502 GAUDI2_DCORE3_ENGINE_ID_TPC_2,
503 GAUDI2_DCORE3_ENGINE_ID_TPC_3,
504 GAUDI2_DCORE3_ENGINE_ID_TPC_4,
505 GAUDI2_DCORE3_ENGINE_ID_TPC_5,
506 GAUDI2_DCORE3_ENGINE_ID_DEC_0,
507 GAUDI2_DCORE3_ENGINE_ID_DEC_1,
508 GAUDI2_DCORE0_ENGINE_ID_TPC_6,
509 GAUDI2_ENGINE_ID_PDMA_0,
510 GAUDI2_ENGINE_ID_PDMA_1,
511 GAUDI2_ENGINE_ID_ROT_0,
512 GAUDI2_ENGINE_ID_ROT_1,
513 GAUDI2_PCIE_ENGINE_ID_DEC_0,
514 GAUDI2_PCIE_ENGINE_ID_DEC_1,
515 GAUDI2_ENGINE_ID_NIC0_0,
516 GAUDI2_ENGINE_ID_NIC0_1,
517 GAUDI2_ENGINE_ID_NIC1_0,
518 GAUDI2_ENGINE_ID_NIC1_1,
519 GAUDI2_ENGINE_ID_NIC2_0,
520 GAUDI2_ENGINE_ID_NIC2_1,
521 GAUDI2_ENGINE_ID_NIC3_0,
522 GAUDI2_ENGINE_ID_NIC3_1,
523 GAUDI2_ENGINE_ID_NIC4_0,
524 GAUDI2_ENGINE_ID_NIC4_1,
525 GAUDI2_ENGINE_ID_NIC5_0,
526 GAUDI2_ENGINE_ID_NIC5_1,
527 GAUDI2_ENGINE_ID_NIC6_0,
528 GAUDI2_ENGINE_ID_NIC6_1,
529 GAUDI2_ENGINE_ID_NIC7_0,
530 GAUDI2_ENGINE_ID_NIC7_1,
531 GAUDI2_ENGINE_ID_NIC8_0,
532 GAUDI2_ENGINE_ID_NIC8_1,
533 GAUDI2_ENGINE_ID_NIC9_0,
534 GAUDI2_ENGINE_ID_NIC9_1,
535 GAUDI2_ENGINE_ID_NIC10_0,
536 GAUDI2_ENGINE_ID_NIC10_1,
537 GAUDI2_ENGINE_ID_NIC11_0,
538 GAUDI2_ENGINE_ID_NIC11_1,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800539 GAUDI2_ENGINE_ID_PCIE,
540 GAUDI2_ENGINE_ID_PSOC,
541 GAUDI2_ENGINE_ID_ARC_FARM,
542 GAUDI2_ENGINE_ID_KDMA,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700543 GAUDI2_ENGINE_ID_SIZE
544};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000545enum hl_goya_pll_index {
546 HL_GOYA_CPU_PLL = 0,
547 HL_GOYA_IC_PLL,
548 HL_GOYA_MC_PLL,
549 HL_GOYA_MME_PLL,
550 HL_GOYA_PCI_PLL,
551 HL_GOYA_EMMC_PLL,
552 HL_GOYA_TPC_PLL,
553 HL_GOYA_PLL_MAX
554};
555enum hl_gaudi_pll_index {
556 HL_GAUDI_CPU_PLL = 0,
557 HL_GAUDI_PCI_PLL,
558 HL_GAUDI_SRAM_PLL,
559 HL_GAUDI_HBM_PLL,
560 HL_GAUDI_NIC_PLL,
561 HL_GAUDI_DMA_PLL,
562 HL_GAUDI_MESH_PLL,
563 HL_GAUDI_MME_PLL,
564 HL_GAUDI_TPC_PLL,
565 HL_GAUDI_IF_PLL,
566 HL_GAUDI_PLL_MAX
567};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700568enum hl_gaudi2_pll_index {
569 HL_GAUDI2_CPU_PLL = 0,
570 HL_GAUDI2_PCI_PLL,
571 HL_GAUDI2_SRAM_PLL,
572 HL_GAUDI2_HBM_PLL,
573 HL_GAUDI2_NIC_PLL,
574 HL_GAUDI2_DMA_PLL,
575 HL_GAUDI2_MESH_PLL,
576 HL_GAUDI2_MME_PLL,
577 HL_GAUDI2_TPC_PLL,
578 HL_GAUDI2_IF_PLL,
579 HL_GAUDI2_VID_PLL,
580 HL_GAUDI2_MSS_PLL,
581 HL_GAUDI2_PLL_MAX
582};
583enum hl_goya_dma_direction {
584 HL_DMA_HOST_TO_DRAM,
585 HL_DMA_HOST_TO_SRAM,
586 HL_DMA_DRAM_TO_SRAM,
587 HL_DMA_SRAM_TO_DRAM,
588 HL_DMA_SRAM_TO_HOST,
589 HL_DMA_DRAM_TO_HOST,
590 HL_DMA_DRAM_TO_DRAM,
591 HL_DMA_SRAM_TO_SRAM,
592 HL_DMA_ENUM_MAX
593};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700594enum hl_device_status {
595 HL_DEVICE_STATUS_OPERATIONAL,
596 HL_DEVICE_STATUS_IN_RESET,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800597 HL_DEVICE_STATUS_MALFUNCTION,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700598 HL_DEVICE_STATUS_NEEDS_RESET,
599 HL_DEVICE_STATUS_IN_DEVICE_CREATION,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700600 HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE,
601 HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_RESET_AFTER_DEVICE_RELEASE
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700602};
603enum hl_server_type {
604 HL_SERVER_TYPE_UNKNOWN = 0,
605 HL_SERVER_GAUDI_HLS1 = 1,
606 HL_SERVER_GAUDI_HLS1H = 2,
607 HL_SERVER_GAUDI_TYPE1 = 3,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700608 HL_SERVER_GAUDI_TYPE2 = 4,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700609 HL_SERVER_GAUDI2_HLS2 = 5,
610 HL_SERVER_GAUDI2_TYPE1 = 7
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700611};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000612#define HL_NOTIFIER_EVENT_TPC_ASSERT (1ULL << 0)
613#define HL_NOTIFIER_EVENT_UNDEFINED_OPCODE (1ULL << 1)
614#define HL_NOTIFIER_EVENT_DEVICE_RESET (1ULL << 2)
615#define HL_NOTIFIER_EVENT_CS_TIMEOUT (1ULL << 3)
616#define HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE (1ULL << 4)
617#define HL_NOTIFIER_EVENT_USER_ENGINE_ERR (1ULL << 5)
618#define HL_NOTIFIER_EVENT_GENERAL_HW_ERR (1ULL << 6)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800619#define HL_NOTIFIER_EVENT_RAZWI (1ULL << 7)
620#define HL_NOTIFIER_EVENT_PAGE_FAULT (1ULL << 8)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700621#define HL_NOTIFIER_EVENT_CRITICL_HW_ERR (1ULL << 9)
622#define HL_NOTIFIER_EVENT_CRITICL_FW_ERR (1ULL << 10)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700623#define HL_INFO_HW_IP_INFO 0
624#define HL_INFO_HW_EVENTS 1
625#define HL_INFO_DRAM_USAGE 2
626#define HL_INFO_HW_IDLE 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700627#define HL_INFO_DEVICE_STATUS 4
Christopher Ferris9584fa42019-12-09 15:36:13 -0800628#define HL_INFO_DEVICE_UTILIZATION 6
629#define HL_INFO_HW_EVENTS_AGGREGATE 7
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800630#define HL_INFO_CLK_RATE 8
631#define HL_INFO_RESET_COUNT 9
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700632#define HL_INFO_TIME_SYNC 10
Christopher Ferris25c18d42020-10-14 17:42:58 -0700633#define HL_INFO_CS_COUNTERS 11
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800634#define HL_INFO_PCI_COUNTERS 12
635#define HL_INFO_CLK_THROTTLE_REASON 13
636#define HL_INFO_SYNC_MANAGER 14
637#define HL_INFO_TOTAL_ENERGY 15
Christopher Ferris05667cd2021-02-16 16:01:34 -0800638#define HL_INFO_PLL_FREQUENCY 16
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000639#define HL_INFO_POWER 17
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000640#define HL_INFO_OPEN_STATS 18
Christopher Ferris1ed55342022-03-22 16:06:25 -0700641#define HL_INFO_DRAM_REPLACED_ROWS 21
642#define HL_INFO_DRAM_PENDING_ROWS 22
643#define HL_INFO_LAST_ERR_OPEN_DEV_TIME 23
644#define HL_INFO_CS_TIMEOUT_EVENT 24
645#define HL_INFO_RAZWI_EVENT 25
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700646#define HL_INFO_DEV_MEM_ALLOC_PAGE_SIZES 26
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000647#define HL_INFO_SECURED_ATTESTATION 27
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700648#define HL_INFO_REGISTER_EVENTFD 28
649#define HL_INFO_UNREGISTER_EVENTFD 29
650#define HL_INFO_GET_EVENTS 30
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700651#define HL_INFO_UNDEFINED_OPCODE_EVENT 31
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000652#define HL_INFO_ENGINE_STATUS 32
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800653#define HL_INFO_PAGE_FAULT_EVENT 33
654#define HL_INFO_USER_MAPPINGS 34
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000655#define HL_INFO_FW_GENERIC_REQ 35
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700656#define HL_INFO_HW_ERR_EVENT 36
657#define HL_INFO_FW_ERR_EVENT 37
Christopher Ferris0f795212024-01-17 14:17:28 -0800658#define HL_INFO_USER_ENGINE_ERR_EVENT 38
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;
Christopher Ferris0f795212024-01-17 14:17:28 -0800732 __u64 tsc_time;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700733};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800734struct hl_info_pci_counters {
735 __u64 rx_throughput;
736 __u64 tx_throughput;
737 __u64 replay_cnt;
738};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700739enum hl_clk_throttling_type {
740 HL_CLK_THROTTLE_TYPE_POWER,
741 HL_CLK_THROTTLE_TYPE_THERMAL,
742 HL_CLK_THROTTLE_TYPE_MAX
743};
744#define HL_CLK_THROTTLE_POWER (1 << HL_CLK_THROTTLE_TYPE_POWER)
745#define HL_CLK_THROTTLE_THERMAL (1 << HL_CLK_THROTTLE_TYPE_THERMAL)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800746struct hl_info_clk_throttle {
747 __u32 clk_throttling_reason;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700748 __u32 pad;
749 __u64 clk_throttling_timestamp_us[HL_CLK_THROTTLE_TYPE_MAX];
750 __u64 clk_throttling_duration_ns[HL_CLK_THROTTLE_TYPE_MAX];
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800751};
752struct hl_info_energy {
753 __u64 total_energy_consumption;
754};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800755#define HL_PLL_NUM_OUTPUTS 4
756struct hl_pll_frequency_info {
757 __u16 output[HL_PLL_NUM_OUTPUTS];
758};
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000759struct hl_open_stats_info {
760 __u64 open_counter;
761 __u64 last_open_period_ms;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700762 __u8 is_compute_ctx_active;
763 __u8 compute_ctx_in_release;
764 __u8 pad[6];
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000765};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000766struct hl_power_info {
767 __u64 power;
768};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800769struct hl_info_sync_manager {
770 __u32 first_available_sync_object;
771 __u32 first_available_monitor;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700772 __u32 first_available_cq;
773 __u32 reserved;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800774};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700775struct hl_info_cs_counters {
Christopher Ferris05667cd2021-02-16 16:01:34 -0800776 __u64 total_out_of_mem_drop_cnt;
777 __u64 ctx_out_of_mem_drop_cnt;
778 __u64 total_parsing_drop_cnt;
779 __u64 ctx_parsing_drop_cnt;
780 __u64 total_queue_full_drop_cnt;
781 __u64 ctx_queue_full_drop_cnt;
782 __u64 total_device_in_reset_drop_cnt;
783 __u64 ctx_device_in_reset_drop_cnt;
784 __u64 total_max_cs_in_flight_drop_cnt;
785 __u64 ctx_max_cs_in_flight_drop_cnt;
786 __u64 total_validation_drop_cnt;
787 __u64 ctx_validation_drop_cnt;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700788};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700789struct hl_info_last_err_open_dev_time {
790 __s64 timestamp;
791};
792struct hl_info_cs_timeout_event {
793 __s64 timestamp;
794 __u64 seq;
795};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800796#define HL_RAZWI_NA_ENG_ID U16_MAX
797#define HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR 128
798#define HL_RAZWI_READ BIT(0)
799#define HL_RAZWI_WRITE BIT(1)
800#define HL_RAZWI_LBW BIT(2)
801#define HL_RAZWI_HBW BIT(3)
802#define HL_RAZWI_RR BIT(4)
803#define HL_RAZWI_ADDR_DEC BIT(5)
Christopher Ferris1ed55342022-03-22 16:06:25 -0700804struct hl_info_razwi_event {
805 __s64 timestamp;
806 __u64 addr;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800807 __u16 engine_id[HL_RAZWI_MAX_NUM_OF_ENGINES_PER_RTR];
808 __u16 num_of_possible_engines;
809 __u8 flags;
810 __u8 pad[5];
Christopher Ferris1ed55342022-03-22 16:06:25 -0700811};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700812#define MAX_QMAN_STREAMS_INFO 4
813#define OPCODE_INFO_MAX_ADDR_SIZE 8
814struct hl_info_undefined_opcode_event {
815 __s64 timestamp;
816 __u64 cb_addr_streams[MAX_QMAN_STREAMS_INFO][OPCODE_INFO_MAX_ADDR_SIZE];
817 __u64 cq_addr;
818 __u32 cq_size;
819 __u32 cb_addr_streams_len;
820 __u32 engine_id;
821 __u32 stream_id;
822};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700823struct hl_info_hw_err_event {
824 __s64 timestamp;
825 __u16 event_id;
826 __u16 pad[3];
827};
828enum hl_info_fw_err_type {
829 HL_INFO_FW_HEARTBEAT_ERR,
830 HL_INFO_FW_REPORTED_ERR,
831};
832struct hl_info_fw_err_event {
833 __s64 timestamp;
834 __u16 err_type;
835 __u16 event_id;
836 __u32 pad;
837};
Christopher Ferris0f795212024-01-17 14:17:28 -0800838struct hl_info_engine_err_event {
839 __s64 timestamp;
840 __u16 engine_id;
841 __u16 error_count;
842 __u32 pad;
843};
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700844struct hl_info_dev_memalloc_page_sizes {
845 __u64 page_order_bitmask;
846};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000847#define SEC_PCR_DATA_BUF_SZ 256
848#define SEC_PCR_QUOTE_BUF_SZ 510
849#define SEC_SIGNATURE_BUF_SZ 255
850#define SEC_PUB_DATA_BUF_SZ 510
851#define SEC_CERTIFICATE_BUF_SZ 2046
852struct hl_info_sec_attest {
853 __u32 nonce;
854 __u16 pcr_quote_len;
855 __u16 pub_data_len;
856 __u16 certificate_len;
857 __u8 pcr_num_reg;
858 __u8 pcr_reg_len;
859 __u8 quote_sig_len;
860 __u8 pcr_data[SEC_PCR_DATA_BUF_SZ];
861 __u8 pcr_quote[SEC_PCR_QUOTE_BUF_SZ];
862 __u8 quote_sig[SEC_SIGNATURE_BUF_SZ];
863 __u8 public_data[SEC_PUB_DATA_BUF_SZ];
864 __u8 certificate[SEC_CERTIFICATE_BUF_SZ];
865 __u8 pad0[2];
866};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800867struct hl_page_fault_info {
868 __s64 timestamp;
869 __u64 addr;
870 __u16 engine_id;
871 __u8 pad[6];
872};
873struct hl_user_mapping {
874 __u64 dev_va;
875 __u64 size;
876};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800877enum gaudi_dcores {
878 HL_GAUDI_WS_DCORE,
879 HL_GAUDI_WN_DCORE,
880 HL_GAUDI_EN_DCORE,
881 HL_GAUDI_ES_DCORE
882};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700883struct hl_info_args {
884 __u64 return_pointer;
885 __u32 return_size;
886 __u32 op;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800887 union {
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800888 __u32 dcore_id;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800889 __u32 ctx_id;
890 __u32 period_ms;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800891 __u32 pll_index;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700892 __u32 eventfd;
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000893 __u32 user_buffer_actual_size;
894 __u32 sec_attest_nonce;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800895 __u32 array_size;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000896 __u32 fw_sub_opcode;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800897 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700898 __u32 pad;
899};
900#define HL_CB_OP_CREATE 0
901#define HL_CB_OP_DESTROY 1
Christopher Ferris05667cd2021-02-16 16:01:34 -0800902#define HL_CB_OP_INFO 2
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700903#define HL_MAX_CB_SIZE (0x200000 - 32)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800904#define HL_CB_FLAGS_MAP 0x1
Christopher Ferris1ed55342022-03-22 16:06:25 -0700905#define HL_CB_FLAGS_GET_DEVICE_VA 0x2
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700906struct hl_cb_in {
907 __u64 cb_handle;
908 __u32 op;
909 __u32 cb_size;
910 __u32 ctx_id;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800911 __u32 flags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700912};
913struct hl_cb_out {
Christopher Ferris05667cd2021-02-16 16:01:34 -0800914 union {
915 __u64 cb_handle;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700916 union {
917 struct {
918 __u32 usage_cnt;
919 __u32 pad;
920 };
921 __u64 device_va;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800922 };
923 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700924};
925union hl_cb_args {
926 struct hl_cb_in in;
927 struct hl_cb_out out;
928};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800929#define HL_CS_CHUNK_FLAGS_USER_ALLOC_CB 0x1
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700930struct hl_cs_chunk {
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700931 union {
932 __u64 cb_handle;
933 __u64 signal_seq_arr;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700934 __u64 encaps_signal_seq;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700935 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700936 __u32 queue_index;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700937 union {
938 __u32 cb_size;
939 __u32 num_signal_seq_arr;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700940 __u32 encaps_signal_offset;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700941 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700942 __u32 cs_chunk_flags;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800943 __u32 collective_engine_id;
944 __u32 pad[10];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700945};
946#define HL_CS_FLAGS_FORCE_RESTORE 0x1
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700947#define HL_CS_FLAGS_SIGNAL 0x2
948#define HL_CS_FLAGS_WAIT 0x4
Christopher Ferris05667cd2021-02-16 16:01:34 -0800949#define HL_CS_FLAGS_COLLECTIVE_WAIT 0x8
950#define HL_CS_FLAGS_TIMESTAMP 0x20
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700951#define HL_CS_FLAGS_STAGED_SUBMISSION 0x40
952#define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80
953#define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000954#define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000955#define HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT 0x400
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700956#define HL_CS_FLAGS_ENCAP_SIGNALS 0x800
957#define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000
958#define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000959#define HL_CS_FLAGS_ENGINE_CORE_COMMAND 0x4000
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000960#define HL_CS_FLAGS_FLUSH_PCI_HBW_WRITES 0x8000
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700961#define HL_CS_FLAGS_ENGINES_COMMAND 0x10000
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700962#define HL_CS_STATUS_SUCCESS 0
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800963#define HL_MAX_JOBS_PER_CS 512
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700964enum hl_engine_command {
965 HL_ENGINE_CORE_HALT = 1,
966 HL_ENGINE_CORE_RUN = 2,
967 HL_ENGINE_STALL = 3,
968 HL_ENGINE_RESUME = 4,
969 HL_ENGINE_COMMAND_MAX
970};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700971struct hl_cs_in {
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000972 union {
973 struct {
974 __u64 chunks_restore;
975 __u64 chunks_execute;
976 };
977 struct {
978 __u64 engine_cores;
979 __u32 num_engine_cores;
980 __u32 core_command;
981 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700982 struct {
983 __u64 engines;
984 __u32 num_engines;
985 __u32 engine_command;
986 };
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000987 };
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700988 union {
989 __u64 seq;
990 __u32 encaps_sig_handle_id;
991 struct {
992 __u32 encaps_signals_count;
993 __u32 encaps_signals_q_idx;
994 };
995 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700996 __u32 num_chunks_restore;
997 __u32 num_chunks_execute;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000998 __u32 timeout;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700999 __u32 cs_flags;
1000 __u32 ctx_id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001001 __u8 pad[4];
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001002};
1003struct hl_cs_out {
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001004 union {
1005 __u64 seq;
1006 struct {
1007 __u32 handle_id;
1008 __u32 count;
1009 };
1010 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001011 __u32 status;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001012 __u32 sob_base_addr_offset;
Christopher Ferris1ed55342022-03-22 16:06:25 -07001013 __u16 sob_count_before_submission;
1014 __u16 pad[3];
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001015};
1016union hl_cs_args {
1017 struct hl_cs_in in;
1018 struct hl_cs_out out;
1019};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001020#define HL_WAIT_CS_FLAGS_INTERRUPT 0x2
1021#define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001022#define HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT 0xFFF00000
1023#define HL_WAIT_CS_FLAGS_ANY_DEC_INTERRUPT 0xFFE00000
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001024#define HL_WAIT_CS_FLAGS_MULTI_CS 0x4
Christopher Ferris1ed55342022-03-22 16:06:25 -07001025#define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10
Christopher Ferris10a76e62022-06-08 13:31:52 -07001026#define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001027#define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001028struct hl_wait_cs_in {
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001029 union {
1030 struct {
1031 __u64 seq;
1032 __u64 timeout_us;
1033 };
1034 struct {
Christopher Ferris1ed55342022-03-22 16:06:25 -07001035 union {
1036 __u64 addr;
1037 __u64 cq_counters_handle;
1038 };
Christopher Ferrisa4792612022-01-10 13:51:15 -08001039 __u64 target;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001040 };
1041 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001042 __u32 ctx_id;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001043 __u32 flags;
Christopher Ferris1ed55342022-03-22 16:06:25 -07001044 union {
1045 struct {
1046 __u8 seq_arr_len;
1047 __u8 pad[7];
1048 };
1049 __u64 interrupt_timeout_us;
1050 };
1051 __u64 cq_counters_offset;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001052 __u64 timestamp_handle;
1053 __u64 timestamp_offset;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001054};
1055#define HL_WAIT_CS_STATUS_COMPLETED 0
1056#define HL_WAIT_CS_STATUS_BUSY 1
1057#define HL_WAIT_CS_STATUS_TIMEDOUT 2
1058#define HL_WAIT_CS_STATUS_ABORTED 3
Christopher Ferris05667cd2021-02-16 16:01:34 -08001059#define HL_WAIT_CS_STATUS_FLAG_GONE 0x1
1060#define HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD 0x2
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001061struct hl_wait_cs_out {
1062 __u32 status;
Christopher Ferris05667cd2021-02-16 16:01:34 -08001063 __u32 flags;
1064 __s64 timestamp_nsec;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001065 __u32 cs_completion_map;
1066 __u32 pad;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001067};
1068union hl_wait_cs_args {
1069 struct hl_wait_cs_in in;
1070 struct hl_wait_cs_out out;
1071};
1072#define HL_MEM_OP_ALLOC 0
1073#define HL_MEM_OP_FREE 1
1074#define HL_MEM_OP_MAP 2
1075#define HL_MEM_OP_UNMAP 3
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001076#define HL_MEM_OP_MAP_BLOCK 4
Christopher Ferrisa4792612022-01-10 13:51:15 -08001077#define HL_MEM_OP_EXPORT_DMABUF_FD 5
Christopher Ferris10a76e62022-06-08 13:31:52 -07001078#define HL_MEM_OP_TS_ALLOC 6
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001079#define HL_MEM_CONTIGUOUS 0x1
1080#define HL_MEM_SHARED 0x2
1081#define HL_MEM_USERPTR 0x4
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001082#define HL_MEM_FORCE_HINT 0x8
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001083#define HL_MEM_PREFETCH 0x40
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001084struct hl_mem_in {
1085 union {
1086 struct {
1087 __u64 mem_size;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001088 __u64 page_size;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001089 } alloc;
1090 struct {
1091 __u64 handle;
1092 } free;
1093 struct {
1094 __u64 hint_addr;
1095 __u64 handle;
1096 } map_device;
1097 struct {
1098 __u64 host_virt_addr;
1099 __u64 hint_addr;
1100 __u64 mem_size;
1101 } map_host;
1102 struct {
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001103 __u64 block_addr;
1104 } map_block;
1105 struct {
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001106 __u64 device_virt_addr;
1107 } unmap;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001108 struct {
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001109 __u64 addr;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001110 __u64 mem_size;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001111 __u64 offset;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001112 } export_dmabuf_fd;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001113 };
1114 __u32 op;
1115 __u32 flags;
1116 __u32 ctx_id;
Christopher Ferris10a76e62022-06-08 13:31:52 -07001117 __u32 num_of_elements;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001118};
1119struct hl_mem_out {
1120 union {
1121 __u64 device_virt_addr;
1122 __u64 handle;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001123 struct {
1124 __u64 block_handle;
1125 __u32 block_size;
1126 __u32 pad;
1127 };
Christopher Ferrisa4792612022-01-10 13:51:15 -08001128 __s32 fd;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001129 };
1130};
1131union hl_mem_args {
1132 struct hl_mem_in in;
1133 struct hl_mem_out out;
1134};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001135#define HL_DEBUG_MAX_AUX_VALUES 10
1136struct hl_debug_params_etr {
1137 __u64 buffer_address;
1138 __u64 buffer_size;
1139 __u32 sink_mode;
1140 __u32 pad;
1141};
1142struct hl_debug_params_etf {
1143 __u64 buffer_address;
1144 __u64 buffer_size;
1145 __u32 sink_mode;
1146 __u32 pad;
1147};
1148struct hl_debug_params_stm {
1149 __u64 he_mask;
1150 __u64 sp_mask;
1151 __u32 id;
1152 __u32 frequency;
1153};
1154struct hl_debug_params_bmon {
1155 __u64 start_addr0;
1156 __u64 addr_mask0;
1157 __u64 start_addr1;
1158 __u64 addr_mask1;
1159 __u32 bw_win;
1160 __u32 win_capture;
1161 __u32 id;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001162 __u32 control;
1163 __u64 start_addr2;
1164 __u64 end_addr2;
1165 __u64 start_addr3;
1166 __u64 end_addr3;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001167};
1168struct hl_debug_params_spmu {
1169 __u64 event_types[HL_DEBUG_MAX_AUX_VALUES];
1170 __u32 event_types_num;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001171 __u32 pmtrc_val;
1172 __u32 trc_ctrl_host_val;
1173 __u32 trc_en_host_val;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001174};
1175#define HL_DEBUG_OP_ETR 0
1176#define HL_DEBUG_OP_ETF 1
1177#define HL_DEBUG_OP_STM 2
1178#define HL_DEBUG_OP_FUNNEL 3
1179#define HL_DEBUG_OP_BMON 4
1180#define HL_DEBUG_OP_SPMU 5
1181#define HL_DEBUG_OP_TIMESTAMP 6
1182#define HL_DEBUG_OP_SET_MODE 7
1183struct hl_debug_args {
1184 __u64 input_ptr;
1185 __u64 output_ptr;
1186 __u32 input_size;
1187 __u32 output_size;
1188 __u32 op;
1189 __u32 reg_idx;
1190 __u32 enable;
1191 __u32 ctx_id;
1192};
Christopher Ferris0f795212024-01-17 14:17:28 -08001193#define HL_IOCTL_INFO 0x00
1194#define HL_IOCTL_CB 0x01
1195#define HL_IOCTL_CS 0x02
1196#define HL_IOCTL_WAIT_CS 0x03
1197#define HL_IOCTL_MEMORY 0x04
1198#define HL_IOCTL_DEBUG 0x05
1199#define DRM_IOCTL_HL_INFO DRM_IOWR(DRM_COMMAND_BASE + HL_IOCTL_INFO, struct hl_info_args)
1200#define DRM_IOCTL_HL_CB DRM_IOWR(DRM_COMMAND_BASE + HL_IOCTL_CB, union hl_cb_args)
1201#define DRM_IOCTL_HL_CS DRM_IOWR(DRM_COMMAND_BASE + HL_IOCTL_CS, union hl_cs_args)
1202#define DRM_IOCTL_HL_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + HL_IOCTL_WAIT_CS, union hl_wait_cs_args)
1203#define DRM_IOCTL_HL_MEMORY DRM_IOWR(DRM_COMMAND_BASE + HL_IOCTL_MEMORY, union hl_mem_args)
1204#define DRM_IOCTL_HL_DEBUG DRM_IOWR(DRM_COMMAND_BASE + HL_IOCTL_DEBUG, struct hl_debug_args)
1205#define HL_COMMAND_START (DRM_COMMAND_BASE + HL_IOCTL_INFO)
1206#define HL_COMMAND_END (DRM_COMMAND_BASE + HL_IOCTL_DEBUG + 1)
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001207#endif