hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/infiniband/hw/hfi1/chip.h
....@@ -1,7 +1,7 @@
11 #ifndef _CHIP_H
22 #define _CHIP_H
33 /*
4
- * Copyright(c) 2015 - 2017 Intel Corporation.
4
+ * Copyright(c) 2015 - 2020 Intel Corporation.
55 *
66 * This file is provided under a dual BSD/GPLv2 license. When using or
77 * redistributing this file, you may do so under either license.
....@@ -52,9 +52,7 @@
5252 */
5353
5454 /* sizes */
55
-#define CCE_NUM_MSIX_VECTORS 256
56
-#define CCE_NUM_INT_CSRS 12
57
-#define CCE_NUM_INT_MAP_CSRS 96
55
+#define BITS_PER_REGISTER (BITS_PER_BYTE * sizeof(u64))
5856 #define NUM_INTERRUPT_SOURCES 768
5957 #define RXE_NUM_CONTEXTS 160
6058 #define RXE_PER_CONTEXT_SIZE 0x1000 /* 4k */
....@@ -161,34 +159,49 @@
161159 (CR_CREDIT_RETURN_DUE_TO_FORCE_MASK << \
162160 CR_CREDIT_RETURN_DUE_TO_FORCE_SHIFT)
163161
164
-/* interrupt source numbers */
165
-#define IS_GENERAL_ERR_START 0
166
-#define IS_SDMAENG_ERR_START 16
167
-#define IS_SENDCTXT_ERR_START 32
168
-#define IS_SDMA_START 192 /* includes SDmaProgress,SDmaIdle */
162
+/* Specific IRQ sources */
163
+#define CCE_ERR_INT 0
164
+#define RXE_ERR_INT 1
165
+#define MISC_ERR_INT 2
166
+#define PIO_ERR_INT 4
167
+#define SDMA_ERR_INT 5
168
+#define EGRESS_ERR_INT 6
169
+#define TXE_ERR_INT 7
170
+#define PBC_INT 240
171
+#define GPIO_ASSERT_INT 241
172
+#define QSFP1_INT 242
173
+#define QSFP2_INT 243
174
+#define TCRIT_INT 244
175
+
176
+/* interrupt source ranges */
177
+#define IS_FIRST_SOURCE CCE_ERR_INT
178
+#define IS_GENERAL_ERR_START 0
179
+#define IS_SDMAENG_ERR_START 16
180
+#define IS_SENDCTXT_ERR_START 32
181
+#define IS_SDMA_START 192
182
+#define IS_SDMA_PROGRESS_START 208
183
+#define IS_SDMA_IDLE_START 224
169184 #define IS_VARIOUS_START 240
170185 #define IS_DC_START 248
171186 #define IS_RCVAVAIL_START 256
172187 #define IS_RCVURGENT_START 416
173188 #define IS_SENDCREDIT_START 576
174189 #define IS_RESERVED_START 736
175
-#define IS_MAX_SOURCES 768
190
+#define IS_LAST_SOURCE 767
176191
177192 /* derived interrupt source values */
178
-#define IS_GENERAL_ERR_END IS_SDMAENG_ERR_START
179
-#define IS_SDMAENG_ERR_END IS_SENDCTXT_ERR_START
180
-#define IS_SENDCTXT_ERR_END IS_SDMA_START
181
-#define IS_SDMA_END IS_VARIOUS_START
182
-#define IS_VARIOUS_END IS_DC_START
183
-#define IS_DC_END IS_RCVAVAIL_START
184
-#define IS_RCVAVAIL_END IS_RCVURGENT_START
185
-#define IS_RCVURGENT_END IS_SENDCREDIT_START
186
-#define IS_SENDCREDIT_END IS_RESERVED_START
187
-#define IS_RESERVED_END IS_MAX_SOURCES
188
-
189
-/* absolute interrupt numbers for QSFP1Int and QSFP2Int */
190
-#define QSFP1_INT 242
191
-#define QSFP2_INT 243
193
+#define IS_GENERAL_ERR_END 7
194
+#define IS_SDMAENG_ERR_END 31
195
+#define IS_SENDCTXT_ERR_END 191
196
+#define IS_SDMA_END 207
197
+#define IS_SDMA_PROGRESS_END 223
198
+#define IS_SDMA_IDLE_END 239
199
+#define IS_VARIOUS_END 244
200
+#define IS_DC_END 255
201
+#define IS_RCVAVAIL_END 415
202
+#define IS_RCVURGENT_END 575
203
+#define IS_SENDCREDIT_END 735
204
+#define IS_RESERVED_END IS_LAST_SOURCE
192205
193206 /* DCC_CFG_PORT_CONFIG logical link states */
194207 #define LSTATE_DOWN 0x1
....@@ -345,6 +358,8 @@
345358 #define MAX_EAGER_BUFFER (256 * 1024)
346359 #define MAX_EAGER_BUFFER_TOTAL (64 * (1 << 20)) /* max per ctxt 64MB */
347360 #define MAX_EXPECTED_BUFFER (2048 * 1024)
361
+#define HFI1_MIN_HDRQ_EGRBUF_CNT 32
362
+#define HFI1_MAX_HDRQ_EGRBUF_CNT 16352
348363
349364 /*
350365 * Receive expected base and count and eager base and count increment -
....@@ -686,6 +701,10 @@
686701 return read_csr(dd, RCV_ARRAY_CNT);
687702 }
688703
704
+u8 encode_rcv_header_entry_size(u8 size);
705
+int hfi1_validate_rcvhdrcnt(struct hfi1_devdata *dd, uint thecnt);
706
+void set_hdrq_regs(struct hfi1_devdata *dd, u8 ctxt, u8 entsize, u16 hdrcnt);
707
+
689708 u64 create_pbc(struct hfi1_pportdata *ppd, u64 flags, int srate_mbs, u32 vl,
690709 u32 dw_len);
691710
....@@ -791,6 +810,7 @@
791810 u32 hdrqempty(struct hfi1_ctxtdata *rcd);
792811 int is_ax(struct hfi1_devdata *dd);
793812 int is_bx(struct hfi1_devdata *dd);
813
+bool is_urg_masked(struct hfi1_ctxtdata *rcd);
794814 u32 read_physical_state(struct hfi1_devdata *dd);
795815 u32 chip_to_opa_pstate(struct hfi1_devdata *dd, u32 chip_pstate);
796816 const char *opa_lstate_name(u32 lstate);
....@@ -844,6 +864,10 @@
844864 /* Per device counter indexes */
845865 enum {
846866 C_RCV_OVF = 0,
867
+ C_RX_LEN_ERR,
868
+ C_RX_SHORT_ERR,
869
+ C_RX_ICRC_ERR,
870
+ C_RX_EBP,
847871 C_RX_TID_FULL,
848872 C_RX_TID_INVALID,
849873 C_RX_TID_FLGMS,
....@@ -914,6 +938,7 @@
914938 C_SW_PIO_WAIT,
915939 C_SW_PIO_DRAIN,
916940 C_SW_KMEM_WAIT,
941
+ C_SW_TID_WAIT,
917942 C_SW_SEND_SCHED,
918943 C_SDMA_DESC_FETCHED_CNT,
919944 C_SDMA_INT_CNT,
....@@ -1228,6 +1253,7 @@
12281253 C_SW_IBP_RDMA_SEQ,
12291254 C_SW_IBP_UNALIGNED,
12301255 C_SW_IBP_SEQ_NAK,
1256
+ C_SW_IBP_RC_CRWAITS,
12311257 C_SW_CPU_RC_ACKS,
12321258 C_SW_CPU_RC_QACKS,
12331259 C_SW_CPU_RC_DELAYED_COMP,
....@@ -1417,6 +1443,22 @@
14171443 void hfi1_init_vnic_rsm(struct hfi1_devdata *dd);
14181444 void hfi1_deinit_vnic_rsm(struct hfi1_devdata *dd);
14191445
1446
+irqreturn_t general_interrupt(int irq, void *data);
1447
+irqreturn_t sdma_interrupt(int irq, void *data);
1448
+irqreturn_t receive_context_interrupt(int irq, void *data);
1449
+irqreturn_t receive_context_thread(int irq, void *data);
1450
+irqreturn_t receive_context_interrupt_napi(int irq, void *data);
1451
+
1452
+int set_intr_bits(struct hfi1_devdata *dd, u16 first, u16 last, bool set);
1453
+void init_qsfp_int(struct hfi1_devdata *dd);
1454
+void clear_all_interrupts(struct hfi1_devdata *dd);
1455
+void remap_intr(struct hfi1_devdata *dd, int isrc, int msix_intr);
1456
+void remap_sdma_interrupts(struct hfi1_devdata *dd, int engine, int msix_intr);
1457
+void reset_interrupts(struct hfi1_devdata *dd);
1458
+u8 hfi1_get_qp_map(struct hfi1_devdata *dd, u8 idx);
1459
+void hfi1_init_aip_rsm(struct hfi1_devdata *dd);
1460
+void hfi1_deinit_aip_rsm(struct hfi1_devdata *dd);
1461
+
14201462 /*
14211463 * Interrupt source table.
14221464 *