From patchwork Mon May 21 10:09:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 136449 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp121815lji; Mon, 21 May 2018 03:14:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoLR0i5pMRLLutxLptaIxSolapPazI+Xksl1DmQdGV5f8Uk0qIbs7a/zC2HgRXNWGSuHcW2 X-Received: by 2002:a17:902:bc84:: with SMTP id bb4-v6mr19437460plb.84.1526897669899; Mon, 21 May 2018 03:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526897669; cv=none; d=google.com; s=arc-20160816; b=dKcamqvx55Z5wf/XjKz2dEjETP7LO44T6urp7WuBFvlkt1ZmJ5ivA1GWRhg3jawZfZ tSLGNT1rPTkz2WHdJxYTQIgsdFfkPXgsRxem2hIdrYQlW68K3/WCqosHOLQcGvoBWS9a a7DYceiJFNOHMSSNWI3oezG7H+F/lD2mw5N2jQtg5API52d0GvxRa7jPNcNXvn4ExVy4 6EG6vjyEdrY1MpLNCWUd65FuxwaTwGUZ/hmFqtskn5WhhpuWxZxFhTpwCHppXkGIEy3Z IZStNuOCIYPCDmmjS1xPnk3eiaWkOVE9xtjUKbyr9LaE2GECsmCiex9pCrLllEj7ygWW nAkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=PyWIpUYh0TsqZOnSW3pasUJJGAYahDdmeHZv1Q7DeiU=; b=n8i1ujSqRh9PSOK4lCXiDW9sPCAoTGN+Vl25OFOXgnhLsjxEb+N2Rtm2PGNZPzw0nv viGNXiN3DyBNRjv3flWBxRZcHnZ/0v0NbzCMFa2omz+TrFuCfEQOWzmqVW8SL5ru7nYF 3SChsnJHQ8UtxHvahI4xJQW6rL4iYHQi1PCi9qWGydx9fgQsksDo4vf+ulond7uzrXF+ Foe6h26wuq2lSwY3h3XX9p5xutzfRjhDksfHH+JXlm1xqkL+v+RhbCARcruxJ6j1Vssy 9/O8wup46B6GfG0OZahmD1P+xxlkXDIinfnCNWaaoXzKzaQjGbJ4pitkXNy3Bptk7QKW T6zw== 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 c4-v6si7665566pga.522.2018.05.21.03.14.29; Mon, 21 May 2018 03:14:29 -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 S1752854AbeEUKO1 (ORCPT + 29 others); Mon, 21 May 2018 06:14:27 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:55781 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752291AbeEUKLl (ORCPT ); Mon, 21 May 2018 06:11:41 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9C0BAFE4438DD; Mon, 21 May 2018 18:11:35 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.382.0; Mon, 21 May 2018 18:11:31 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 07/13] scsi: hisi_sas: Init disks after controller reset Date: Mon, 21 May 2018 18:09:19 +0800 Message-ID: <1526897365-228549-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526897365-228549-1-git-send-email-john.garry@huawei.com> References: <1526897365-228549-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 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 From: Xiaofei Tan After the controller is reset, it is possible that the disks attached still have outstanding IO to complete. Thus, when the PHYs come back up after controller reset, it is possible that these IOs complete at some unknown point later. We want to ensure that all IOs are complete after the controller reset so that all associated IPTT and other resources can be recycled safely. To achieve this, re-init the disks by TMF or softreset (in case of ATA devices). If the init fails - maybe because the device was removed or link has not come up - then do not release the device resources, but rather rely on SCSI EH to handle the timeout for these resources later on. This patch also does some cleanup to hisi_sas_init_disk(), including removing superfluous cases in the switch statement. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 7b8623b..0dfefdf 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1259,6 +1259,23 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 old_state, } } +static void hisi_sas_reset_init_all_devices(struct hisi_hba *hisi_hba) +{ + struct hisi_sas_device *sas_dev; + struct domain_device *device; + int i; + + for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) { + sas_dev = &hisi_hba->devices[i]; + device = sas_dev->sas_device; + + if ((sas_dev->dev_type == SAS_PHY_UNUSED) || !device) + continue; + + hisi_sas_init_device(device); + } +} + static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) { struct device *dev = hisi_hba->dev; @@ -1287,7 +1304,6 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) scsi_unblock_requests(shost); goto out; } - hisi_sas_release_tasks(hisi_hba); clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); @@ -1295,6 +1311,7 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) hisi_hba->hw->phys_init(hisi_hba); msleep(1000); hisi_sas_refresh_port_id(hisi_hba); + hisi_sas_reset_init_all_devices(hisi_hba); scsi_unblock_requests(shost); state = hisi_hba->hw->get_phys_state(hisi_hba);