1 /****************************************************************************
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>
22 #define IDXD_OP_FLAG_FENCE 0x0001
23 #define IDXD_OP_FLAG_BOF 0x0002
24 #define IDXD_OP_FLAG_CRAV 0x0004
25 #define IDXD_OP_FLAG_RCR 0x0008
26 #define IDXD_OP_FLAG_RCI 0x0010
27 #define IDXD_OP_FLAG_CRSTS 0x0020
28 #define IDXD_OP_FLAG_CR 0x0080
29 #define IDXD_OP_FLAG_CC 0x0100
30 #define IDXD_OP_FLAG_ADDR1_TCS 0x0200
31 #define IDXD_OP_FLAG_ADDR2_TCS 0x0400
32 #define IDXD_OP_FLAG_ADDR3_TCS 0x0800
33 #define IDXD_OP_FLAG_CR_TCS 0x1000
34 #define IDXD_OP_FLAG_STORD 0x2000
35 #define IDXD_OP_FLAG_DRDBK 0x4000
36 #define IDXD_OP_FLAG_DSTS 0x8000
37 enum dsa_opcode {
38   DSA_OPCODE_NOOP = 0,
39   DSA_OPCODE_BATCH,
40   DSA_OPCODE_DRAIN,
41   DSA_OPCODE_MEMMOVE,
42   DSA_OPCODE_MEMFILL,
43   DSA_OPCODE_COMPARE,
44   DSA_OPCODE_COMPVAL,
45   DSA_OPCODE_CR_DELTA,
46   DSA_OPCODE_AP_DELTA,
47   DSA_OPCODE_DUALCAST,
48   DSA_OPCODE_CRCGEN = 0x10,
49   DSA_OPCODE_COPY_CRC,
50   DSA_OPCODE_DIF_CHECK,
51   DSA_OPCODE_DIF_INS,
52   DSA_OPCODE_DIF_STRP,
53   DSA_OPCODE_DIF_UPDT,
54   DSA_OPCODE_CFLUSH = 0x20,
55 };
56 enum dsa_completion_status {
57   DSA_COMP_NONE = 0,
58   DSA_COMP_SUCCESS,
59   DSA_COMP_SUCCESS_PRED,
60   DSA_COMP_PAGE_FAULT_NOBOF,
61   DSA_COMP_PAGE_FAULT_IR,
62   DSA_COMP_BATCH_FAIL,
63   DSA_COMP_BATCH_PAGE_FAULT,
64   DSA_COMP_DR_OFFSET_NOINC,
65   DSA_COMP_DR_OFFSET_ERANGE,
66   DSA_COMP_DIF_ERR,
67   DSA_COMP_BAD_OPCODE = 0x10,
68   DSA_COMP_INVALID_FLAGS,
69   DSA_COMP_NOZERO_RESERVE,
70   DSA_COMP_XFER_ERANGE,
71   DSA_COMP_DESC_CNT_ERANGE,
72   DSA_COMP_DR_ERANGE,
73   DSA_COMP_OVERLAP_BUFFERS,
74   DSA_COMP_DCAST_ERR,
75   DSA_COMP_DESCLIST_ALIGN,
76   DSA_COMP_INT_HANDLE_INVAL,
77   DSA_COMP_CRA_XLAT,
78   DSA_COMP_CRA_ALIGN,
79   DSA_COMP_ADDR_ALIGN,
80   DSA_COMP_PRIV_BAD,
81   DSA_COMP_TRAFFIC_CLASS_CONF,
82   DSA_COMP_PFAULT_RDBA,
83   DSA_COMP_HW_ERR1,
84   DSA_COMP_HW_ERR_DRB,
85   DSA_COMP_TRANSLATION_FAIL,
86 };
87 #define DSA_COMP_STATUS_MASK 0x7f
88 #define DSA_COMP_STATUS_WRITE 0x80
89 struct dsa_hw_desc {
90   uint32_t pasid : 20;
91   uint32_t rsvd : 11;
92   uint32_t priv : 1;
93   uint32_t flags : 24;
94   uint32_t opcode : 8;
95   uint64_t completion_addr;
96   union {
97     uint64_t src_addr;
98     uint64_t rdback_addr;
99     uint64_t pattern;
100     uint64_t desc_list_addr;
101   };
102   union {
103     uint64_t dst_addr;
104     uint64_t rdback_addr2;
105     uint64_t src2_addr;
106     uint64_t comp_pattern;
107   };
108   union {
109     uint32_t xfer_size;
110     uint32_t desc_count;
111   };
112   uint16_t int_handle;
113   uint16_t rsvd1;
114   union {
115     uint8_t expected_res;
116     struct {
117       uint64_t delta_addr;
118       uint32_t max_delta_size;
119     };
120     uint32_t delta_rec_size;
121     uint64_t dest2;
122     struct {
123       uint32_t crc_seed;
124       uint32_t crc_rsvd;
125       uint64_t seed_addr;
126     };
127     struct {
128       uint8_t src_dif_flags;
129       uint8_t dif_chk_res;
130       uint8_t dif_chk_flags;
131       uint8_t dif_chk_res2[5];
132       uint32_t chk_ref_tag_seed;
133       uint16_t chk_app_tag_mask;
134       uint16_t chk_app_tag_seed;
135     };
136     struct {
137       uint8_t dif_ins_res;
138       uint8_t dest_dif_flag;
139       uint8_t dif_ins_flags;
140       uint8_t dif_ins_res2[13];
141       uint32_t ins_ref_tag_seed;
142       uint16_t ins_app_tag_mask;
143       uint16_t ins_app_tag_seed;
144     };
145     struct {
146       uint8_t src_upd_flags;
147       uint8_t upd_dest_flags;
148       uint8_t dif_upd_flags;
149       uint8_t dif_upd_res[5];
150       uint32_t src_ref_tag_seed;
151       uint16_t src_app_tag_mask;
152       uint16_t src_app_tag_seed;
153       uint32_t dest_ref_tag_seed;
154       uint16_t dest_app_tag_mask;
155       uint16_t dest_app_tag_seed;
156     };
157     uint8_t op_specific[24];
158   };
159 } __attribute__((packed));
160 struct dsa_raw_desc {
161   uint64_t field[8];
162 } __attribute__((packed));
163 struct dsa_completion_record {
164   volatile uint8_t status;
165   union {
166     uint8_t result;
167     uint8_t dif_status;
168   };
169   uint16_t rsvd;
170   uint32_t bytes_completed;
171   uint64_t fault_addr;
172   union {
173     uint16_t delta_rec_size;
174     uint16_t crc_val;
175     struct {
176       uint32_t dif_chk_ref_tag;
177       uint16_t dif_chk_app_tag_mask;
178       uint16_t dif_chk_app_tag;
179     };
180     struct {
181       uint64_t dif_ins_res;
182       uint32_t dif_ins_ref_tag;
183       uint16_t dif_ins_app_tag_mask;
184       uint16_t dif_ins_app_tag;
185     };
186     struct {
187       uint32_t dif_upd_src_ref_tag;
188       uint16_t dif_upd_src_app_tag_mask;
189       uint16_t dif_upd_src_app_tag;
190       uint32_t dif_upd_dest_ref_tag;
191       uint16_t dif_upd_dest_app_tag_mask;
192       uint16_t dif_upd_dest_app_tag;
193     };
194     uint8_t op_specific[16];
195   };
196 } __attribute__((packed));
197 struct dsa_raw_completion_record {
198   uint64_t field[4];
199 } __attribute__((packed));
200 #endif
201