Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1336384imm; Thu, 23 Aug 2018 01:02:59 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwdvNOG7DVYPMI6rRQEHgJLX1sj1406+VCB3hF/QMLPa4NBDrYtzKiRrNrNjMyO5l7t46kC X-Received: by 2002:a62:c90a:: with SMTP id k10-v6mr60626757pfg.180.1535011379102; Thu, 23 Aug 2018 01:02:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535011379; cv=none; d=google.com; s=arc-20160816; b=HgydI97EXxzhpfN5rXCpAvV/0vBqmHZ/L4KR0AiIKExNqa+w3r7EJLyhKL6cXYiukS hvtBQ3TMe+UmdS1Jn+saKb8ixTurvNuRmSdrBfUcVkR7URM/1f1GukOqf8iPYfZhEQxs ISM4rC6yAkcnLtPv8AoWBc++yPD9UyOpxeAlHv99C7xlFK3DwMcr43qdq0CdgmTjUonn b1dpCzNOmkKyfJdVDMxcLXdrOAdHBpYoMfEG8QisoISiUW7fEmPxBdpqSQrSlwrEuAAD 2RdeFQpYxayoZjevxSGgL3N0+eqwIIPUYisik5n7y9v+WbNqxV5Cpypvg/hbWHOYkzB4 4lHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=ZS0xTGWPmg2YrVCNbeD4MawSp68n8t9VF2ZsnKmMFRI=; b=VJ7R1UHKBFwU7/BQzcGbOPPYchWK2OIshVcWKsny7IE9LT3ZAe3D7iIEPaZIwFs61p 9bq3oXDp6vtZxroR+tWeZFrLxg/4KXT/UhElatNGoLmvwJDnCzBClJa3/00cBRIybh3Q SRBMDenbDIbUFlzSRx312ttcJVtPiIssxqVMqkZcmeaqi7IoJzPSIDhvXrwGdDJ9hLm/ dzzbx+sMNVubIbRbUr43F/D+lWXwJVy4o3ReDIavToth1G3mb/CZ35BvUXgVTj1OH3cj W+t2qlVd+zXA04B5JZENucxZrh9x7kpyx6TpMPy0z0VVx1xkrVTBd+Z4/AOFwnuiQ9Ta +0lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h22-v6si1023965pfa.238.2018.08.23.01.02.44; Thu, 23 Aug 2018 01:02:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728717AbeHWL25 (ORCPT + 99 others); Thu, 23 Aug 2018 07:28:57 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:37153 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727878AbeHWL24 (ORCPT ); Thu, 23 Aug 2018 07:28:56 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 38EAE816AA18E; Thu, 23 Aug 2018 16:00:29 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.399.0; Thu, 23 Aug 2018 16:00:25 +0800 From: c00284940 To: , CC: , , , , c00284940 Subject: [PATCH plinth/topic-sas-4.18] {topost} scsi: hisi_sas: send HARD RESET to clear the previous affiliation of STP target port when init device Date: Thu, 23 Aug 2018 15:58:47 +0800 Message-ID: <1535011127-110586-1-git-send-email-chenxiang66@hisilicon.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 bb0fa24..9225138 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) -- 1.9.1