blob: 7118e81c5d58bd09151c3333ebb46bae83109ca9 [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 Ferrisbb9fcb42020-04-06 11:38:04 -07007#ifndef _USR_IDXD_H_
8#define _USR_IDXD_H_
9#include <stdint.h>
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070010enum idxd_scmd_stat {
11 IDXD_SCMD_DEV_ENABLED = 0x80000010,
12 IDXD_SCMD_DEV_NOT_ENABLED = 0x80000020,
13 IDXD_SCMD_WQ_ENABLED = 0x80000021,
14 IDXD_SCMD_DEV_DMA_ERR = 0x80020000,
15 IDXD_SCMD_WQ_NO_GRP = 0x80030000,
16 IDXD_SCMD_WQ_NO_NAME = 0x80040000,
17 IDXD_SCMD_WQ_NO_SVM = 0x80050000,
18 IDXD_SCMD_WQ_NO_THRESH = 0x80060000,
19 IDXD_SCMD_WQ_PORTAL_ERR = 0x80070000,
20 IDXD_SCMD_WQ_RES_ALLOC_ERR = 0x80080000,
21 IDXD_SCMD_PERCPU_ERR = 0x80090000,
22 IDXD_SCMD_DMA_CHAN_ERR = 0x800a0000,
23 IDXD_SCMD_CDEV_ERR = 0x800b0000,
24 IDXD_SCMD_WQ_NO_SWQ_SUPPORT = 0x800c0000,
25 IDXD_SCMD_WQ_NONE_CONFIGURED = 0x800d0000,
26 IDXD_SCMD_WQ_NO_SIZE = 0x800e0000,
27 IDXD_SCMD_WQ_NO_PRIV = 0x800f0000,
Christopher Ferris1ed55342022-03-22 16:06:25 -070028 IDXD_SCMD_WQ_IRQ_ERR = 0x80100000,
Christopher Ferris6cd53a52022-12-12 23:39:16 +000029 IDXD_SCMD_WQ_USER_NO_IOMMU = 0x80110000,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070030 IDXD_SCMD_DEV_EVL_ERR = 0x80120000,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070031};
32#define IDXD_SCMD_SOFTERR_MASK 0x80000000
33#define IDXD_SCMD_SOFTERR_SHIFT 16
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070034#define IDXD_OP_FLAG_FENCE 0x0001
35#define IDXD_OP_FLAG_BOF 0x0002
36#define IDXD_OP_FLAG_CRAV 0x0004
37#define IDXD_OP_FLAG_RCR 0x0008
38#define IDXD_OP_FLAG_RCI 0x0010
39#define IDXD_OP_FLAG_CRSTS 0x0020
40#define IDXD_OP_FLAG_CR 0x0080
41#define IDXD_OP_FLAG_CC 0x0100
42#define IDXD_OP_FLAG_ADDR1_TCS 0x0200
43#define IDXD_OP_FLAG_ADDR2_TCS 0x0400
44#define IDXD_OP_FLAG_ADDR3_TCS 0x0800
45#define IDXD_OP_FLAG_CR_TCS 0x1000
46#define IDXD_OP_FLAG_STORD 0x2000
47#define IDXD_OP_FLAG_DRDBK 0x4000
48#define IDXD_OP_FLAG_DSTS 0x8000
Christopher Ferris05667cd2021-02-16 16:01:34 -080049#define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000
Christopher Ferris80ae69d2022-08-02 16:32:21 -070050#define IDXD_OP_FLAG_RD_SRC2_2ND 0x020000
51#define IDXD_OP_FLAG_WR_SRC2_AECS_COMP 0x040000
52#define IDXD_OP_FLAG_WR_SRC2_AECS_OVFL 0x080000
53#define IDXD_OP_FLAG_SRC2_STS 0x100000
54#define IDXD_OP_FLAG_CRC_RFC3720 0x200000
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070055enum dsa_opcode {
56 DSA_OPCODE_NOOP = 0,
57 DSA_OPCODE_BATCH,
58 DSA_OPCODE_DRAIN,
59 DSA_OPCODE_MEMMOVE,
60 DSA_OPCODE_MEMFILL,
61 DSA_OPCODE_COMPARE,
62 DSA_OPCODE_COMPVAL,
63 DSA_OPCODE_CR_DELTA,
64 DSA_OPCODE_AP_DELTA,
65 DSA_OPCODE_DUALCAST,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070066 DSA_OPCODE_TRANSL_FETCH,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070067 DSA_OPCODE_CRCGEN = 0x10,
68 DSA_OPCODE_COPY_CRC,
69 DSA_OPCODE_DIF_CHECK,
70 DSA_OPCODE_DIF_INS,
71 DSA_OPCODE_DIF_STRP,
72 DSA_OPCODE_DIF_UPDT,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070073 DSA_OPCODE_DIX_GEN = 0x17,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070074 DSA_OPCODE_CFLUSH = 0x20,
75};
Christopher Ferris05667cd2021-02-16 16:01:34 -080076enum iax_opcode {
77 IAX_OPCODE_NOOP = 0,
78 IAX_OPCODE_DRAIN = 2,
79 IAX_OPCODE_MEMMOVE,
80 IAX_OPCODE_DECOMPRESS = 0x42,
81 IAX_OPCODE_COMPRESS,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070082 IAX_OPCODE_CRC64,
83 IAX_OPCODE_ZERO_DECOMP_32 = 0x48,
84 IAX_OPCODE_ZERO_DECOMP_16,
Christopher Ferris7447a1c2022-10-04 18:24:44 -070085 IAX_OPCODE_ZERO_COMP_32 = 0x4c,
86 IAX_OPCODE_ZERO_COMP_16,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070087 IAX_OPCODE_SCAN = 0x50,
88 IAX_OPCODE_SET_MEMBER,
89 IAX_OPCODE_EXTRACT,
90 IAX_OPCODE_SELECT,
91 IAX_OPCODE_RLE_BURST,
Christopher Ferris7447a1c2022-10-04 18:24:44 -070092 IAX_OPCODE_FIND_UNIQUE,
Christopher Ferris80ae69d2022-08-02 16:32:21 -070093 IAX_OPCODE_EXPAND,
Christopher Ferris05667cd2021-02-16 16:01:34 -080094};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070095enum dsa_completion_status {
96 DSA_COMP_NONE = 0,
97 DSA_COMP_SUCCESS,
98 DSA_COMP_SUCCESS_PRED,
99 DSA_COMP_PAGE_FAULT_NOBOF,
100 DSA_COMP_PAGE_FAULT_IR,
101 DSA_COMP_BATCH_FAIL,
102 DSA_COMP_BATCH_PAGE_FAULT,
103 DSA_COMP_DR_OFFSET_NOINC,
104 DSA_COMP_DR_OFFSET_ERANGE,
105 DSA_COMP_DIF_ERR,
106 DSA_COMP_BAD_OPCODE = 0x10,
107 DSA_COMP_INVALID_FLAGS,
108 DSA_COMP_NOZERO_RESERVE,
109 DSA_COMP_XFER_ERANGE,
110 DSA_COMP_DESC_CNT_ERANGE,
111 DSA_COMP_DR_ERANGE,
112 DSA_COMP_OVERLAP_BUFFERS,
113 DSA_COMP_DCAST_ERR,
114 DSA_COMP_DESCLIST_ALIGN,
115 DSA_COMP_INT_HANDLE_INVAL,
116 DSA_COMP_CRA_XLAT,
117 DSA_COMP_CRA_ALIGN,
118 DSA_COMP_ADDR_ALIGN,
119 DSA_COMP_PRIV_BAD,
120 DSA_COMP_TRAFFIC_CLASS_CONF,
121 DSA_COMP_PFAULT_RDBA,
122 DSA_COMP_HW_ERR1,
123 DSA_COMP_HW_ERR_DRB,
124 DSA_COMP_TRANSLATION_FAIL,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700125 DSA_COMP_DRAIN_EVL = 0x26,
126 DSA_COMP_BATCH_EVL_ERR,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700127};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800128enum iax_completion_status {
129 IAX_COMP_NONE = 0,
130 IAX_COMP_SUCCESS,
131 IAX_COMP_PAGE_FAULT_IR = 0x04,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700132 IAX_COMP_ANALYTICS_ERROR = 0x0a,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800133 IAX_COMP_OUTBUF_OVERFLOW,
134 IAX_COMP_BAD_OPCODE = 0x10,
135 IAX_COMP_INVALID_FLAGS,
136 IAX_COMP_NOZERO_RESERVE,
137 IAX_COMP_INVALID_SIZE,
138 IAX_COMP_OVERLAP_BUFFERS = 0x16,
139 IAX_COMP_INT_HANDLE_INVAL = 0x19,
140 IAX_COMP_CRA_XLAT,
141 IAX_COMP_CRA_ALIGN,
142 IAX_COMP_ADDR_ALIGN,
143 IAX_COMP_PRIV_BAD,
144 IAX_COMP_TRAFFIC_CLASS_CONF,
145 IAX_COMP_PFAULT_RDBA,
146 IAX_COMP_HW_ERR1,
147 IAX_COMP_HW_ERR_DRB,
148 IAX_COMP_TRANSLATION_FAIL,
149 IAX_COMP_PRS_TIMEOUT,
150 IAX_COMP_WATCHDOG,
151 IAX_COMP_INVALID_COMP_FLAG = 0x30,
152 IAX_COMP_INVALID_FILTER_FLAG,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700153 IAX_COMP_INVALID_INPUT_SIZE,
154 IAX_COMP_INVALID_NUM_ELEMS,
155 IAX_COMP_INVALID_SRC1_WIDTH,
156 IAX_COMP_INVALID_INVERT_OUT,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800157};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700158#define DSA_COMP_STATUS_MASK 0x7f
159#define DSA_COMP_STATUS_WRITE 0x80
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700160#define DSA_COMP_STATUS(status) ((status) & DSA_COMP_STATUS_MASK)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700161struct dsa_hw_desc {
162 uint32_t pasid : 20;
163 uint32_t rsvd : 11;
164 uint32_t priv : 1;
165 uint32_t flags : 24;
166 uint32_t opcode : 8;
167 uint64_t completion_addr;
168 union {
169 uint64_t src_addr;
170 uint64_t rdback_addr;
171 uint64_t pattern;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700172 uint64_t desc_list_addr;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700173 uint64_t pattern_lower;
174 uint64_t transl_fetch_addr;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700175 };
176 union {
177 uint64_t dst_addr;
178 uint64_t rdback_addr2;
179 uint64_t src2_addr;
180 uint64_t comp_pattern;
181 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700182 union {
183 uint32_t xfer_size;
184 uint32_t desc_count;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700185 uint32_t region_size;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700186 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700187 uint16_t int_handle;
188 uint16_t rsvd1;
189 union {
190 uint8_t expected_res;
191 struct {
192 uint64_t delta_addr;
193 uint32_t max_delta_size;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700194 uint32_t delt_rsvd;
195 uint8_t expected_res_mask;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700196 };
197 uint32_t delta_rec_size;
198 uint64_t dest2;
199 struct {
200 uint32_t crc_seed;
201 uint32_t crc_rsvd;
202 uint64_t seed_addr;
203 };
204 struct {
205 uint8_t src_dif_flags;
206 uint8_t dif_chk_res;
207 uint8_t dif_chk_flags;
208 uint8_t dif_chk_res2[5];
209 uint32_t chk_ref_tag_seed;
210 uint16_t chk_app_tag_mask;
211 uint16_t chk_app_tag_seed;
212 };
213 struct {
214 uint8_t dif_ins_res;
215 uint8_t dest_dif_flag;
216 uint8_t dif_ins_flags;
217 uint8_t dif_ins_res2[13];
218 uint32_t ins_ref_tag_seed;
219 uint16_t ins_app_tag_mask;
220 uint16_t ins_app_tag_seed;
221 };
222 struct {
223 uint8_t src_upd_flags;
224 uint8_t upd_dest_flags;
225 uint8_t dif_upd_flags;
226 uint8_t dif_upd_res[5];
227 uint32_t src_ref_tag_seed;
228 uint16_t src_app_tag_mask;
229 uint16_t src_app_tag_seed;
230 uint32_t dest_ref_tag_seed;
231 uint16_t dest_app_tag_mask;
232 uint16_t dest_app_tag_seed;
233 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700234 uint64_t pattern_upper;
235 struct {
236 uint64_t transl_fetch_res;
237 uint32_t region_stride;
238 };
239 struct {
240 uint8_t dix_gen_res;
241 uint8_t dest_dif_flags;
242 uint8_t dif_flags;
243 uint8_t dix_gen_res2[13];
244 uint32_t ref_tag_seed;
245 uint16_t app_tag_mask;
246 uint16_t app_tag_seed;
247 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700248 uint8_t op_specific[24];
249 };
250} __attribute__((packed));
Christopher Ferris05667cd2021-02-16 16:01:34 -0800251struct iax_hw_desc {
252 uint32_t pasid : 20;
253 uint32_t rsvd : 11;
254 uint32_t priv : 1;
255 uint32_t flags : 24;
256 uint32_t opcode : 8;
257 uint64_t completion_addr;
258 uint64_t src1_addr;
259 uint64_t dst_addr;
260 uint32_t src1_size;
261 uint16_t int_handle;
262 union {
263 uint16_t compr_flags;
264 uint16_t decompr_flags;
265 };
266 uint64_t src2_addr;
267 uint32_t max_dst_size;
268 uint32_t src2_size;
269 uint32_t filter_flags;
270 uint32_t num_inputs;
271} __attribute__((packed));
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700272struct dsa_raw_desc {
273 uint64_t field[8];
274} __attribute__((packed));
275struct dsa_completion_record {
276 volatile uint8_t status;
277 union {
278 uint8_t result;
279 uint8_t dif_status;
280 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700281 uint8_t fault_info;
282 uint8_t rsvd;
283 union {
284 uint32_t bytes_completed;
285 uint32_t descs_completed;
286 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700287 uint64_t fault_addr;
288 union {
Christopher Ferris25c18d42020-10-14 17:42:58 -0700289 struct {
290 uint32_t invalid_flags : 24;
291 uint32_t rsvd2 : 8;
292 };
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700293 uint32_t delta_rec_size;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800294 uint64_t crc_val;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700295 struct {
296 uint32_t dif_chk_ref_tag;
297 uint16_t dif_chk_app_tag_mask;
298 uint16_t dif_chk_app_tag;
299 };
300 struct {
301 uint64_t dif_ins_res;
302 uint32_t dif_ins_ref_tag;
303 uint16_t dif_ins_app_tag_mask;
304 uint16_t dif_ins_app_tag;
305 };
306 struct {
307 uint32_t dif_upd_src_ref_tag;
308 uint16_t dif_upd_src_app_tag_mask;
309 uint16_t dif_upd_src_app_tag;
310 uint32_t dif_upd_dest_ref_tag;
311 uint16_t dif_upd_dest_app_tag_mask;
312 uint16_t dif_upd_dest_app_tag;
313 };
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700314 struct {
315 uint64_t dix_gen_res;
316 uint32_t dix_ref_tag;
317 uint16_t dix_app_tag_mask;
318 uint16_t dix_app_tag;
319 };
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700320 uint8_t op_specific[16];
321 };
322} __attribute__((packed));
323struct dsa_raw_completion_record {
324 uint64_t field[4];
325} __attribute__((packed));
Christopher Ferris05667cd2021-02-16 16:01:34 -0800326struct iax_completion_record {
327 volatile uint8_t status;
328 uint8_t error_code;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700329 uint8_t fault_info;
330 uint8_t rsvd;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800331 uint32_t bytes_completed;
332 uint64_t fault_addr;
333 uint32_t invalid_flags;
334 uint32_t rsvd2;
335 uint32_t output_size;
336 uint8_t output_bits;
337 uint8_t rsvd3;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700338 uint16_t xor_csum;
339 uint32_t crc;
340 uint32_t min;
341 uint32_t max;
342 uint32_t sum;
343 uint64_t rsvd4[2];
Christopher Ferris05667cd2021-02-16 16:01:34 -0800344} __attribute__((packed));
345struct iax_raw_completion_record {
346 uint64_t field[8];
347} __attribute__((packed));
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700348#endif