Received: by 10.213.65.68 with SMTP id h4csp1857145imn; Mon, 19 Mar 2018 15:24:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELsh53T4HOaoUxJJ9sscPBv6BZc74JjW4tlH2K8gkrRTzz2fmcVBvyRADrleKKU3YYJkGy+Y X-Received: by 10.99.148.17 with SMTP id m17mr10374082pge.140.1521498244174; Mon, 19 Mar 2018 15:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521498244; cv=none; d=google.com; s=arc-20160816; b=ppJ6SScDAOOdYY2p8h42JIZHpNvO6cEy+f1KiV0axNL672k8bmvig8bPVr0ncaOWdZ 6z/v+p5IWHFAa+uiYKr8HrS2GaaQXrHdqlcfnVKpYwtOoXrDWWTEOO9CnNjMcc4+E5LR MT/gkOBgFQCjQBPl4Mmuce0R6dD7ywSQXTHPrIA8+z8jAzRG6seP0nqvwfsIZw3JPxNg j6vccRMHAMrC4bmR03q0TgORw2JUfEYOMFgxJcoSJ/uPGOJ9MAhX8puGbEThJ1E7hm7n gUl/4q/V2SRu7MmAWGzOiqS2bevPaLhA1BQbNtbmYLIi16h5NczOwV4CnSvpyr2aZkAP 03OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=UzHpTeGXqyVx9GA/zHba3OQ/hm78Vk6LlqKGN1OY1tU=; b=e1ZhSuRE6au/yjPSHRcCaCBIPzX52Bopp8wGMvpxxZFlFCAP3AqjM6w6ZhYSxfL4Du zldGHh1D0HS5dY51I+a1V7fFpJ5WwCNwGQVf23HJFrLyBHYLbvEUR4rvPp6XMWw6Oubj mN3qGfB72YbtHfG+4d/JS+q+DfkLhVUf27VaWl0iJKtcyW3vcdctIyyTxlYatgU1byKF gkL8TJDGzo21zf+cHCNueGUddv9lidZYwR9wtrnBQILVlt+60G3RqrufnlbAi47w0EHc LU+9MlsUTR2W87rSe93zbgWIUuqLl8dVstFo9OmXKJ89b/gyIcE6LIEC/KWfDr0Sqvue /c5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=SoDnkrDm; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59-v6si206352plp.436.2018.03.19.15.23.50; Mon, 19 Mar 2018 15:24:04 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=SoDnkrDm; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933983AbeCSWWQ (ORCPT + 99 others); Mon, 19 Mar 2018 18:22:16 -0400 Received: from mail-sn1nam01on0122.outbound.protection.outlook.com ([104.47.32.122]:60759 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933911AbeCSPtO (ORCPT ); Mon, 19 Mar 2018 11:49:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UzHpTeGXqyVx9GA/zHba3OQ/hm78Vk6LlqKGN1OY1tU=; b=SoDnkrDmjWT9b/+UcJ7Dmu1vEteJl7JEXQjocwQy/n0uYt78uuullDA3jxQKk2ZcwJYdfhDaUyCy7KusKx/KSVWYXNfIdRWEZd8+lqLZKFRL3SW7r8pKWRjMKvJPNiWQ8Xw52ZTJiG7OlMQ8O4MZbLiVNFEvkfadzl/hGWwK2jw= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0981.namprd21.prod.outlook.com (52.132.133.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:49:05 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:49:05 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: chenxiang , Jason Yan , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 089/124] scsi: libsas: initialize sas_phy status according to response of DISCOVER Thread-Topic: [PATCH AUTOSEL for 4.15 089/124] scsi: libsas: initialize sas_phy status according to response of DISCOVER Thread-Index: AQHTv5m/VSA1qe/Ra0GvREVfIUS8iQ== Date: Mon, 19 Mar 2018 15:48:38 +0000 Message-ID: <20180319154645.11350-89-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0981;7:8K76tf+0t8qjpR8K2qHRLaygUXQXD1tdn4fcRE1aJDqbW3QCUdXsIIlUqJ2HibBT4PO2tclQP7OfGF4ui/SfZcW6D3u5E/JbdejNcZDehadHwPh+xC8ib4AfNAq7c3q/heCY02a5Ccf9Ko8Wy/axk9V8dUnVtZuDt5MckDb9i4k5D3eqUWnx/TRhbdCBCcu1tNG58RWXh/5neu1PM3UxCm2WnfXj+6zu9/pxG44l8Oa+6p03yPUqpLKKC/5QrDW5;20:kjJs0VhokyseDdc9yEbzGtKFUXw01/xIOQ3yjkult7sV5wI8vEguQ+Jt7kT9imGrNQ38O5JuPqzanhHctqCtz5DfCikiNuNfNOOWeKIjRqCW14VYEycRjpoeZGMWx09ChB1lsonK3S925yTUXyNsBX/lizezYoPRfwZxvtEBbYg= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 6886db5a-4a14-4ab6-3b78-08d58db0f20d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0981; x-ms-traffictypediagnostic: DM5PR2101MB0981: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0981;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0981; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(396003)(376002)(366004)(39860400002)(39380400002)(189003)(199004)(66066001)(6486002)(26005)(110136005)(5660300001)(54906003)(3280700002)(6512007)(68736007)(102836004)(6436002)(107886003)(10290500003)(53936002)(186003)(59450400001)(72206003)(14454004)(36756003)(6666003)(2950100002)(316002)(6506007)(22452003)(478600001)(10090500001)(106356001)(105586002)(99286004)(7736002)(3660700001)(86362001)(76176011)(305945005)(86612001)(2501003)(97736004)(5250100002)(5890100001)(4326008)(3846002)(6116002)(1076002)(8936002)(25786009)(81156014)(81166006)(8676002)(2900100001)(2906002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0981;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: kG16JvS/liJsWbg2fNpmvXTMQwg3Zw6Or63hoUqn7R8TdNl8rdPJ5FmtcvJoSXiP1Vdzlo5EzwSlQzVFCPg+BAvE4F1a1mmyADMj6+NIGOKCOyScySDFhWCYLz4/jRMvuKMZNHD1YJQYJIARXG2T0PIE/Ky3sX64xH/jg2Jd/T/ay8ZeHipwNpwuqYmyqFKtZv91N5vF+jwRLQx7tTcMCu+Ha6yoRKwM17QZWY0Gn9mZ/uUGzeunBMwFh0WrLALcPj0zfTVWWp3RtWrocU84CF3j6trC5kwbc9rMyV9bJAiK4Yk6PHfnYM6iv6TOJQ1v3OoYSUKnb7NWIiWd+bO+kw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6886db5a-4a14-4ab6-3b78-08d58db0f20d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:48:38.7858 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0981 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: chenxiang [ Upstream commit affc67788fe5dfffad5cda3d461db5cf2b2ff2b0 ] The status of SAS PHY is in sas_phy->enabled. There is an issue that the status of a remote SAS PHY may be initialized incorrectly: if disable remote SAS PHY through sysfs interface (such as echo 0 > /sys/class/sas_phy/phy-1:0:0/enable), then reboot the system, and we will find the status of remote SAS PHY which is disabled before is 1 (cat /sys/class/sas_phy/phy-1:0:0/enable). But actually the status of remote SAS PHY is disabled and the device attached is not found. In SAS protocol, NEGOTIATED LOGICAL LINK RATE field of DISCOVER response is 0x1 when remote SAS PHY is disabled. So initialize sas_phy->enabled according to the value of NEGOTIATED LOGICAL LINK RATE field. Signed-off-by: chenxiang Reviewed-by: John Garry Signed-off-by: Jason Yan Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libsas/sas_expander.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_e= xpander.c index 6eab487e995e..39e42744aa33 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -293,6 +293,7 @@ static void sas_set_ex_phy(struct domain_device *dev, i= nt phy_id, void *rsp) phy->phy->minimum_linkrate =3D dr->pmin_linkrate; phy->phy->maximum_linkrate =3D dr->pmax_linkrate; phy->phy->negotiated_linkrate =3D phy->linkrate; + phy->phy->enabled =3D (phy->linkrate !=3D SAS_PHY_DISABLED); =20 skip: if (new_phy) --=20 2.14.1