diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index f3bb10da8f86ba747004716ffed3ed151288cb7f..a791401be7b37add95e58eb513763026ed5fd481 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -88,6 +88,7 @@ #define HISI_SAS_PROT_MASK (HISI_SAS_DIF_PROT_MASK | HISI_SAS_DIX_PROT_MASK) +#define HISI_SAS_WAIT_PHYUP_TIMEOUT (30 * HZ) #define CLEAR_ITCT_TIMEOUT 20 struct hisi_hba; diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 6ee5168a6bd817837400a34519d1e7b85496037a..93df1c6b94c759cb76a547aab58d484f4c6bc471 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1783,6 +1783,7 @@ static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device) int rc, reset_type = (sas_dev->dev_status == HISI_SAS_DEV_INIT || !dev_is_sata(device)) ? true : false; struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); + struct device *dev = hisi_hba->dev; struct sas_ha_struct *sas_ha = &hisi_hba->sha; DECLARE_COMPLETION_ONSTACK(phyreset); @@ -1809,7 +1810,8 @@ static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device) struct hisi_sas_phy *phy = container_of(sas_phy, struct hisi_sas_phy, sas_phy); /* Wait for I_T reset complete, time out after 2s */ - int ret = wait_for_completion_timeout(&phyreset, 2 * HZ); + int ret = wait_for_completion_timeout(&phyreset, + HISI_SAS_WAIT_PHYUP_TIMEOUT); unsigned long flags; spin_lock_irqsave(&phy->lock, flags); @@ -1818,8 +1820,10 @@ static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device) spin_unlock_irqrestore(&phy->lock, flags); /* report PHY down if timed out */ - if (!ret) + if (!ret) { + dev_warn(dev, "phy%d reset timeout\n", sas_phy->id); hisi_sas_phy_down(hisi_hba, sas_phy->id, 0); + } } else if (sas_dev->dev_status != HISI_SAS_DEV_INIT) /* Sleep 2s, wait for I_T reset at expander env except fail */ if (!rc) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 61ff065e5d9b8b13ca84b4814c2af78a0494107e..e6e4897780142e808c50eb6ec904b7f900d329fe 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -2874,7 +2874,6 @@ static const struct hisi_sas_hw_error port_ecc_axi_error[] = { }, }; -#define WAIT_PHYUP_TIMEOUT_V2_HW 20 static void wait_phyup_timedout_v2_hw(struct timer_list *t) { struct hisi_sas_phy *phy = from_timer(phy, t, timer); @@ -2894,7 +2893,7 @@ static void phy_oob_ready_v2_hw(struct hisi_hba *hisi_hba, int phy_no) if (!timer_pending(&phy->timer)) { dev_dbg(dev, "phy%d OOB ready\n", phy_no); phy->timer.function = wait_phyup_timedout_v2_hw; - phy->timer.expires = jiffies + WAIT_PHYUP_TIMEOUT_V2_HW * HZ; + phy->timer.expires = jiffies + HISI_SAS_WAIT_PHYUP_TIMEOUT; add_timer(&phy->timer); } } diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index a268a2ec686ccc5d7cb30df21558efb4f083765d..baae04adc8e47e05a974a04354941058180140ae 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1890,7 +1890,6 @@ static void handle_chl_int2_v3_hw(struct hisi_hba *hisi_hba, int phy_no) hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT2, irq_value); } -#define WAIT_PHYUP_TIMEOUT_V3_HW 20 static void wait_phyup_timedout_v3_hw(struct timer_list *t) { struct hisi_sas_phy *phy = from_timer(phy, t, timer); @@ -1917,7 +1916,7 @@ static void handle_chl_int0_v3_hw(struct hisi_hba *hisi_hba, int phy_no) if (!timer_pending(&phy->timer)) { phy->timer.function = wait_phyup_timedout_v3_hw; phy->timer.expires = jiffies + - WAIT_PHYUP_TIMEOUT_V3_HW * HZ; + HISI_SAS_WAIT_PHYUP_TIMEOUT; add_timer(&phy->timer); } }