Skip to content

Commit ee05cb7

Browse files
Ajish Koshymartinkpetersen
authored andcommitted
scsi: pm80xx: Port reset timeout error handling correction
Error handling steps were not in sequence as per the programmers manual. Expected sequence: - PHY_DOWN (PORT_IN_RESET) - PORT_RESET_TIMER_TMO - Host aborts pending I/Os - Host deregister the device - Host sends HW_EVENT_PHY_DOWN ACK Previously we were sending HW_EVENT_PHY_DOWN ACK first and then deregister the device. Fix this to use the expected sequence. Link: https://lore.kernel.org/r/20211228111753.10802-1-Ajish.Koshy@microchip.com Signed-off-by: Ajish Koshy <Ajish.Koshy@microchip.com> Signed-off-by: Viswas G <Viswas.G@microchip.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 3bb3c24 commit ee05cb7

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

drivers/scsi/pm8001/pm8001_sas.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ int pm8001_abort_task(struct sas_task *task)
11991199
struct pm8001_device *pm8001_dev;
12001200
struct pm8001_tmf_task tmf_task;
12011201
int rc = TMF_RESP_FUNC_FAILED, ret;
1202-
u32 phy_id;
1202+
u32 phy_id, port_id;
12031203
struct sas_task_slow slow_task;
12041204

12051205
if (unlikely(!task || !task->lldd_task || !task->dev))
@@ -1246,6 +1246,7 @@ int pm8001_abort_task(struct sas_task *task)
12461246
DECLARE_COMPLETION_ONSTACK(completion_reset);
12471247
DECLARE_COMPLETION_ONSTACK(completion);
12481248
struct pm8001_phy *phy = pm8001_ha->phy + phy_id;
1249+
port_id = phy->port->port_id;
12491250

12501251
/* 1. Set Device state as Recovery */
12511252
pm8001_dev->setds_completion = &completion;
@@ -1297,6 +1298,10 @@ int pm8001_abort_task(struct sas_task *task)
12971298
PORT_RESET_TMO);
12981299
if (phy->port_reset_status == PORT_RESET_TMO) {
12991300
pm8001_dev_gone_notify(dev);
1301+
PM8001_CHIP_DISP->hw_event_ack_req(
1302+
pm8001_ha, 0,
1303+
0x07, /*HW_EVENT_PHY_DOWN ack*/
1304+
port_id, phy_id, 0, 0);
13001305
goto out;
13011306
}
13021307
}

drivers/scsi/pm8001/pm8001_sas.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ struct pm8001_dispatch {
216216
u32 state);
217217
int (*sas_re_init_req)(struct pm8001_hba_info *pm8001_ha);
218218
int (*fatal_errors)(struct pm8001_hba_info *pm8001_ha);
219+
void (*hw_event_ack_req)(struct pm8001_hba_info *pm8001_ha,
220+
u32 Qnum, u32 SEA, u32 port_id, u32 phyId, u32 param0,
221+
u32 param1);
219222
};
220223

221224
struct pm8001_chip_info {

drivers/scsi/pm8001/pm80xx_hwi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,8 +3709,10 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
37093709
break;
37103710
case HW_EVENT_PORT_RESET_TIMER_TMO:
37113711
pm8001_dbg(pm8001_ha, MSG, "HW_EVENT_PORT_RESET_TIMER_TMO\n");
3712-
pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
3713-
port_id, phy_id, 0, 0);
3712+
if (!pm8001_ha->phy[phy_id].reset_completion) {
3713+
pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
3714+
port_id, phy_id, 0, 0);
3715+
}
37143716
sas_phy_disconnected(sas_phy);
37153717
phy->phy_attached = 0;
37163718
sas_notify_port_event(sas_phy, PORTE_LINK_RESET_ERR,
@@ -5051,4 +5053,5 @@ const struct pm8001_dispatch pm8001_80xx_dispatch = {
50515053
.fw_flash_update_req = pm8001_chip_fw_flash_update_req,
50525054
.set_dev_state_req = pm8001_chip_set_dev_state_req,
50535055
.fatal_errors = pm80xx_fatal_errors,
5056+
.hw_event_ack_req = pm80xx_hw_event_ack_req,
50545057
};

0 commit comments

Comments
 (0)