Received: by 10.213.65.68 with SMTP id h4csp1897955imn; Mon, 19 Mar 2018 16:50:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELtm3OyJEvV3RdFB49KbgGw4Z7cGUKvMTaox+TkXjmJ0yQi3Y3tJ2M7Up+pt6otdIZJGyq7D X-Received: by 2002:a17:902:f64:: with SMTP id 91-v6mr14246460ply.232.1521503433407; Mon, 19 Mar 2018 16:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521503433; cv=none; d=google.com; s=arc-20160816; b=BZo8x3fXzK4fHZFVzIKOoQKKv9iIbM31cfH6vJDNWqrLuWyu+QdJ5HXz/PjWUMnqNi xkoL9Kol6TaM3C76BqLVl5Cy/rIEEyG14B8OPpcIb4n+OHIoABjp15BO/hN0hPcsJh2p PQWGwvSCRPYuAHOitT+Xj9PhVgdfOezcvfP9Y4YAG9d2cCokiiqWJs8scVphMZA4Zlyw vMW1B/GGCIH+IYlnwavrWBOoWsYRjTZeukLHX+/7VgrHnwdfR+Nvz0jurTphwXwsxnB9 /yDGvlqQZGAfsu9ZuyqM95/yHRh7gtKkGc6p8xh9N1h6XLqwGDLhenNaKclk0H1RxSk2 ks6w== 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=jqX+3J7oOxkeQnz9LD5XvjE5Vh1K6YzDPDd8cc+PWbI=; b=I3DM1QyMGt2sGnriqDjn99a6Xh3O3DXX26ZszoN8tq3r6EE8HUgdOGf8B3orecj2ci cN6/8Q0m0vR7lmzP5xmYwhzowQEYqifE+J0oAMJY6L+G/CiPgcc9bNkG/VWE8VsM8ogB rYyhTeF/n68H2WUEgRYlQiD4Tx6jlwtyDc/4u5Op5dkRRGCuqTMk8Jn9Wr1a7Z2iXckx vUYspDAAGVyZUjn0qWnGvSS2Z+cRPyNsZmOzPhH+uKw8SHavqdwDLJzwhfQXs/nR1yiM mvLMOShOh8d1lSpPClWmE696hwqLglfehrcproFtDQvDlJEG9puSclCPaa3lPhjYqj9B l/ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=VsQpkJR6; 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 m9-v6si357348plt.6.2018.03.19.16.50.19; Mon, 19 Mar 2018 16:50:33 -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=VsQpkJR6; 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 S967737AbeCSQ6w (ORCPT + 99 others); Mon, 19 Mar 2018 12:58:52 -0400 Received: from mail-co1nam03on0139.outbound.protection.outlook.com ([104.47.40.139]:6160 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966742AbeCSQL0 (ORCPT ); Mon, 19 Mar 2018 12:11:26 -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=jqX+3J7oOxkeQnz9LD5XvjE5Vh1K6YzDPDd8cc+PWbI=; b=VsQpkJR6cJX8EhRti0HcLHVr67o4/1adcpHpMGibjwwJ719VhQ+HFYyt4TJo4zy/omq6DfvJV27Qd+mr7WEhj0R+KbT9QSIT6jDqw4GLlxPeV68d8zlQeQYhcCBoeCa7VGkwj8ORLMKmTZEs/nuM+Ijv2X9xO2CP/tGjtG2kueo= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0888.namprd21.prod.outlook.com (52.132.132.157) 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 16:11:24 +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 16:11:24 +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.4 158/167] scsi: libsas: initialize sas_phy status according to response of DISCOVER Thread-Topic: [PATCH AUTOSEL for 4.4 158/167] scsi: libsas: initialize sas_phy status according to response of DISCOVER Thread-Index: AQHTv5yLuwf0yWMjTUaRo2Rt1mY6cg== Date: Mon, 19 Mar 2018 16:08:40 +0000 Message-ID: <20180319160513.16384-158-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-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;DM5PR2101MB0888;7:Xn8Xs9RV4wOcrzI48dy2AsIcfmHE8YHLGXbt3K7BPQRv1Zc0zvOISV8hXLaluf4uDZ9MJWdJGkgb+xGE4JIvywRe2m9T66FgodsrtW5rsPHIFfmfrOekqzP9hVepW7qUjlfNWtzYlgpdlT48WCs1AA/dW43brzrPFqVHwYz8jqO+KWLvQzsHMiV3S5R+Q5g1w7GiXVqb6J+R+5ILJMtPYTGZ8hUtdHd6tk/9reXyahOvuPYbD2Dlotxv6sB7XhDM;20:y9wVjQ4PfyKj9B4hFs8uUE2wff1P4ffEAFBrR6gz76m1R9p0uBSP4lT0xjRaVS7WEvgszC7YDIhaNcEfx20nOUci03xxfFzBvzHmfDjFCX3V/SGqIxJ+107/+yGGuAB09pRmp7V7i7/k0eEx+2xwx+Uzr9CJ+CPc3JopGngxOCA= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: e40d67aa-e57c-42a9-4c37-08d58db40ffb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0888; x-ms-traffictypediagnostic: DM5PR2101MB0888: 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:DM5PR2101MB0888;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0888; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(346002)(39860400002)(366004)(39380400002)(376002)(189003)(199004)(6486002)(72206003)(106356001)(86362001)(3660700001)(6436002)(68736007)(53936002)(107886003)(8936002)(81166006)(8676002)(81156014)(2906002)(6116002)(4326008)(6512007)(1076002)(86612001)(66066001)(25786009)(7736002)(3846002)(305945005)(5660300001)(99286004)(5250100002)(110136005)(478600001)(36756003)(54906003)(2501003)(5890100001)(6506007)(186003)(59450400001)(26005)(14454004)(6666003)(2900100001)(316002)(2950100002)(102836004)(10290500003)(3280700002)(97736004)(76176011)(10090500001)(22452003)(105586002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0888;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: kCSj3emKBWD5Mjwz0/ym4+Kh5fxAw6TgrxuQoWZZqGGSVj8u26fEppTb2A9Y/WK99g+MW/O+fFflbKdJYAq8ZXqMpX0wLnDcSm6mtuZhn9nrw8CplC22uGg8NqItxny6NDYhCtMYOTqr+JmiegcMNV0Lbqjdw8BsdQ3AMjU3ZDL9crZr5mhqLGStD+ZAGTgHpSlQBmw1sCeUIo5y66bwYjkMGUDLR2UkkA1OtaoPZJDTgHpNGpdFEvtVX5JemvrR/Bo/1nkiqvostdut7HRPcNjvL65MXudovBWJWlFhw37cgosw2isd7BRplcPgKyST8NV0ccnTZiCVIKw4u8dWew== 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: e40d67aa-e57c-42a9-4c37-08d58db40ffb X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:08:40.9201 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0888 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 ccdb9d5e2f28..12886f96b286 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -282,6 +282,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