18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright(c) 2019 Intel Corporation. All rights rsvd. */ 38c2ecf20Sopenharmony_ci#ifndef _IDXD_REGISTERS_H_ 48c2ecf20Sopenharmony_ci#define _IDXD_REGISTERS_H_ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci/* PCI Config */ 78c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_DSA_SPR0 0x0b25 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define IDXD_MMIO_BAR 0 108c2ecf20Sopenharmony_ci#define IDXD_WQ_BAR 2 118c2ecf20Sopenharmony_ci#define IDXD_PORTAL_SIZE PAGE_SIZE 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* MMIO Device BAR0 Registers */ 148c2ecf20Sopenharmony_ci#define IDXD_VER_OFFSET 0x00 158c2ecf20Sopenharmony_ci#define IDXD_VER_MAJOR_MASK 0xf0 168c2ecf20Sopenharmony_ci#define IDXD_VER_MINOR_MASK 0x0f 178c2ecf20Sopenharmony_ci#define GET_IDXD_VER_MAJOR(x) (((x) & IDXD_VER_MAJOR_MASK) >> 4) 188c2ecf20Sopenharmony_ci#define GET_IDXD_VER_MINOR(x) ((x) & IDXD_VER_MINOR_MASK) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciunion gen_cap_reg { 218c2ecf20Sopenharmony_ci struct { 228c2ecf20Sopenharmony_ci u64 block_on_fault:1; 238c2ecf20Sopenharmony_ci u64 overlap_copy:1; 248c2ecf20Sopenharmony_ci u64 cache_control_mem:1; 258c2ecf20Sopenharmony_ci u64 cache_control_cache:1; 268c2ecf20Sopenharmony_ci u64 rsvd:3; 278c2ecf20Sopenharmony_ci u64 int_handle_req:1; 288c2ecf20Sopenharmony_ci u64 dest_readback:1; 298c2ecf20Sopenharmony_ci u64 drain_readback:1; 308c2ecf20Sopenharmony_ci u64 rsvd2:6; 318c2ecf20Sopenharmony_ci u64 max_xfer_shift:5; 328c2ecf20Sopenharmony_ci u64 max_batch_shift:4; 338c2ecf20Sopenharmony_ci u64 max_ims_mult:6; 348c2ecf20Sopenharmony_ci u64 config_en:1; 358c2ecf20Sopenharmony_ci u64 max_descs_per_engine:8; 368c2ecf20Sopenharmony_ci u64 rsvd3:24; 378c2ecf20Sopenharmony_ci }; 388c2ecf20Sopenharmony_ci u64 bits; 398c2ecf20Sopenharmony_ci} __packed; 408c2ecf20Sopenharmony_ci#define IDXD_GENCAP_OFFSET 0x10 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciunion wq_cap_reg { 438c2ecf20Sopenharmony_ci struct { 448c2ecf20Sopenharmony_ci u64 total_wq_size:16; 458c2ecf20Sopenharmony_ci u64 num_wqs:8; 468c2ecf20Sopenharmony_ci u64 wqcfg_size:4; 478c2ecf20Sopenharmony_ci u64 rsvd:20; 488c2ecf20Sopenharmony_ci u64 shared_mode:1; 498c2ecf20Sopenharmony_ci u64 dedicated_mode:1; 508c2ecf20Sopenharmony_ci u64 rsvd2:1; 518c2ecf20Sopenharmony_ci u64 priority:1; 528c2ecf20Sopenharmony_ci u64 occupancy:1; 538c2ecf20Sopenharmony_ci u64 occupancy_int:1; 548c2ecf20Sopenharmony_ci u64 rsvd3:10; 558c2ecf20Sopenharmony_ci }; 568c2ecf20Sopenharmony_ci u64 bits; 578c2ecf20Sopenharmony_ci} __packed; 588c2ecf20Sopenharmony_ci#define IDXD_WQCAP_OFFSET 0x20 598c2ecf20Sopenharmony_ci#define IDXD_WQCFG_MIN 5 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ciunion group_cap_reg { 628c2ecf20Sopenharmony_ci struct { 638c2ecf20Sopenharmony_ci u64 num_groups:8; 648c2ecf20Sopenharmony_ci u64 total_tokens:8; 658c2ecf20Sopenharmony_ci u64 token_en:1; 668c2ecf20Sopenharmony_ci u64 token_limit:1; 678c2ecf20Sopenharmony_ci u64 rsvd:46; 688c2ecf20Sopenharmony_ci }; 698c2ecf20Sopenharmony_ci u64 bits; 708c2ecf20Sopenharmony_ci} __packed; 718c2ecf20Sopenharmony_ci#define IDXD_GRPCAP_OFFSET 0x30 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciunion engine_cap_reg { 748c2ecf20Sopenharmony_ci struct { 758c2ecf20Sopenharmony_ci u64 num_engines:8; 768c2ecf20Sopenharmony_ci u64 rsvd:56; 778c2ecf20Sopenharmony_ci }; 788c2ecf20Sopenharmony_ci u64 bits; 798c2ecf20Sopenharmony_ci} __packed; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define IDXD_ENGCAP_OFFSET 0x38 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define IDXD_OPCAP_NOOP 0x0001 848c2ecf20Sopenharmony_ci#define IDXD_OPCAP_BATCH 0x0002 858c2ecf20Sopenharmony_ci#define IDXD_OPCAP_MEMMOVE 0x0008 868c2ecf20Sopenharmony_cistruct opcap { 878c2ecf20Sopenharmony_ci u64 bits[4]; 888c2ecf20Sopenharmony_ci}; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define IDXD_OPCAP_OFFSET 0x40 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define IDXD_TABLE_OFFSET 0x60 938c2ecf20Sopenharmony_ciunion offsets_reg { 948c2ecf20Sopenharmony_ci struct { 958c2ecf20Sopenharmony_ci u64 grpcfg:16; 968c2ecf20Sopenharmony_ci u64 wqcfg:16; 978c2ecf20Sopenharmony_ci u64 msix_perm:16; 988c2ecf20Sopenharmony_ci u64 ims:16; 998c2ecf20Sopenharmony_ci u64 perfmon:16; 1008c2ecf20Sopenharmony_ci u64 rsvd:48; 1018c2ecf20Sopenharmony_ci }; 1028c2ecf20Sopenharmony_ci u64 bits[2]; 1038c2ecf20Sopenharmony_ci} __packed; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define IDXD_GENCFG_OFFSET 0x80 1068c2ecf20Sopenharmony_ciunion gencfg_reg { 1078c2ecf20Sopenharmony_ci struct { 1088c2ecf20Sopenharmony_ci u32 token_limit:8; 1098c2ecf20Sopenharmony_ci u32 rsvd:4; 1108c2ecf20Sopenharmony_ci u32 user_int_en:1; 1118c2ecf20Sopenharmony_ci u32 rsvd2:19; 1128c2ecf20Sopenharmony_ci }; 1138c2ecf20Sopenharmony_ci u32 bits; 1148c2ecf20Sopenharmony_ci} __packed; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci#define IDXD_GENCTRL_OFFSET 0x88 1178c2ecf20Sopenharmony_ciunion genctrl_reg { 1188c2ecf20Sopenharmony_ci struct { 1198c2ecf20Sopenharmony_ci u32 softerr_int_en:1; 1208c2ecf20Sopenharmony_ci u32 rsvd:31; 1218c2ecf20Sopenharmony_ci }; 1228c2ecf20Sopenharmony_ci u32 bits; 1238c2ecf20Sopenharmony_ci} __packed; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#define IDXD_GENSTATS_OFFSET 0x90 1268c2ecf20Sopenharmony_ciunion gensts_reg { 1278c2ecf20Sopenharmony_ci struct { 1288c2ecf20Sopenharmony_ci u32 state:2; 1298c2ecf20Sopenharmony_ci u32 reset_type:2; 1308c2ecf20Sopenharmony_ci u32 rsvd:28; 1318c2ecf20Sopenharmony_ci }; 1328c2ecf20Sopenharmony_ci u32 bits; 1338c2ecf20Sopenharmony_ci} __packed; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_cienum idxd_device_status_state { 1368c2ecf20Sopenharmony_ci IDXD_DEVICE_STATE_DISABLED = 0, 1378c2ecf20Sopenharmony_ci IDXD_DEVICE_STATE_ENABLED, 1388c2ecf20Sopenharmony_ci IDXD_DEVICE_STATE_DRAIN, 1398c2ecf20Sopenharmony_ci IDXD_DEVICE_STATE_HALT, 1408c2ecf20Sopenharmony_ci}; 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_cienum idxd_device_reset_type { 1438c2ecf20Sopenharmony_ci IDXD_DEVICE_RESET_SOFTWARE = 0, 1448c2ecf20Sopenharmony_ci IDXD_DEVICE_RESET_FLR, 1458c2ecf20Sopenharmony_ci IDXD_DEVICE_RESET_WARM, 1468c2ecf20Sopenharmony_ci IDXD_DEVICE_RESET_COLD, 1478c2ecf20Sopenharmony_ci}; 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci#define IDXD_INTCAUSE_OFFSET 0x98 1508c2ecf20Sopenharmony_ci#define IDXD_INTC_ERR 0x01 1518c2ecf20Sopenharmony_ci#define IDXD_INTC_CMD 0x02 1528c2ecf20Sopenharmony_ci#define IDXD_INTC_OCCUPY 0x04 1538c2ecf20Sopenharmony_ci#define IDXD_INTC_PERFMON_OVFL 0x08 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci#define IDXD_CMD_OFFSET 0xa0 1568c2ecf20Sopenharmony_ciunion idxd_command_reg { 1578c2ecf20Sopenharmony_ci struct { 1588c2ecf20Sopenharmony_ci u32 operand:20; 1598c2ecf20Sopenharmony_ci u32 cmd:5; 1608c2ecf20Sopenharmony_ci u32 rsvd:6; 1618c2ecf20Sopenharmony_ci u32 int_req:1; 1628c2ecf20Sopenharmony_ci }; 1638c2ecf20Sopenharmony_ci u32 bits; 1648c2ecf20Sopenharmony_ci} __packed; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cienum idxd_cmd { 1678c2ecf20Sopenharmony_ci IDXD_CMD_ENABLE_DEVICE = 1, 1688c2ecf20Sopenharmony_ci IDXD_CMD_DISABLE_DEVICE, 1698c2ecf20Sopenharmony_ci IDXD_CMD_DRAIN_ALL, 1708c2ecf20Sopenharmony_ci IDXD_CMD_ABORT_ALL, 1718c2ecf20Sopenharmony_ci IDXD_CMD_RESET_DEVICE, 1728c2ecf20Sopenharmony_ci IDXD_CMD_ENABLE_WQ, 1738c2ecf20Sopenharmony_ci IDXD_CMD_DISABLE_WQ, 1748c2ecf20Sopenharmony_ci IDXD_CMD_DRAIN_WQ, 1758c2ecf20Sopenharmony_ci IDXD_CMD_ABORT_WQ, 1768c2ecf20Sopenharmony_ci IDXD_CMD_RESET_WQ, 1778c2ecf20Sopenharmony_ci IDXD_CMD_DRAIN_PASID, 1788c2ecf20Sopenharmony_ci IDXD_CMD_ABORT_PASID, 1798c2ecf20Sopenharmony_ci IDXD_CMD_REQUEST_INT_HANDLE, 1808c2ecf20Sopenharmony_ci}; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci#define IDXD_CMDSTS_OFFSET 0xa8 1838c2ecf20Sopenharmony_ciunion cmdsts_reg { 1848c2ecf20Sopenharmony_ci struct { 1858c2ecf20Sopenharmony_ci u8 err; 1868c2ecf20Sopenharmony_ci u16 result; 1878c2ecf20Sopenharmony_ci u8 rsvd:7; 1888c2ecf20Sopenharmony_ci u8 active:1; 1898c2ecf20Sopenharmony_ci }; 1908c2ecf20Sopenharmony_ci u32 bits; 1918c2ecf20Sopenharmony_ci} __packed; 1928c2ecf20Sopenharmony_ci#define IDXD_CMDSTS_ACTIVE 0x80000000 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_cienum idxd_cmdsts_err { 1958c2ecf20Sopenharmony_ci IDXD_CMDSTS_SUCCESS = 0, 1968c2ecf20Sopenharmony_ci IDXD_CMDSTS_INVAL_CMD, 1978c2ecf20Sopenharmony_ci IDXD_CMDSTS_INVAL_WQIDX, 1988c2ecf20Sopenharmony_ci IDXD_CMDSTS_HW_ERR, 1998c2ecf20Sopenharmony_ci /* enable device errors */ 2008c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_DEV_ENABLED = 0x10, 2018c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_CONFIG, 2028c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_BUSMASTER_EN, 2038c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_PASID_INVAL, 2048c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_WQ_SIZE_ERANGE, 2058c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_GRP_CONFIG, 2068c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_GRP_CONFIG2, 2078c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_GRP_CONFIG3, 2088c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_GRP_CONFIG4, 2098c2ecf20Sopenharmony_ci /* enable wq errors */ 2108c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_DEV_NOTEN = 0x20, 2118c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_WQ_ENABLED, 2128c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_WQ_SIZE, 2138c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_WQ_PRIOR, 2148c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_WQ_MODE, 2158c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_BOF_EN, 2168c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_PASID_EN, 2178c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_MAX_BATCH_SIZE, 2188c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_MAX_XFER_SIZE, 2198c2ecf20Sopenharmony_ci /* disable device errors */ 2208c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_DIS_DEV_EN = 0x31, 2218c2ecf20Sopenharmony_ci /* disable WQ, drain WQ, abort WQ, reset WQ */ 2228c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_DEV_NOT_EN, 2238c2ecf20Sopenharmony_ci /* request interrupt handle */ 2248c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_INVAL_INT_IDX = 0x41, 2258c2ecf20Sopenharmony_ci IDXD_CMDSTS_ERR_NO_HANDLE, 2268c2ecf20Sopenharmony_ci}; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci#define IDXD_SWERR_OFFSET 0xc0 2298c2ecf20Sopenharmony_ci#define IDXD_SWERR_VALID 0x00000001 2308c2ecf20Sopenharmony_ci#define IDXD_SWERR_OVERFLOW 0x00000002 2318c2ecf20Sopenharmony_ci#define IDXD_SWERR_ACK (IDXD_SWERR_VALID | IDXD_SWERR_OVERFLOW) 2328c2ecf20Sopenharmony_ciunion sw_err_reg { 2338c2ecf20Sopenharmony_ci struct { 2348c2ecf20Sopenharmony_ci u64 valid:1; 2358c2ecf20Sopenharmony_ci u64 overflow:1; 2368c2ecf20Sopenharmony_ci u64 desc_valid:1; 2378c2ecf20Sopenharmony_ci u64 wq_idx_valid:1; 2388c2ecf20Sopenharmony_ci u64 batch:1; 2398c2ecf20Sopenharmony_ci u64 fault_rw:1; 2408c2ecf20Sopenharmony_ci u64 priv:1; 2418c2ecf20Sopenharmony_ci u64 rsvd:1; 2428c2ecf20Sopenharmony_ci u64 error:8; 2438c2ecf20Sopenharmony_ci u64 wq_idx:8; 2448c2ecf20Sopenharmony_ci u64 rsvd2:8; 2458c2ecf20Sopenharmony_ci u64 operation:8; 2468c2ecf20Sopenharmony_ci u64 pasid:20; 2478c2ecf20Sopenharmony_ci u64 rsvd3:4; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci u64 batch_idx:16; 2508c2ecf20Sopenharmony_ci u64 rsvd4:16; 2518c2ecf20Sopenharmony_ci u64 invalid_flags:32; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci u64 fault_addr; 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci u64 rsvd5; 2568c2ecf20Sopenharmony_ci }; 2578c2ecf20Sopenharmony_ci u64 bits[4]; 2588c2ecf20Sopenharmony_ci} __packed; 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ciunion msix_perm { 2618c2ecf20Sopenharmony_ci struct { 2628c2ecf20Sopenharmony_ci u32 rsvd:2; 2638c2ecf20Sopenharmony_ci u32 ignore:1; 2648c2ecf20Sopenharmony_ci u32 pasid_en:1; 2658c2ecf20Sopenharmony_ci u32 rsvd2:8; 2668c2ecf20Sopenharmony_ci u32 pasid:20; 2678c2ecf20Sopenharmony_ci }; 2688c2ecf20Sopenharmony_ci u32 bits; 2698c2ecf20Sopenharmony_ci} __packed; 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ciunion group_flags { 2728c2ecf20Sopenharmony_ci struct { 2738c2ecf20Sopenharmony_ci u32 tc_a:3; 2748c2ecf20Sopenharmony_ci u32 tc_b:3; 2758c2ecf20Sopenharmony_ci u32 rsvd:1; 2768c2ecf20Sopenharmony_ci u32 use_token_limit:1; 2778c2ecf20Sopenharmony_ci u32 tokens_reserved:8; 2788c2ecf20Sopenharmony_ci u32 rsvd2:4; 2798c2ecf20Sopenharmony_ci u32 tokens_allowed:8; 2808c2ecf20Sopenharmony_ci u32 rsvd3:4; 2818c2ecf20Sopenharmony_ci }; 2828c2ecf20Sopenharmony_ci u32 bits; 2838c2ecf20Sopenharmony_ci} __packed; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_cistruct grpcfg { 2868c2ecf20Sopenharmony_ci u64 wqs[4]; 2878c2ecf20Sopenharmony_ci u64 engines; 2888c2ecf20Sopenharmony_ci union group_flags flags; 2898c2ecf20Sopenharmony_ci} __packed; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ciunion wqcfg { 2928c2ecf20Sopenharmony_ci struct { 2938c2ecf20Sopenharmony_ci /* bytes 0-3 */ 2948c2ecf20Sopenharmony_ci u16 wq_size; 2958c2ecf20Sopenharmony_ci u16 rsvd; 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci /* bytes 4-7 */ 2988c2ecf20Sopenharmony_ci u16 wq_thresh; 2998c2ecf20Sopenharmony_ci u16 rsvd1; 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci /* bytes 8-11 */ 3028c2ecf20Sopenharmony_ci u32 mode:1; /* shared or dedicated */ 3038c2ecf20Sopenharmony_ci u32 bof:1; /* block on fault */ 3048c2ecf20Sopenharmony_ci u32 rsvd2:2; 3058c2ecf20Sopenharmony_ci u32 priority:4; 3068c2ecf20Sopenharmony_ci u32 pasid:20; 3078c2ecf20Sopenharmony_ci u32 pasid_en:1; 3088c2ecf20Sopenharmony_ci u32 priv:1; 3098c2ecf20Sopenharmony_ci u32 rsvd3:2; 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci /* bytes 12-15 */ 3128c2ecf20Sopenharmony_ci u32 max_xfer_shift:5; 3138c2ecf20Sopenharmony_ci u32 max_batch_shift:4; 3148c2ecf20Sopenharmony_ci u32 rsvd4:23; 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci /* bytes 16-19 */ 3178c2ecf20Sopenharmony_ci u16 occupancy_inth; 3188c2ecf20Sopenharmony_ci u16 occupancy_table_sel:1; 3198c2ecf20Sopenharmony_ci u16 rsvd5:15; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci /* bytes 20-23 */ 3228c2ecf20Sopenharmony_ci u16 occupancy_limit; 3238c2ecf20Sopenharmony_ci u16 occupancy_int_en:1; 3248c2ecf20Sopenharmony_ci u16 rsvd6:15; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci /* bytes 24-27 */ 3278c2ecf20Sopenharmony_ci u16 occupancy; 3288c2ecf20Sopenharmony_ci u16 occupancy_int:1; 3298c2ecf20Sopenharmony_ci u16 rsvd7:12; 3308c2ecf20Sopenharmony_ci u16 mode_support:1; 3318c2ecf20Sopenharmony_ci u16 wq_state:2; 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci /* bytes 28-31 */ 3348c2ecf20Sopenharmony_ci u32 rsvd8; 3358c2ecf20Sopenharmony_ci }; 3368c2ecf20Sopenharmony_ci u32 bits[8]; 3378c2ecf20Sopenharmony_ci} __packed; 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ci/* 3408c2ecf20Sopenharmony_ci * This macro calculates the offset into the WQCFG register 3418c2ecf20Sopenharmony_ci * idxd - struct idxd * 3428c2ecf20Sopenharmony_ci * n - wq id 3438c2ecf20Sopenharmony_ci * ofs - the index of the 32b dword for the config register 3448c2ecf20Sopenharmony_ci * 3458c2ecf20Sopenharmony_ci * The WQCFG register block is divided into groups per each wq. The n index 3468c2ecf20Sopenharmony_ci * allows us to move to the register group that's for that particular wq. 3478c2ecf20Sopenharmony_ci * Each register is 32bits. The ofs gives us the number of register to access. 3488c2ecf20Sopenharmony_ci */ 3498c2ecf20Sopenharmony_ci#define WQCFG_OFFSET(_idxd_dev, n, ofs) \ 3508c2ecf20Sopenharmony_ci({\ 3518c2ecf20Sopenharmony_ci typeof(_idxd_dev) __idxd_dev = (_idxd_dev); \ 3528c2ecf20Sopenharmony_ci (__idxd_dev)->wqcfg_offset + (n) * (__idxd_dev)->wqcfg_size + sizeof(u32) * (ofs); \ 3538c2ecf20Sopenharmony_ci}) 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci#define WQCFG_STRIDES(_idxd_dev) ((_idxd_dev)->wqcfg_size / sizeof(u32)) 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci#endif 358