Commit b7d26c1d authored by Akshat Jain's avatar Akshat Jain Committed by Martin K. Petersen

scsi: pm80xx: Log some HW events by default

Log the following hw_event logs under EVENT log severity to help debug disk
issues:

  HW_EVENT_LINK_ERR_INVALID_DWORD
  HW_EVENT_LINK_ERR_DISPARITY_ERROR
  HW_EVENT_LINK_ERR_CODE_VIOLATION
  HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH
  HW_EVENT_LINK_ERR_PHY_RESET_FAILED
  HW_EVENT_INBOUND_CRC_ERROR
  HW_EVENT_PHY_ERROR
  HW_EVENT_SAS_PHY_UP
  HW_EVENT_SATA_PHY_UP
  HW_EVENT_SATA_SPINUP_HOLD
  HW_EVENT_PHY_DOWN
  HW_EVENT_PORT_INVALID
  HW_EVENT_MALFUNCTION
  HW_EVENT_PORT_RESET_TIMER_TMO
  HW_EVENT_PORT_RECOVERY_TIMER_TMO
  HW_EVENT_HARD_RESET_RECEIVED
  HW_EVENT_ID_FRAME_TIMEOUT
  HW_EVENT_PORT_RECOVER
Signed-off-by: default avatarAkshat Jain <akshatzen@google.com>
Signed-off-by: default avatarPranav Prasad <pranavpp@google.com>
Link: https://lore.kernel.org/r/20230418190101.696345-2-pranavpp@google.comAcked-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ac9a7868
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
#include "pm8001_chips.h" #include "pm8001_chips.h"
#include "pm80xx_hwi.h" #include "pm80xx_hwi.h"
static ulong logging_level = PM8001_FAIL_LOGGING | PM8001_IOERR_LOGGING; static ulong logging_level = PM8001_FAIL_LOGGING | PM8001_IOERR_LOGGING |
PM8001_EVENT_LOGGING;
module_param(logging_level, ulong, 0644); module_param(logging_level, ulong, 0644);
MODULE_PARM_DESC(logging_level, " bits for enabling logging info."); MODULE_PARM_DESC(logging_level, " bits for enabling logging info.");
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#define PM8001_DEV_LOGGING 0x80 /* development message logging */ #define PM8001_DEV_LOGGING 0x80 /* development message logging */
#define PM8001_DEVIO_LOGGING 0x100 /* development io message logging */ #define PM8001_DEVIO_LOGGING 0x100 /* development io message logging */
#define PM8001_IOERR_LOGGING 0x200 /* development io err message logging */ #define PM8001_IOERR_LOGGING 0x200 /* development io err message logging */
#define PM8001_EVENT_LOGGING 0x400 /* HW event logging */
#define pm8001_info(HBA, fmt, ...) \ #define pm8001_info(HBA, fmt, ...) \
pr_info("%s:: %s %d: " fmt, \ pr_info("%s:: %s %d: " fmt, \
......
...@@ -3425,26 +3425,31 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3425,26 +3425,31 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
switch (eventType) { switch (eventType) {
case HW_EVENT_SAS_PHY_UP: case HW_EVENT_SAS_PHY_UP:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_START_STATUS\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_SAS_PHY_UP phyid:%#x\n", phy_id);
hw_event_sas_phy_up(pm8001_ha, piomb); hw_event_sas_phy_up(pm8001_ha, piomb);
break; break;
case HW_EVENT_SATA_PHY_UP: case HW_EVENT_SATA_PHY_UP:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_PHY_UP\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_SATA_PHY_UP phyid:%#x\n", phy_id);
hw_event_sata_phy_up(pm8001_ha, piomb); hw_event_sata_phy_up(pm8001_ha, piomb);
break; break;
case HW_EVENT_SATA_SPINUP_HOLD: case HW_EVENT_SATA_SPINUP_HOLD:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_SATA_SPINUP_HOLD\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_SATA_SPINUP_HOLD phyid:%#x\n", phy_id);
sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD, sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD,
GFP_ATOMIC); GFP_ATOMIC);
break; break;
case HW_EVENT_PHY_DOWN: case HW_EVENT_PHY_DOWN:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_DOWN\n"); pm8001_dbg(pm8001_ha, EVENT, "HW_EVENT_PHY_DOWN phyid:%#x\n",
phy_id);
hw_event_phy_down(pm8001_ha, piomb); hw_event_phy_down(pm8001_ha, piomb);
phy->phy_attached = 0; phy->phy_attached = 0;
phy->phy_state = PHY_LINK_DISABLE; phy->phy_state = PHY_LINK_DISABLE;
break; break;
case HW_EVENT_PORT_INVALID: case HW_EVENT_PORT_INVALID:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_INVALID\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_PORT_INVALID phyid:%#x\n", phy_id);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR, sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
...@@ -3463,7 +3468,8 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3463,7 +3468,8 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
GFP_ATOMIC); GFP_ATOMIC);
break; break;
case HW_EVENT_PHY_ERROR: case HW_EVENT_PHY_ERROR:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PHY_ERROR\n"); pm8001_dbg(pm8001_ha, EVENT, "HW_EVENT_PHY_ERROR phyid:%#x\n",
phy_id);
sas_phy_disconnected(&phy->sas_phy); sas_phy_disconnected(&phy->sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC); sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC);
...@@ -3477,34 +3483,39 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3477,34 +3483,39 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
GFP_ATOMIC); GFP_ATOMIC);
break; break;
case HW_EVENT_LINK_ERR_INVALID_DWORD: case HW_EVENT_LINK_ERR_INVALID_DWORD:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_LINK_ERR_INVALID_DWORD\n"); "HW_EVENT_LINK_ERR_INVALID_DWORD phyid:%#x\n",
phy_id);
pm80xx_hw_event_ack_req(pm8001_ha, 0, pm80xx_hw_event_ack_req(pm8001_ha, 0,
HW_EVENT_LINK_ERR_INVALID_DWORD, port_id, phy_id, 0, 0); HW_EVENT_LINK_ERR_INVALID_DWORD, port_id, phy_id, 0, 0);
break; break;
case HW_EVENT_LINK_ERR_DISPARITY_ERROR: case HW_EVENT_LINK_ERR_DISPARITY_ERROR:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_LINK_ERR_DISPARITY_ERROR\n"); "HW_EVENT_LINK_ERR_DISPARITY_ERROR phyid:%#x\n",
phy_id);
pm80xx_hw_event_ack_req(pm8001_ha, 0, pm80xx_hw_event_ack_req(pm8001_ha, 0,
HW_EVENT_LINK_ERR_DISPARITY_ERROR, HW_EVENT_LINK_ERR_DISPARITY_ERROR,
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
break; break;
case HW_EVENT_LINK_ERR_CODE_VIOLATION: case HW_EVENT_LINK_ERR_CODE_VIOLATION:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_LINK_ERR_CODE_VIOLATION\n"); "HW_EVENT_LINK_ERR_CODE_VIOLATION phyid:%#x\n",
phy_id);
pm80xx_hw_event_ack_req(pm8001_ha, 0, pm80xx_hw_event_ack_req(pm8001_ha, 0,
HW_EVENT_LINK_ERR_CODE_VIOLATION, HW_EVENT_LINK_ERR_CODE_VIOLATION,
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
break; break;
case HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH: case HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH\n"); "HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH phyid:%#x\n",
phy_id);
pm80xx_hw_event_ack_req(pm8001_ha, 0, pm80xx_hw_event_ack_req(pm8001_ha, 0,
HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH, HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH,
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
break; break;
case HW_EVENT_MALFUNCTION: case HW_EVENT_MALFUNCTION:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_MALFUNCTION\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_MALFUNCTION phyid:%#x\n", phy_id);
break; break;
case HW_EVENT_BROADCAST_SES: case HW_EVENT_BROADCAST_SES:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_SES\n"); pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_BROADCAST_SES\n");
...@@ -3515,25 +3526,29 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3515,25 +3526,29 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
GFP_ATOMIC); GFP_ATOMIC);
break; break;
case HW_EVENT_INBOUND_CRC_ERROR: case HW_EVENT_INBOUND_CRC_ERROR:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_INBOUND_CRC_ERROR\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_INBOUND_CRC_ERROR phyid:%#x\n", phy_id);
pm80xx_hw_event_ack_req(pm8001_ha, 0, pm80xx_hw_event_ack_req(pm8001_ha, 0,
HW_EVENT_INBOUND_CRC_ERROR, HW_EVENT_INBOUND_CRC_ERROR,
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
break; break;
case HW_EVENT_HARD_RESET_RECEIVED: case HW_EVENT_HARD_RESET_RECEIVED:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_HARD_RESET_RECEIVED\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_HARD_RESET_RECEIVED phyid:%#x\n", phy_id);
sas_notify_port_event(sas_phy, PORTE_HARD_RESET, GFP_ATOMIC); sas_notify_port_event(sas_phy, PORTE_HARD_RESET, GFP_ATOMIC);
break; break;
case HW_EVENT_ID_FRAME_TIMEOUT: case HW_EVENT_ID_FRAME_TIMEOUT:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_ID_FRAME_TIMEOUT\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_ID_FRAME_TIMEOUT phyid:%#x\n", phy_id);
sas_phy_disconnected(sas_phy); sas_phy_disconnected(sas_phy);
phy->phy_attached = 0; phy->phy_attached = 0;
sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR, sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
GFP_ATOMIC); GFP_ATOMIC);
break; break;
case HW_EVENT_LINK_ERR_PHY_RESET_FAILED: case HW_EVENT_LINK_ERR_PHY_RESET_FAILED:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_LINK_ERR_PHY_RESET_FAILED\n"); "HW_EVENT_LINK_ERR_PHY_RESET_FAILED phyid:%#x\n",
phy_id);
pm80xx_hw_event_ack_req(pm8001_ha, 0, pm80xx_hw_event_ack_req(pm8001_ha, 0,
HW_EVENT_LINK_ERR_PHY_RESET_FAILED, HW_EVENT_LINK_ERR_PHY_RESET_FAILED,
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
...@@ -3543,7 +3558,9 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3543,7 +3558,9 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
GFP_ATOMIC); GFP_ATOMIC);
break; break;
case HW_EVENT_PORT_RESET_TIMER_TMO: case HW_EVENT_PORT_RESET_TIMER_TMO:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_TIMER_TMO\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_PORT_RESET_TIMER_TMO phyid:%#x\n",
phy_id);
if (!pm8001_ha->phy[phy_id].reset_completion) { if (!pm8001_ha->phy[phy_id].reset_completion) {
pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN, pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
...@@ -3560,8 +3577,9 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3560,8 +3577,9 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
} }
break; break;
case HW_EVENT_PORT_RECOVERY_TIMER_TMO: case HW_EVENT_PORT_RECOVERY_TIMER_TMO:
pm8001_dbg(pm8001_ha, MSG, pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_PORT_RECOVERY_TIMER_TMO\n"); "HW_EVENT_PORT_RECOVERY_TIMER_TMO phyid:%#x\n",
phy_id);
pm80xx_hw_event_ack_req(pm8001_ha, 0, pm80xx_hw_event_ack_req(pm8001_ha, 0,
HW_EVENT_PORT_RECOVERY_TIMER_TMO, HW_EVENT_PORT_RECOVERY_TIMER_TMO,
port_id, phy_id, 0, 0); port_id, phy_id, 0, 0);
...@@ -3575,11 +3593,15 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) ...@@ -3575,11 +3593,15 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
} }
break; break;
case HW_EVENT_PORT_RECOVER: case HW_EVENT_PORT_RECOVER:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RECOVER\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_PORT_RECOVER phyid:%#x port_id:%#x\n",
phy_id, port_id);
hw_event_port_recover(pm8001_ha, piomb); hw_event_port_recover(pm8001_ha, piomb);
break; break;
case HW_EVENT_PORT_RESET_COMPLETE: case HW_EVENT_PORT_RESET_COMPLETE:
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_COMPLETE\n"); pm8001_dbg(pm8001_ha, EVENT,
"HW_EVENT_PORT_RESET_COMPLETE phyid:%#x port_id:%#x\n",
phy_id, port_id);
if (pm8001_ha->phy[phy_id].reset_completion) { if (pm8001_ha->phy[phy_id].reset_completion) {
pm8001_ha->phy[phy_id].port_reset_status = pm8001_ha->phy[phy_id].port_reset_status =
PORT_RESET_SUCCESS; PORT_RESET_SUCCESS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment