Skip to content

Commit d86cc04

Browse files
chelsiocudbgdavem330
authored andcommitted
cxgb4: handle interrupt raised when FW crashes
Handle TIMER0INT when FW crashes. Check for PCIE_FW[FW_EVAL] and if it says "Device FW Crashed", then treat it as fatal. Else, non-fatal. Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9438d27 commit d86cc04

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4040,6 +4040,7 @@ static void cim_intr_handler(struct adapter *adapter)
40404040
{ MBHOSTPARERR_F, "CIM mailbox host parity error", -1, 1 },
40414041
{ TIEQINPARERRINT_F, "CIM TIEQ outgoing parity error", -1, 1 },
40424042
{ TIEQOUTPARERRINT_F, "CIM TIEQ incoming parity error", -1, 1 },
4043+
{ TIMER0INT_F, "CIM TIMER0 interrupt", -1, 1 },
40434044
{ 0 }
40444045
};
40454046
static const struct intr_info cim_upintr_info[] = {
@@ -4074,11 +4075,27 @@ static void cim_intr_handler(struct adapter *adapter)
40744075
{ 0 }
40754076
};
40764077

4078+
u32 val, fw_err;
40774079
int fat;
40784080

4079-
if (t4_read_reg(adapter, PCIE_FW_A) & PCIE_FW_ERR_F)
4081+
fw_err = t4_read_reg(adapter, PCIE_FW_A);
4082+
if (fw_err & PCIE_FW_ERR_F)
40804083
t4_report_fw_error(adapter);
40814084

4085+
/* When the Firmware detects an internal error which normally
4086+
* wouldn't raise a Host Interrupt, it forces a CIM Timer0 interrupt
4087+
* in order to make sure the Host sees the Firmware Crash. So
4088+
* if we have a Timer0 interrupt and don't see a Firmware Crash,
4089+
* ignore the Timer0 interrupt.
4090+
*/
4091+
4092+
val = t4_read_reg(adapter, CIM_HOST_INT_CAUSE_A);
4093+
if (val & TIMER0INT_F)
4094+
if (!(fw_err & PCIE_FW_ERR_F) ||
4095+
(PCIE_FW_EVAL_G(fw_err) != PCIE_FW_EVAL_CRASH))
4096+
t4_write_reg(adapter, CIM_HOST_INT_CAUSE_A,
4097+
TIMER0INT_F);
4098+
40824099
fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE_A,
40834100
cim_intr_info) +
40844101
t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE_A,

drivers/net/ethernet/chelsio/cxgb4/t4_regs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,10 @@
10771077
#define TIEQINPARERRINT_V(x) ((x) << TIEQINPARERRINT_S)
10781078
#define TIEQINPARERRINT_F TIEQINPARERRINT_V(1U)
10791079

1080+
#define TIMER0INT_S 2
1081+
#define TIMER0INT_V(x) ((x) << TIMER0INT_S)
1082+
#define TIMER0INT_F TIMER0INT_V(1U)
1083+
10801084
#define PREFDROPINT_S 1
10811085
#define PREFDROPINT_V(x) ((x) << PREFDROPINT_S)
10821086
#define PREFDROPINT_F PREFDROPINT_V(1U)

drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3088,6 +3088,10 @@ struct fw_debug_cmd {
30883088
#define FW_DEBUG_CMD_TYPE_G(x) \
30893089
(((x) >> FW_DEBUG_CMD_TYPE_S) & FW_DEBUG_CMD_TYPE_M)
30903090

3091+
enum pcie_fw_eval {
3092+
PCIE_FW_EVAL_CRASH = 0,
3093+
};
3094+
30913095
#define PCIE_FW_ERR_S 31
30923096
#define PCIE_FW_ERR_V(x) ((x) << PCIE_FW_ERR_S)
30933097
#define PCIE_FW_ERR_F PCIE_FW_ERR_V(1U)

0 commit comments

Comments
 (0)