1 /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */
2 /* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
7 #include <linux/types.h>
12 /* Driver command error status */
14 IDXD_SCMD_DEV_ENABLED
= 0x80000010,
15 IDXD_SCMD_DEV_NOT_ENABLED
= 0x80000020,
16 IDXD_SCMD_WQ_ENABLED
= 0x80000021,
17 IDXD_SCMD_DEV_DMA_ERR
= 0x80020000,
18 IDXD_SCMD_WQ_NO_GRP
= 0x80030000,
19 IDXD_SCMD_WQ_NO_NAME
= 0x80040000,
20 IDXD_SCMD_WQ_NO_SVM
= 0x80050000,
21 IDXD_SCMD_WQ_NO_THRESH
= 0x80060000,
22 IDXD_SCMD_WQ_PORTAL_ERR
= 0x80070000,
23 IDXD_SCMD_WQ_RES_ALLOC_ERR
= 0x80080000,
24 IDXD_SCMD_PERCPU_ERR
= 0x80090000,
25 IDXD_SCMD_DMA_CHAN_ERR
= 0x800a0000,
26 IDXD_SCMD_CDEV_ERR
= 0x800b0000,
27 IDXD_SCMD_WQ_NO_SWQ_SUPPORT
= 0x800c0000,
28 IDXD_SCMD_WQ_NONE_CONFIGURED
= 0x800d0000,
29 IDXD_SCMD_WQ_NO_SIZE
= 0x800e0000,
30 IDXD_SCMD_WQ_NO_PRIV
= 0x800f0000,
31 IDXD_SCMD_WQ_IRQ_ERR
= 0x80100000,
32 IDXD_SCMD_WQ_USER_NO_IOMMU
= 0x80110000,
33 IDXD_SCMD_DEV_EVL_ERR
= 0x80120000,
34 IDXD_SCMD_WQ_NO_DRV_NAME
= 0x80200000,
37 #define IDXD_SCMD_SOFTERR_MASK 0x80000000
38 #define IDXD_SCMD_SOFTERR_SHIFT 16
40 /* Descriptor flags */
41 #define IDXD_OP_FLAG_FENCE 0x0001
42 #define IDXD_OP_FLAG_BOF 0x0002
43 #define IDXD_OP_FLAG_CRAV 0x0004
44 #define IDXD_OP_FLAG_RCR 0x0008
45 #define IDXD_OP_FLAG_RCI 0x0010
46 #define IDXD_OP_FLAG_CRSTS 0x0020
47 #define IDXD_OP_FLAG_CR 0x0080
48 #define IDXD_OP_FLAG_CC 0x0100
49 #define IDXD_OP_FLAG_ADDR1_TCS 0x0200
50 #define IDXD_OP_FLAG_ADDR2_TCS 0x0400
51 #define IDXD_OP_FLAG_ADDR3_TCS 0x0800
52 #define IDXD_OP_FLAG_CR_TCS 0x1000
53 #define IDXD_OP_FLAG_STORD 0x2000
54 #define IDXD_OP_FLAG_DRDBK 0x4000
55 #define IDXD_OP_FLAG_DSTS 0x8000
58 #define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000
59 #define IDXD_OP_FLAG_RD_SRC2_2ND 0x020000
60 #define IDXD_OP_FLAG_WR_SRC2_AECS_COMP 0x040000
61 #define IDXD_OP_FLAG_WR_SRC2_AECS_OVFL 0x080000
62 #define IDXD_OP_FLAG_SRC2_STS 0x100000
63 #define IDXD_OP_FLAG_CRC_RFC3720 0x200000
77 DSA_OPCODE_TRANSL_FETCH
,
78 DSA_OPCODE_CRCGEN
= 0x10,
84 DSA_OPCODE_DIX_GEN
= 0x17,
85 DSA_OPCODE_CFLUSH
= 0x20,
92 IAX_OPCODE_DECOMPRESS
= 0x42,
95 IAX_OPCODE_ZERO_DECOMP_32
= 0x48,
96 IAX_OPCODE_ZERO_DECOMP_16
,
97 IAX_OPCODE_ZERO_COMP_32
= 0x4c,
98 IAX_OPCODE_ZERO_COMP_16
,
99 IAX_OPCODE_SCAN
= 0x50,
100 IAX_OPCODE_SET_MEMBER
,
103 IAX_OPCODE_RLE_BURST
,
104 IAX_OPCODE_FIND_UNIQUE
,
108 /* Completion record status */
109 enum dsa_completion_status
{
112 DSA_COMP_SUCCESS_PRED
,
113 DSA_COMP_PAGE_FAULT_NOBOF
,
114 DSA_COMP_PAGE_FAULT_IR
,
116 DSA_COMP_BATCH_PAGE_FAULT
,
117 DSA_COMP_DR_OFFSET_NOINC
,
118 DSA_COMP_DR_OFFSET_ERANGE
,
120 DSA_COMP_BAD_OPCODE
= 0x10,
121 DSA_COMP_INVALID_FLAGS
,
122 DSA_COMP_NOZERO_RESERVE
,
123 DSA_COMP_XFER_ERANGE
,
124 DSA_COMP_DESC_CNT_ERANGE
,
126 DSA_COMP_OVERLAP_BUFFERS
,
128 DSA_COMP_DESCLIST_ALIGN
,
129 DSA_COMP_INT_HANDLE_INVAL
,
134 DSA_COMP_TRAFFIC_CLASS_CONF
,
135 DSA_COMP_PFAULT_RDBA
,
138 DSA_COMP_TRANSLATION_FAIL
,
139 DSA_COMP_DRAIN_EVL
= 0x26,
140 DSA_COMP_BATCH_EVL_ERR
,
143 enum iax_completion_status
{
146 IAX_COMP_PAGE_FAULT_IR
= 0x04,
147 IAX_COMP_ANALYTICS_ERROR
= 0x0a,
148 IAX_COMP_OUTBUF_OVERFLOW
,
149 IAX_COMP_BAD_OPCODE
= 0x10,
150 IAX_COMP_INVALID_FLAGS
,
151 IAX_COMP_NOZERO_RESERVE
,
152 IAX_COMP_INVALID_SIZE
,
153 IAX_COMP_OVERLAP_BUFFERS
= 0x16,
154 IAX_COMP_INT_HANDLE_INVAL
= 0x19,
159 IAX_COMP_TRAFFIC_CLASS_CONF
,
160 IAX_COMP_PFAULT_RDBA
,
163 IAX_COMP_TRANSLATION_FAIL
,
164 IAX_COMP_PRS_TIMEOUT
,
166 IAX_COMP_INVALID_COMP_FLAG
= 0x30,
167 IAX_COMP_INVALID_FILTER_FLAG
,
168 IAX_COMP_INVALID_INPUT_SIZE
,
169 IAX_COMP_INVALID_NUM_ELEMS
,
170 IAX_COMP_INVALID_SRC1_WIDTH
,
171 IAX_COMP_INVALID_INVERT_OUT
,
174 #define DSA_COMP_STATUS_MASK 0x7f
175 #define DSA_COMP_STATUS_WRITE 0x80
176 #define DSA_COMP_STATUS(status) ((status) & DSA_COMP_STATUS_MASK)
184 uint64_t completion_addr
;
187 uint64_t rdback_addr
;
189 uint64_t desc_list_addr
;
190 uint64_t pattern_lower
;
191 uint64_t transl_fetch_addr
;
195 uint64_t rdback_addr2
;
197 uint64_t comp_pattern
;
202 uint32_t region_size
;
207 uint8_t expected_res
;
208 /* create delta record */
211 uint32_t max_delta_size
;
213 uint8_t expected_res_mask
;
215 uint32_t delta_rec_size
;
223 /* DIF check or strip */
225 uint8_t src_dif_flags
;
227 uint8_t dif_chk_flags
;
228 uint8_t dif_chk_res2
[5];
229 uint32_t chk_ref_tag_seed
;
230 uint16_t chk_app_tag_mask
;
231 uint16_t chk_app_tag_seed
;
236 uint8_t dest_dif_flag
;
237 uint8_t dif_ins_flags
;
238 uint8_t dif_ins_res2
[13];
239 uint32_t ins_ref_tag_seed
;
240 uint16_t ins_app_tag_mask
;
241 uint16_t ins_app_tag_seed
;
245 uint8_t src_upd_flags
;
246 uint8_t upd_dest_flags
;
247 uint8_t dif_upd_flags
;
248 uint8_t dif_upd_res
[5];
249 uint32_t src_ref_tag_seed
;
250 uint16_t src_app_tag_mask
;
251 uint16_t src_app_tag_seed
;
252 uint32_t dest_ref_tag_seed
;
253 uint16_t dest_app_tag_mask
;
254 uint16_t dest_app_tag_seed
;
258 uint64_t pattern_upper
;
260 /* Translation fetch */
262 uint64_t transl_fetch_res
;
263 uint32_t region_stride
;
269 uint8_t dest_dif_flags
;
271 uint8_t dix_gen_res2
[13];
272 uint32_t ref_tag_seed
;
273 uint16_t app_tag_mask
;
274 uint16_t app_tag_seed
;
277 uint8_t op_specific
[24];
279 } __attribute__((packed
));
287 uint64_t completion_addr
;
293 uint16_t compr_flags
;
294 uint16_t decompr_flags
;
297 uint32_t max_dst_size
;
299 uint32_t filter_flags
;
301 } __attribute__((packed
));
303 struct dsa_raw_desc
{
305 } __attribute__((packed
));
308 * The status field will be modified by hardware, therefore it should be
309 * volatile and prevent the compiler from optimize the read.
311 struct dsa_completion_record
{
312 volatile uint8_t status
;
320 uint32_t bytes_completed
;
321 uint32_t descs_completed
;
327 uint32_t invalid_flags
:24;
331 uint32_t delta_rec_size
;
334 /* DIF check & strip */
336 uint32_t dif_chk_ref_tag
;
337 uint16_t dif_chk_app_tag_mask
;
338 uint16_t dif_chk_app_tag
;
343 uint64_t dif_ins_res
;
344 uint32_t dif_ins_ref_tag
;
345 uint16_t dif_ins_app_tag_mask
;
346 uint16_t dif_ins_app_tag
;
351 uint32_t dif_upd_src_ref_tag
;
352 uint16_t dif_upd_src_app_tag_mask
;
353 uint16_t dif_upd_src_app_tag
;
354 uint32_t dif_upd_dest_ref_tag
;
355 uint16_t dif_upd_dest_app_tag_mask
;
356 uint16_t dif_upd_dest_app_tag
;
361 uint64_t dix_gen_res
;
362 uint32_t dix_ref_tag
;
363 uint16_t dix_app_tag_mask
;
364 uint16_t dix_app_tag
;
367 uint8_t op_specific
[16];
369 } __attribute__((packed
));
371 struct dsa_raw_completion_record
{
373 } __attribute__((packed
));
375 struct iax_completion_record
{
376 volatile uint8_t status
;
380 uint32_t bytes_completed
;
382 uint32_t invalid_flags
;
384 uint32_t output_size
;
393 } __attribute__((packed
));
395 struct iax_raw_completion_record
{
397 } __attribute__((packed
));