Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 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> |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 22 | enum 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 Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 40 | IDXD_SCMD_WQ_IRQ_ERR = 0x80100000, |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 41 | }; |
| 42 | #define IDXD_SCMD_SOFTERR_MASK 0x80000000 |
| 43 | #define IDXD_SCMD_SOFTERR_SHIFT 16 |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 44 | #define IDXD_OP_FLAG_FENCE 0x0001 |
| 45 | #define IDXD_OP_FLAG_BOF 0x0002 |
| 46 | #define IDXD_OP_FLAG_CRAV 0x0004 |
| 47 | #define IDXD_OP_FLAG_RCR 0x0008 |
| 48 | #define IDXD_OP_FLAG_RCI 0x0010 |
| 49 | #define IDXD_OP_FLAG_CRSTS 0x0020 |
| 50 | #define IDXD_OP_FLAG_CR 0x0080 |
| 51 | #define IDXD_OP_FLAG_CC 0x0100 |
| 52 | #define IDXD_OP_FLAG_ADDR1_TCS 0x0200 |
| 53 | #define IDXD_OP_FLAG_ADDR2_TCS 0x0400 |
| 54 | #define IDXD_OP_FLAG_ADDR3_TCS 0x0800 |
| 55 | #define IDXD_OP_FLAG_CR_TCS 0x1000 |
| 56 | #define IDXD_OP_FLAG_STORD 0x2000 |
| 57 | #define IDXD_OP_FLAG_DRDBK 0x4000 |
| 58 | #define IDXD_OP_FLAG_DSTS 0x8000 |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 59 | #define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000 |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 60 | #define IDXD_OP_FLAG_RD_SRC2_2ND 0x020000 |
| 61 | #define IDXD_OP_FLAG_WR_SRC2_AECS_COMP 0x040000 |
| 62 | #define IDXD_OP_FLAG_WR_SRC2_AECS_OVFL 0x080000 |
| 63 | #define IDXD_OP_FLAG_SRC2_STS 0x100000 |
| 64 | #define IDXD_OP_FLAG_CRC_RFC3720 0x200000 |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 65 | enum dsa_opcode { |
| 66 | DSA_OPCODE_NOOP = 0, |
| 67 | DSA_OPCODE_BATCH, |
| 68 | DSA_OPCODE_DRAIN, |
| 69 | DSA_OPCODE_MEMMOVE, |
| 70 | DSA_OPCODE_MEMFILL, |
| 71 | DSA_OPCODE_COMPARE, |
| 72 | DSA_OPCODE_COMPVAL, |
| 73 | DSA_OPCODE_CR_DELTA, |
| 74 | DSA_OPCODE_AP_DELTA, |
| 75 | DSA_OPCODE_DUALCAST, |
| 76 | DSA_OPCODE_CRCGEN = 0x10, |
| 77 | DSA_OPCODE_COPY_CRC, |
| 78 | DSA_OPCODE_DIF_CHECK, |
| 79 | DSA_OPCODE_DIF_INS, |
| 80 | DSA_OPCODE_DIF_STRP, |
| 81 | DSA_OPCODE_DIF_UPDT, |
| 82 | DSA_OPCODE_CFLUSH = 0x20, |
| 83 | }; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 84 | enum iax_opcode { |
| 85 | IAX_OPCODE_NOOP = 0, |
| 86 | IAX_OPCODE_DRAIN = 2, |
| 87 | IAX_OPCODE_MEMMOVE, |
| 88 | IAX_OPCODE_DECOMPRESS = 0x42, |
| 89 | IAX_OPCODE_COMPRESS, |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 90 | IAX_OPCODE_CRC64, |
| 91 | IAX_OPCODE_ZERO_DECOMP_32 = 0x48, |
| 92 | IAX_OPCODE_ZERO_DECOMP_16, |
| 93 | IAX_OPCODE_DECOMP_32 = 0x4c, |
| 94 | IAX_OPCODE_DECOMP_16, |
| 95 | IAX_OPCODE_SCAN = 0x50, |
| 96 | IAX_OPCODE_SET_MEMBER, |
| 97 | IAX_OPCODE_EXTRACT, |
| 98 | IAX_OPCODE_SELECT, |
| 99 | IAX_OPCODE_RLE_BURST, |
| 100 | IAX_OPCDE_FIND_UNIQUE, |
| 101 | IAX_OPCODE_EXPAND, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 102 | }; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 103 | enum dsa_completion_status { |
| 104 | DSA_COMP_NONE = 0, |
| 105 | DSA_COMP_SUCCESS, |
| 106 | DSA_COMP_SUCCESS_PRED, |
| 107 | DSA_COMP_PAGE_FAULT_NOBOF, |
| 108 | DSA_COMP_PAGE_FAULT_IR, |
| 109 | DSA_COMP_BATCH_FAIL, |
| 110 | DSA_COMP_BATCH_PAGE_FAULT, |
| 111 | DSA_COMP_DR_OFFSET_NOINC, |
| 112 | DSA_COMP_DR_OFFSET_ERANGE, |
| 113 | DSA_COMP_DIF_ERR, |
| 114 | DSA_COMP_BAD_OPCODE = 0x10, |
| 115 | DSA_COMP_INVALID_FLAGS, |
| 116 | DSA_COMP_NOZERO_RESERVE, |
| 117 | DSA_COMP_XFER_ERANGE, |
| 118 | DSA_COMP_DESC_CNT_ERANGE, |
| 119 | DSA_COMP_DR_ERANGE, |
| 120 | DSA_COMP_OVERLAP_BUFFERS, |
| 121 | DSA_COMP_DCAST_ERR, |
| 122 | DSA_COMP_DESCLIST_ALIGN, |
| 123 | DSA_COMP_INT_HANDLE_INVAL, |
| 124 | DSA_COMP_CRA_XLAT, |
| 125 | DSA_COMP_CRA_ALIGN, |
| 126 | DSA_COMP_ADDR_ALIGN, |
| 127 | DSA_COMP_PRIV_BAD, |
| 128 | DSA_COMP_TRAFFIC_CLASS_CONF, |
| 129 | DSA_COMP_PFAULT_RDBA, |
| 130 | DSA_COMP_HW_ERR1, |
| 131 | DSA_COMP_HW_ERR_DRB, |
| 132 | DSA_COMP_TRANSLATION_FAIL, |
| 133 | }; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 134 | enum iax_completion_status { |
| 135 | IAX_COMP_NONE = 0, |
| 136 | IAX_COMP_SUCCESS, |
| 137 | IAX_COMP_PAGE_FAULT_IR = 0x04, |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 138 | IAX_COMP_ANALYTICS_ERROR = 0x0a, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 139 | IAX_COMP_OUTBUF_OVERFLOW, |
| 140 | IAX_COMP_BAD_OPCODE = 0x10, |
| 141 | IAX_COMP_INVALID_FLAGS, |
| 142 | IAX_COMP_NOZERO_RESERVE, |
| 143 | IAX_COMP_INVALID_SIZE, |
| 144 | IAX_COMP_OVERLAP_BUFFERS = 0x16, |
| 145 | IAX_COMP_INT_HANDLE_INVAL = 0x19, |
| 146 | IAX_COMP_CRA_XLAT, |
| 147 | IAX_COMP_CRA_ALIGN, |
| 148 | IAX_COMP_ADDR_ALIGN, |
| 149 | IAX_COMP_PRIV_BAD, |
| 150 | IAX_COMP_TRAFFIC_CLASS_CONF, |
| 151 | IAX_COMP_PFAULT_RDBA, |
| 152 | IAX_COMP_HW_ERR1, |
| 153 | IAX_COMP_HW_ERR_DRB, |
| 154 | IAX_COMP_TRANSLATION_FAIL, |
| 155 | IAX_COMP_PRS_TIMEOUT, |
| 156 | IAX_COMP_WATCHDOG, |
| 157 | IAX_COMP_INVALID_COMP_FLAG = 0x30, |
| 158 | IAX_COMP_INVALID_FILTER_FLAG, |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 159 | IAX_COMP_INVALID_INPUT_SIZE, |
| 160 | IAX_COMP_INVALID_NUM_ELEMS, |
| 161 | IAX_COMP_INVALID_SRC1_WIDTH, |
| 162 | IAX_COMP_INVALID_INVERT_OUT, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 163 | }; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 164 | #define DSA_COMP_STATUS_MASK 0x7f |
| 165 | #define DSA_COMP_STATUS_WRITE 0x80 |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 166 | struct dsa_hw_desc { |
| 167 | uint32_t pasid : 20; |
| 168 | uint32_t rsvd : 11; |
| 169 | uint32_t priv : 1; |
| 170 | uint32_t flags : 24; |
| 171 | uint32_t opcode : 8; |
| 172 | uint64_t completion_addr; |
| 173 | union { |
| 174 | uint64_t src_addr; |
| 175 | uint64_t rdback_addr; |
| 176 | uint64_t pattern; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 177 | uint64_t desc_list_addr; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 178 | }; |
| 179 | union { |
| 180 | uint64_t dst_addr; |
| 181 | uint64_t rdback_addr2; |
| 182 | uint64_t src2_addr; |
| 183 | uint64_t comp_pattern; |
| 184 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 185 | union { |
| 186 | uint32_t xfer_size; |
| 187 | uint32_t desc_count; |
| 188 | }; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 189 | uint16_t int_handle; |
| 190 | uint16_t rsvd1; |
| 191 | union { |
| 192 | uint8_t expected_res; |
| 193 | struct { |
| 194 | uint64_t delta_addr; |
| 195 | uint32_t max_delta_size; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 196 | uint32_t delt_rsvd; |
| 197 | uint8_t expected_res_mask; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 198 | }; |
| 199 | uint32_t delta_rec_size; |
| 200 | uint64_t dest2; |
| 201 | struct { |
| 202 | uint32_t crc_seed; |
| 203 | uint32_t crc_rsvd; |
| 204 | uint64_t seed_addr; |
| 205 | }; |
| 206 | struct { |
| 207 | uint8_t src_dif_flags; |
| 208 | uint8_t dif_chk_res; |
| 209 | uint8_t dif_chk_flags; |
| 210 | uint8_t dif_chk_res2[5]; |
| 211 | uint32_t chk_ref_tag_seed; |
| 212 | uint16_t chk_app_tag_mask; |
| 213 | uint16_t chk_app_tag_seed; |
| 214 | }; |
| 215 | struct { |
| 216 | uint8_t dif_ins_res; |
| 217 | uint8_t dest_dif_flag; |
| 218 | uint8_t dif_ins_flags; |
| 219 | uint8_t dif_ins_res2[13]; |
| 220 | uint32_t ins_ref_tag_seed; |
| 221 | uint16_t ins_app_tag_mask; |
| 222 | uint16_t ins_app_tag_seed; |
| 223 | }; |
| 224 | struct { |
| 225 | uint8_t src_upd_flags; |
| 226 | uint8_t upd_dest_flags; |
| 227 | uint8_t dif_upd_flags; |
| 228 | uint8_t dif_upd_res[5]; |
| 229 | uint32_t src_ref_tag_seed; |
| 230 | uint16_t src_app_tag_mask; |
| 231 | uint16_t src_app_tag_seed; |
| 232 | uint32_t dest_ref_tag_seed; |
| 233 | uint16_t dest_app_tag_mask; |
| 234 | uint16_t dest_app_tag_seed; |
| 235 | }; |
| 236 | uint8_t op_specific[24]; |
| 237 | }; |
| 238 | } __attribute__((packed)); |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 239 | struct iax_hw_desc { |
| 240 | uint32_t pasid : 20; |
| 241 | uint32_t rsvd : 11; |
| 242 | uint32_t priv : 1; |
| 243 | uint32_t flags : 24; |
| 244 | uint32_t opcode : 8; |
| 245 | uint64_t completion_addr; |
| 246 | uint64_t src1_addr; |
| 247 | uint64_t dst_addr; |
| 248 | uint32_t src1_size; |
| 249 | uint16_t int_handle; |
| 250 | union { |
| 251 | uint16_t compr_flags; |
| 252 | uint16_t decompr_flags; |
| 253 | }; |
| 254 | uint64_t src2_addr; |
| 255 | uint32_t max_dst_size; |
| 256 | uint32_t src2_size; |
| 257 | uint32_t filter_flags; |
| 258 | uint32_t num_inputs; |
| 259 | } __attribute__((packed)); |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 260 | struct dsa_raw_desc { |
| 261 | uint64_t field[8]; |
| 262 | } __attribute__((packed)); |
| 263 | struct dsa_completion_record { |
| 264 | volatile uint8_t status; |
| 265 | union { |
| 266 | uint8_t result; |
| 267 | uint8_t dif_status; |
| 268 | }; |
| 269 | uint16_t rsvd; |
| 270 | uint32_t bytes_completed; |
| 271 | uint64_t fault_addr; |
| 272 | union { |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 273 | struct { |
| 274 | uint32_t invalid_flags : 24; |
| 275 | uint32_t rsvd2 : 8; |
| 276 | }; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 277 | uint32_t delta_rec_size; |
| 278 | uint32_t crc_val; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 279 | struct { |
| 280 | uint32_t dif_chk_ref_tag; |
| 281 | uint16_t dif_chk_app_tag_mask; |
| 282 | uint16_t dif_chk_app_tag; |
| 283 | }; |
| 284 | struct { |
| 285 | uint64_t dif_ins_res; |
| 286 | uint32_t dif_ins_ref_tag; |
| 287 | uint16_t dif_ins_app_tag_mask; |
| 288 | uint16_t dif_ins_app_tag; |
| 289 | }; |
| 290 | struct { |
| 291 | uint32_t dif_upd_src_ref_tag; |
| 292 | uint16_t dif_upd_src_app_tag_mask; |
| 293 | uint16_t dif_upd_src_app_tag; |
| 294 | uint32_t dif_upd_dest_ref_tag; |
| 295 | uint16_t dif_upd_dest_app_tag_mask; |
| 296 | uint16_t dif_upd_dest_app_tag; |
| 297 | }; |
| 298 | uint8_t op_specific[16]; |
| 299 | }; |
| 300 | } __attribute__((packed)); |
| 301 | struct dsa_raw_completion_record { |
| 302 | uint64_t field[4]; |
| 303 | } __attribute__((packed)); |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 304 | struct iax_completion_record { |
| 305 | volatile uint8_t status; |
| 306 | uint8_t error_code; |
| 307 | uint16_t rsvd; |
| 308 | uint32_t bytes_completed; |
| 309 | uint64_t fault_addr; |
| 310 | uint32_t invalid_flags; |
| 311 | uint32_t rsvd2; |
| 312 | uint32_t output_size; |
| 313 | uint8_t output_bits; |
| 314 | uint8_t rsvd3; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame^] | 315 | uint16_t xor_csum; |
| 316 | uint32_t crc; |
| 317 | uint32_t min; |
| 318 | uint32_t max; |
| 319 | uint32_t sum; |
| 320 | uint64_t rsvd4[2]; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 321 | } __attribute__((packed)); |
| 322 | struct iax_raw_completion_record { |
| 323 | uint64_t field[8]; |
| 324 | } __attribute__((packed)); |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 325 | #endif |