blob: f8cfc11977832c28df307ef06fd97f8f0770727d [file] [log] [blame]
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _USR_IDXD_H_
20#define _USR_IDXD_H_
21#include <stdint.h>
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070022enum idxd_scmd_stat {
23 IDXD_SCMD_DEV_ENABLED = 0x80000010,
24 IDXD_SCMD_DEV_NOT_ENABLED = 0x80000020,
25 IDXD_SCMD_WQ_ENABLED = 0x80000021,
26 IDXD_SCMD_DEV_DMA_ERR = 0x80020000,
27 IDXD_SCMD_WQ_NO_GRP = 0x80030000,
28 IDXD_SCMD_WQ_NO_NAME = 0x80040000,
29 IDXD_SCMD_WQ_NO_SVM = 0x80050000,
30 IDXD_SCMD_WQ_NO_THRESH = 0x80060000,
31 IDXD_SCMD_WQ_PORTAL_ERR = 0x80070000,
32 IDXD_SCMD_WQ_RES_ALLOC_ERR = 0x80080000,
33 IDXD_SCMD_PERCPU_ERR = 0x80090000,
34 IDXD_SCMD_DMA_CHAN_ERR = 0x800a0000,
35 IDXD_SCMD_CDEV_ERR = 0x800b0000,
36 IDXD_SCMD_WQ_NO_SWQ_SUPPORT = 0x800c0000,
37 IDXD_SCMD_WQ_NONE_CONFIGURED = 0x800d0000,
38 IDXD_SCMD_WQ_NO_SIZE = 0x800e0000,
39 IDXD_SCMD_WQ_NO_PRIV = 0x800f0000,
Christopher Ferris1ed55342022-03-22 16:06:25 -070040 IDXD_SCMD_WQ_IRQ_ERR = 0x80100000,
Christopher Ferris6cd53a52022-12-12 23:39:16 +000041 IDXD_SCMD_WQ_USER_NO_IOMMU = 0x80110000,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070042 IDXD_SCMD_DEV_EVL_ERR = 0x80120000,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070043};
44#define IDXD_SCMD_SOFTERR_MASK 0x80000000
45#define IDXD_SCMD_SOFTERR_SHIFT 16
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070046#define IDXD_OP_FLAG_FENCE 0x0001
47#define IDXD_OP_FLAG_BOF 0x0002
48#define IDXD_OP_FLAG_CRAV 0x0004
49#define IDXD_OP_FLAG_RCR 0x0008
50#define IDXD_OP_FLAG_RCI 0x0010
51#define IDXD_OP_FLAG_CRSTS 0x0020
52#define IDXD_OP_FLAG_CR 0x0080
53#define IDXD_OP_FLAG_CC 0x0100
54#define IDXD_OP_FLAG_ADDR1_TCS 0x0200
55#define IDXD_OP_FLAG_ADDR2_TCS 0x0400
56#define IDXD_OP_FLAG_ADDR3_TCS 0x0800
57#define IDXD_OP_FLAG_CR_TCS 0x1000
58#define IDXD_OP_FLAG_STORD 0x2000
59#define IDXD_OP_FLAG_DRDBK 0x4000
60#define IDXD_OP_FLAG_DSTS 0x8000
Christopher Ferris05667cd2021-02-16 16:01:34 -080061#define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000
Christopher Ferris80ae69d2022-08-02 16:32:21 -070062#define IDXD_OP_FLAG_RD_SRC2_2ND 0x020000
63#define IDXD_OP_FLAG_WR_SRC2_AECS_COMP 0x040000
64#define IDXD_OP_FLAG_WR_SRC2_AECS_OVFL 0x080000
65#define IDXD_OP_FLAG_SRC2_STS 0x100000
66#define IDXD_OP_FLAG_CRC_RFC3720 0x200000
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070067enum dsa_opcode {
68 DSA_OPCODE_NOOP = 0,
69 DSA_OPCODE_BATCH,
70 DSA_OPCODE_DRAIN,
71 DSA_OPCODE_MEMMOVE,
72 DSA_OPCODE_MEMFILL,
73 DSA_OPCODE_COMPARE,
74 DSA_OPCODE_COMPVAL,
75 DSA_OPCODE_CR_DELTA,
76 DSA_OPCODE_AP_DELTA,
77 DSA_OPCODE_DUALCAST,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070078 DSA_OPCODE_TRANSL_FETCH,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070079 DSA_OPCODE_CRCGEN = 0x10,
80 DSA_OPCODE_COPY_CRC,
81 DSA_OPCODE_DIF_CHECK,
82 DSA_OPCODE_DIF_INS,
83 DSA_OPCODE_DIF_STRP,
84 DSA_OPCODE_DIF_UPDT,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070085 DSA_OPCODE_DIX_GEN = 0x17,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070086 DSA_OPCODE_CFLUSH = 0x20,
87};
Christopher Ferris05667cd2021-02-16 16:01:34 -080088enum iax_opcode {
89 IAX_OPCODE_NOOP = 0,
90 IAX_OPCODE_DRAIN = 2,
91 IAX_OPCODE_MEMMOVE,
92 IAX_OPCODE_DECOMPRESS = 0x42,
93 IAX_OPCODE_COMPRESS,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070094 IAX_OPCODE_CRC64,
95 IAX_OPCODE_ZERO_DECOMP_32 = 0x48,
96 IAX_OPCODE_ZERO_DECOMP_16,
Christopher Ferris7447a1c2022-10-04 18:24:44 -070097 IAX_OPCODE_ZERO_COMP_32 = 0x4c,
98 IAX_OPCODE_ZERO_COMP_16,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070099 IAX_OPCODE_SCAN = 0x50,
100 IAX_OPCODE_SET_MEMBER,
101 IAX_OPCODE_EXTRACT,
102 IAX_OPCODE_SELECT,
103 IAX_OPCODE_RLE_BURST,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700104 IAX_OPCODE_FIND_UNIQUE,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700105 IAX_OPCODE_EXPAND,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800106};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700107enum dsa_completion_status {
108 DSA_COMP_NONE = 0,
109 DSA_COMP_SUCCESS,
110 DSA_COMP_SUCCESS_PRED,
111 DSA_COMP_PAGE_FAULT_NOBOF,
112 DSA_COMP_PAGE_FAULT_IR,
113 DSA_COMP_BATCH_FAIL,
114 DSA_COMP_BATCH_PAGE_FAULT,
115 DSA_COMP_DR_OFFSET_NOINC,
116 DSA_COMP_DR_OFFSET_ERANGE,
117 DSA_COMP_DIF_ERR,
118 DSA_COMP_BAD_OPCODE = 0x10,
119 DSA_COMP_INVALID_FLAGS,
120 DSA_COMP_NOZERO_RESERVE,
121 DSA_COMP_XFER_ERANGE,
122 DSA_COMP_DESC_CNT_ERANGE,
123 DSA_COMP_DR_ERANGE,
124 DSA_COMP_OVERLAP_BUFFERS,
125 DSA_COMP_DCAST_ERR,
126 DSA_COMP_DESCLIST_ALIGN,
127 DSA_COMP_INT_HANDLE_INVAL,
128 DSA_COMP_CRA_XLAT,
129 DSA_COMP_CRA_ALIGN,
130 DSA_COMP_ADDR_ALIGN,
131 DSA_COMP_PRIV_BAD,
132 DSA_COMP_TRAFFIC_CLASS_CONF,
133 DSA_COMP_PFAULT_RDBA,
134 DSA_COMP_HW_ERR1,
135 DSA_COMP_HW_ERR_DRB,
136 DSA_COMP_TRANSLATION_FAIL,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700137 DSA_COMP_DRAIN_EVL = 0x26,
138 DSA_COMP_BATCH_EVL_ERR,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700139};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800140enum iax_completion_status {
141 IAX_COMP_NONE = 0,
142 IAX_COMP_SUCCESS,
143 IAX_COMP_PAGE_FAULT_IR = 0x04,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700144 IAX_COMP_ANALYTICS_ERROR = 0x0a,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800145 IAX_COMP_OUTBUF_OVERFLOW,
146 IAX_COMP_BAD_OPCODE = 0x10,
147 IAX_COMP_INVALID_FLAGS,
148 IAX_COMP_NOZERO_RESERVE,
149 IAX_COMP_INVALID_SIZE,
150 IAX_COMP_OVERLAP_BUFFERS = 0x16,
151 IAX_COMP_INT_HANDLE_INVAL = 0x19,
152 IAX_COMP_CRA_XLAT,
153 IAX_COMP_CRA_ALIGN,
154 IAX_COMP_ADDR_ALIGN,
155 IAX_COMP_PRIV_BAD,
156 IAX_COMP_TRAFFIC_CLASS_CONF,
157 IAX_COMP_PFAULT_RDBA,
158 IAX_COMP_HW_ERR1,
159 IAX_COMP_HW_ERR_DRB,
160 IAX_COMP_TRANSLATION_FAIL,
161 IAX_COMP_PRS_TIMEOUT,
162 IAX_COMP_WATCHDOG,
163 IAX_COMP_INVALID_COMP_FLAG = 0x30,
164 IAX_COMP_INVALID_FILTER_FLAG,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700165 IAX_COMP_INVALID_INPUT_SIZE,
166 IAX_COMP_INVALID_NUM_ELEMS,
167 IAX_COMP_INVALID_SRC1_WIDTH,
168 IAX_COMP_INVALID_INVERT_OUT,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800169};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700170#define DSA_COMP_STATUS_MASK 0x7f
171#define DSA_COMP_STATUS_WRITE 0x80
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700172#define DSA_COMP_STATUS(status) ((status) & DSA_COMP_STATUS_MASK)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700173struct dsa_hw_desc {
174 uint32_t pasid : 20;
175 uint32_t rsvd : 11;
176 uint32_t priv : 1;
177 uint32_t flags : 24;
178 uint32_t opcode : 8;
179 uint64_t completion_addr;
180 union {
181 uint64_t src_addr;
182 uint64_t rdback_addr;
183 uint64_t pattern;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700184 uint64_t desc_list_addr;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700185 uint64_t pattern_lower;
186 uint64_t transl_fetch_addr;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700187 };
188 union {
189 uint64_t dst_addr;
190 uint64_t rdback_addr2;
191 uint64_t src2_addr;
192 uint64_t comp_pattern;
193 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700194 union {
195 uint32_t xfer_size;
196 uint32_t desc_count;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700197 uint32_t region_size;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700198 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700199 uint16_t int_handle;
200 uint16_t rsvd1;
201 union {
202 uint8_t expected_res;
203 struct {
204 uint64_t delta_addr;
205 uint32_t max_delta_size;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700206 uint32_t delt_rsvd;
207 uint8_t expected_res_mask;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700208 };
209 uint32_t delta_rec_size;
210 uint64_t dest2;
211 struct {
212 uint32_t crc_seed;
213 uint32_t crc_rsvd;
214 uint64_t seed_addr;
215 };
216 struct {
217 uint8_t src_dif_flags;
218 uint8_t dif_chk_res;
219 uint8_t dif_chk_flags;
220 uint8_t dif_chk_res2[5];
221 uint32_t chk_ref_tag_seed;
222 uint16_t chk_app_tag_mask;
223 uint16_t chk_app_tag_seed;
224 };
225 struct {
226 uint8_t dif_ins_res;
227 uint8_t dest_dif_flag;
228 uint8_t dif_ins_flags;
229 uint8_t dif_ins_res2[13];
230 uint32_t ins_ref_tag_seed;
231 uint16_t ins_app_tag_mask;
232 uint16_t ins_app_tag_seed;
233 };
234 struct {
235 uint8_t src_upd_flags;
236 uint8_t upd_dest_flags;
237 uint8_t dif_upd_flags;
238 uint8_t dif_upd_res[5];
239 uint32_t src_ref_tag_seed;
240 uint16_t src_app_tag_mask;
241 uint16_t src_app_tag_seed;
242 uint32_t dest_ref_tag_seed;
243 uint16_t dest_app_tag_mask;
244 uint16_t dest_app_tag_seed;
245 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700246 uint64_t pattern_upper;
247 struct {
248 uint64_t transl_fetch_res;
249 uint32_t region_stride;
250 };
251 struct {
252 uint8_t dix_gen_res;
253 uint8_t dest_dif_flags;
254 uint8_t dif_flags;
255 uint8_t dix_gen_res2[13];
256 uint32_t ref_tag_seed;
257 uint16_t app_tag_mask;
258 uint16_t app_tag_seed;
259 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700260 uint8_t op_specific[24];
261 };
262} __attribute__((packed));
Christopher Ferris05667cd2021-02-16 16:01:34 -0800263struct iax_hw_desc {
264 uint32_t pasid : 20;
265 uint32_t rsvd : 11;
266 uint32_t priv : 1;
267 uint32_t flags : 24;
268 uint32_t opcode : 8;
269 uint64_t completion_addr;
270 uint64_t src1_addr;
271 uint64_t dst_addr;
272 uint32_t src1_size;
273 uint16_t int_handle;
274 union {
275 uint16_t compr_flags;
276 uint16_t decompr_flags;
277 };
278 uint64_t src2_addr;
279 uint32_t max_dst_size;
280 uint32_t src2_size;
281 uint32_t filter_flags;
282 uint32_t num_inputs;
283} __attribute__((packed));
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700284struct dsa_raw_desc {
285 uint64_t field[8];
286} __attribute__((packed));
287struct dsa_completion_record {
288 volatile uint8_t status;
289 union {
290 uint8_t result;
291 uint8_t dif_status;
292 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700293 uint8_t fault_info;
294 uint8_t rsvd;
295 union {
296 uint32_t bytes_completed;
297 uint32_t descs_completed;
298 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700299 uint64_t fault_addr;
300 union {
Christopher Ferris25c18d42020-10-14 17:42:58 -0700301 struct {
302 uint32_t invalid_flags : 24;
303 uint32_t rsvd2 : 8;
304 };
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700305 uint32_t delta_rec_size;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800306 uint64_t crc_val;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700307 struct {
308 uint32_t dif_chk_ref_tag;
309 uint16_t dif_chk_app_tag_mask;
310 uint16_t dif_chk_app_tag;
311 };
312 struct {
313 uint64_t dif_ins_res;
314 uint32_t dif_ins_ref_tag;
315 uint16_t dif_ins_app_tag_mask;
316 uint16_t dif_ins_app_tag;
317 };
318 struct {
319 uint32_t dif_upd_src_ref_tag;
320 uint16_t dif_upd_src_app_tag_mask;
321 uint16_t dif_upd_src_app_tag;
322 uint32_t dif_upd_dest_ref_tag;
323 uint16_t dif_upd_dest_app_tag_mask;
324 uint16_t dif_upd_dest_app_tag;
325 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700326 struct {
327 uint64_t dix_gen_res;
328 uint32_t dix_ref_tag;
329 uint16_t dix_app_tag_mask;
330 uint16_t dix_app_tag;
331 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700332 uint8_t op_specific[16];
333 };
334} __attribute__((packed));
335struct dsa_raw_completion_record {
336 uint64_t field[4];
337} __attribute__((packed));
Christopher Ferris05667cd2021-02-16 16:01:34 -0800338struct iax_completion_record {
339 volatile uint8_t status;
340 uint8_t error_code;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700341 uint8_t fault_info;
342 uint8_t rsvd;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800343 uint32_t bytes_completed;
344 uint64_t fault_addr;
345 uint32_t invalid_flags;
346 uint32_t rsvd2;
347 uint32_t output_size;
348 uint8_t output_bits;
349 uint8_t rsvd3;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700350 uint16_t xor_csum;
351 uint32_t crc;
352 uint32_t min;
353 uint32_t max;
354 uint32_t sum;
355 uint64_t rsvd4[2];
Christopher Ferris05667cd2021-02-16 16:01:34 -0800356} __attribute__((packed));
357struct iax_raw_completion_record {
358 uint64_t field[8];
359} __attribute__((packed));
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700360#endif