From 1526e807114dafe9377e978ba899b0432793f7a1 Mon Sep 17 00:00:00 2001 From: chenxiang Date: Thu, 23 Aug 2018 09:09:34 +0800 Subject: [PATCH] scsi: hisi_sas: send HARD RESET to clear the previous affiliation of STP target port when init device If exchange SAS expander from one SAS controller to other SAS controller without power down, the STP target port will maintain previous affiliation and reject all subsequent connection requests from other STP initiator ports with OPEN_REJECT (STP RESOURCES BUSY). To solve this issue, send HARD RESET to clear the previous affiliation of STP target port according to SPL(chapter 6.19.4). Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 9d6f39641260..de624c7f83d6 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -612,6 +612,7 @@ static int hisi_sas_init_device(struct domain_device *device) struct hisi_sas_tmf_task tmf_task; int retry = HISI_SAS_SRST_ATA_DISK_CNT; struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); + struct sas_phy *local_phy; switch (device->dev_type) { case SAS_END_DEVICE: @@ -627,6 +628,14 @@ static int hisi_sas_init_device(struct domain_device *device) case SAS_SATA_PM: case SAS_SATA_PM_PORT: case SAS_SATA_PENDING: + /* + * send HARD RESET to clear previous affiliation of + * STP target port + */ + local_phy = sas_get_local_phy(device); + if (!scsi_is_sas_phy_local(local_phy)) + sas_phy_reset(local_phy, 1); + sas_put_local_phy(local_phy); while (retry-- > 0) { rc = hisi_sas_softreset_ata_disk(device); if (!rc) -- GitLab