From patchwork Thu Apr 11 12:46:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 162067 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp7378334jan; Thu, 11 Apr 2019 05:48:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwBARDeutqHg57s9I6KY5UztCoMrfsmfcjwYamy0nZoTHBO0aN8eQ6PxKbKX2Ji/9KKGPb X-Received: by 2002:a63:c61:: with SMTP id 33mr43159235pgm.293.1554986909579; Thu, 11 Apr 2019 05:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554986909; cv=none; d=google.com; s=arc-20160816; b=JQSqr0AX+y7so+Cb9p3zhQaevRvDpelxtmaSpWXoaBFou7OShB1RpVrkdilm/19RUH 4eWDas8KoyGfdIdO/1E7Tj/W9i6LdB6Jkep4H7Kkzc+mZPlZnp1yqt9R1/7sg3RLaZQ2 oQ424Ua6aqqqjhVb678eBpqyJffrRBjLNbWAdjjTsx1+El1sSZNOk/NOxNvW420kjqY1 5YSthbQGjs+bc18YH/BDkWPNG0Jtwgfce0YLZQgb09nE8ycgmHjSnDsEsd5JeOCeii2K Ugl79P9YhUilrF4Xt+2mMRYT8uvbHUcbyt+oEUMijzINh8YwK56LZsEY66oQzgcWpjFI NEbA== 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; bh=gOllWPR7dqlM/BvUtZ0HJlupNJBPq4xHsZcVTV07Qvc=; b=lPzBvwn4Uxtjc3JBIe+2biLpp8B8PQtD86YVXfw6vj0Lkf8vJGwNrhRRTWwpWXAZ7s 23thHM+HPrrdyI0nBN6ncJdwJ4+j2DdaqexeKLtCL3jw8en0uaq88HbhfKBPRgnEUVnP T9FK/hl69KmwRHfmz1SIM6/RVouN39TOa6ddmx0e7/AMxhuxMY3IJGLYRJ2CM7wxT5zj +NmhAHScIiPYoLECY2For8I89LeGDFDMHzZS0wHpZ+NKMYFvauO7NR1Fz/EAp3krMYmP 98I2PivjK/c5i7tucpF0rxse46dKtnrxmeFs3WYhFJs8W4x1qh+6FwD7gd2YuVfoa+vp lR+A== 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 f36si34678726pgf.332.2019.04.11.05.48.29; Thu, 11 Apr 2019 05:48: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 S1727212AbfDKMs2 (ORCPT + 31 others); Thu, 11 Apr 2019 08:48:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6728 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726538AbfDKMra (ORCPT ); Thu, 11 Apr 2019 08:47:30 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A37E31944EADB8149C1D; Thu, 11 Apr 2019 20:47:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Thu, 11 Apr 2019 20:47:18 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 2/9] scsi: hisi_sas: Remedy inconsistent PHY down state in software Date: Thu, 11 Apr 2019 20:46:37 +0800 Message-ID: <1554986804-233706-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1554986804-233706-1-git-send-email-john.garry@huawei.com> References: <1554986804-233706-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: Xiang Chen Currently there are two scenarioes which may cause PHY state of hardware (which is 0) is inconsistent with the state held in software: - Unplug SAS wire before get_phys_state when SAS controller reset, then the interrupts of phy down are ignored, phy state is 0 before reset, and it also gets 0 after reset, so phy down doesn't occur even if unpluged SAS wire; - For v3 hw later version, it will close bus when 2 bit ECC error occur. So if unplug SAS wire at that time, interrupts of phy down also not occur. So at last it will cause host reset. It also get phy state 0 before and after reset, the same issue occurs. To solve it, use hisi_sas_phy_down() directly in rescan topology function. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index a1eaddcf740d..e7401e2bea27 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1427,9 +1427,9 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 old_state, sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); } - } else if (old_state & (1 << phy_no)) - /* PHY down but was up before */ + } else { hisi_sas_phy_down(hisi_hba, phy_no, 0); + } } }