1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
7 #include <linux/types.h>
12 /* Descriptor flags */
13 #define IDXD_OP_FLAG_FENCE 0x0001
14 #define IDXD_OP_FLAG_BOF 0x0002
15 #define IDXD_OP_FLAG_CRAV 0x0004
16 #define IDXD_OP_FLAG_RCR 0x0008
17 #define IDXD_OP_FLAG_RCI 0x0010
18 #define IDXD_OP_FLAG_CRSTS 0x0020
19 #define IDXD_OP_FLAG_CR 0x0080
20 #define IDXD_OP_FLAG_CC 0x0100
21 #define IDXD_OP_FLAG_ADDR1_TCS 0x0200
22 #define IDXD_OP_FLAG_ADDR2_TCS 0x0400
23 #define IDXD_OP_FLAG_ADDR3_TCS 0x0800
24 #define IDXD_OP_FLAG_CR_TCS 0x1000
25 #define IDXD_OP_FLAG_STORD 0x2000
26 #define IDXD_OP_FLAG_DRDBK 0x4000
27 #define IDXD_OP_FLAG_DSTS 0x8000
30 #define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000
44 DSA_OPCODE_CRCGEN
= 0x10,
50 DSA_OPCODE_CFLUSH
= 0x20,
57 IAX_OPCODE_DECOMPRESS
= 0x42,
61 /* Completion record status */
62 enum dsa_completion_status
{
65 DSA_COMP_SUCCESS_PRED
,
66 DSA_COMP_PAGE_FAULT_NOBOF
,
67 DSA_COMP_PAGE_FAULT_IR
,
69 DSA_COMP_BATCH_PAGE_FAULT
,
70 DSA_COMP_DR_OFFSET_NOINC
,
71 DSA_COMP_DR_OFFSET_ERANGE
,
73 DSA_COMP_BAD_OPCODE
= 0x10,
74 DSA_COMP_INVALID_FLAGS
,
75 DSA_COMP_NOZERO_RESERVE
,
77 DSA_COMP_DESC_CNT_ERANGE
,
79 DSA_COMP_OVERLAP_BUFFERS
,
81 DSA_COMP_DESCLIST_ALIGN
,
82 DSA_COMP_INT_HANDLE_INVAL
,
87 DSA_COMP_TRAFFIC_CLASS_CONF
,
91 DSA_COMP_TRANSLATION_FAIL
,
94 enum iax_completion_status
{
97 IAX_COMP_PAGE_FAULT_IR
= 0x04,
98 IAX_COMP_OUTBUF_OVERFLOW
,
99 IAX_COMP_BAD_OPCODE
= 0x10,
100 IAX_COMP_INVALID_FLAGS
,
101 IAX_COMP_NOZERO_RESERVE
,
102 IAX_COMP_INVALID_SIZE
,
103 IAX_COMP_OVERLAP_BUFFERS
= 0x16,
104 IAX_COMP_INT_HANDLE_INVAL
= 0x19,
109 IAX_COMP_TRAFFIC_CLASS_CONF
,
110 IAX_COMP_PFAULT_RDBA
,
113 IAX_COMP_TRANSLATION_FAIL
,
114 IAX_COMP_PRS_TIMEOUT
,
116 IAX_COMP_INVALID_COMP_FLAG
= 0x30,
117 IAX_COMP_INVALID_FILTER_FLAG
,
118 IAX_COMP_INVALID_NUM_ELEMS
= 0x33,
121 #define DSA_COMP_STATUS_MASK 0x7f
122 #define DSA_COMP_STATUS_WRITE 0x80
130 uint64_t completion_addr
;
133 uint64_t rdback_addr
;
135 uint64_t desc_list_addr
;
139 uint64_t rdback_addr2
;
141 uint64_t comp_pattern
;
150 uint8_t expected_res
;
151 /* create delta record */
154 uint32_t max_delta_size
;
156 uint8_t expected_res_mask
;
158 uint32_t delta_rec_size
;
166 /* DIF check or strip */
168 uint8_t src_dif_flags
;
170 uint8_t dif_chk_flags
;
171 uint8_t dif_chk_res2
[5];
172 uint32_t chk_ref_tag_seed
;
173 uint16_t chk_app_tag_mask
;
174 uint16_t chk_app_tag_seed
;
179 uint8_t dest_dif_flag
;
180 uint8_t dif_ins_flags
;
181 uint8_t dif_ins_res2
[13];
182 uint32_t ins_ref_tag_seed
;
183 uint16_t ins_app_tag_mask
;
184 uint16_t ins_app_tag_seed
;
188 uint8_t src_upd_flags
;
189 uint8_t upd_dest_flags
;
190 uint8_t dif_upd_flags
;
191 uint8_t dif_upd_res
[5];
192 uint32_t src_ref_tag_seed
;
193 uint16_t src_app_tag_mask
;
194 uint16_t src_app_tag_seed
;
195 uint32_t dest_ref_tag_seed
;
196 uint16_t dest_app_tag_mask
;
197 uint16_t dest_app_tag_seed
;
200 uint8_t op_specific
[24];
202 } __attribute__((packed
));
210 uint64_t completion_addr
;
216 uint16_t compr_flags
;
217 uint16_t decompr_flags
;
220 uint32_t max_dst_size
;
222 uint32_t filter_flags
;
224 } __attribute__((packed
));
226 struct dsa_raw_desc
{
228 } __attribute__((packed
));
231 * The status field will be modified by hardware, therefore it should be
232 * volatile and prevent the compiler from optimize the read.
234 struct dsa_completion_record
{
235 volatile uint8_t status
;
241 uint32_t bytes_completed
;
246 uint32_t invalid_flags
:24;
250 uint16_t delta_rec_size
;
253 /* DIF check & strip */
255 uint32_t dif_chk_ref_tag
;
256 uint16_t dif_chk_app_tag_mask
;
257 uint16_t dif_chk_app_tag
;
262 uint64_t dif_ins_res
;
263 uint32_t dif_ins_ref_tag
;
264 uint16_t dif_ins_app_tag_mask
;
265 uint16_t dif_ins_app_tag
;
270 uint32_t dif_upd_src_ref_tag
;
271 uint16_t dif_upd_src_app_tag_mask
;
272 uint16_t dif_upd_src_app_tag
;
273 uint32_t dif_upd_dest_ref_tag
;
274 uint16_t dif_upd_dest_app_tag_mask
;
275 uint16_t dif_upd_dest_app_tag
;
278 uint8_t op_specific
[16];
280 } __attribute__((packed
));
282 struct dsa_raw_completion_record
{
284 } __attribute__((packed
));
286 struct iax_completion_record
{
287 volatile uint8_t status
;
290 uint32_t bytes_completed
;
292 uint32_t invalid_flags
;
294 uint32_t output_size
;
299 } __attribute__((packed
));
301 struct iax_raw_completion_record
{
303 } __attribute__((packed
));