Received: by 10.223.176.5 with SMTP id f5csp798357wra; Sat, 3 Feb 2018 10:31:07 -0800 (PST) X-Google-Smtp-Source: AH8x224n2v/goKWhtDymFms6UMWRe4dyb6HLcuyEHnYoR1h87aq+BSfm21YJBqWjay7oUz/hD20Q X-Received: by 10.101.75.81 with SMTP id k17mr35281623pgt.335.1517682666941; Sat, 03 Feb 2018 10:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517682666; cv=none; d=google.com; s=arc-20160816; b=Rvits5c3pEqvlfBh19Jdiq1juJknzD3v5LZA1w+WJSEB6rLZE9M4pSCTw3UigRJVZE kCdvVATFJILpzPn/DwZWFuD1jQ+tOrN4wt+29QwwpNBL2MMey0u04iFmBEtDA6Wp2mAD idQcHwbRv2+CmuUfbGr5NVWCPFR6rdCGUAeONoPT3Q/+c8OVB5YK68kKa8aHWeqRCoPs qD34/LmzEAGlXZknlDbvqo1V/Vdyd9GeTLy4blDvhDA/MpjgbsXDR11ZUCma52aZsQU3 /TSb1OPox0SYxqNx6QeuQWhk/O4MPktfYPmBHhI62XUcQC2kC+UA6ttfdUrXMTkXxHSK D3ug== 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=SHkoY6OBOKug9Jk7Gmh4yauz4pJF/gEK7lwo7Y1E+9c=; b=IMD+CNzPBWdHOQVS4Xh7XiPUGQQuzD2jgZaOqOGo+XhrP2zSea4cZHxjtVHykpk22w utuevsVntl86dVn+mUxsJLHTixq/VbqjggME80Ju72Iu+VZtDHwhC2/NpDFvCAIPoLEM ACP3U5glY2AVKhLG1F4Bwwum6ClUGIDY1g0+iDEPXnAIiQapQoT6mKt9H22tFtxdjetb VCHkhQI6vKsZp7Pt09ITmiK5eYJRrkxSQyDJGbkJuH2bgRmq+bbYK85RtWI0Du1zEOsM BcuDt68sV2USw7Jc4hla0v+w8HMS3ab/cZGHOlDb/aPOQCxt6hf8ADPRfD/s7scfFlv5 UVDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=lB5i5REG; 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 v37-v6si4136352plg.521.2018.02.03.10.30.52; Sat, 03 Feb 2018 10:31:06 -0800 (PST) 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=lB5i5REG; 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 S1754648AbeBCS3Q (ORCPT + 99 others); Sat, 3 Feb 2018 13:29:16 -0500 Received: from mail-bl2nam02on0139.outbound.protection.outlook.com ([104.47.38.139]:10688 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753328AbeBCSFB (ORCPT ); Sat, 3 Feb 2018 13:05:01 -0500 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=SHkoY6OBOKug9Jk7Gmh4yauz4pJF/gEK7lwo7Y1E+9c=; b=lB5i5REGIuP1M42qnf9U7F8dpZxohInjOAeJ6Ylt4t8SJoA4lhrVIBqbhuPnEKtb2k3bTEppD31GhQ0w8pfC+6jIsifAxH9gJsH4aaE6quLaZLAiaeMgarWxdI8Qf0/d8dAt4R5CHpzlngK+bzLx+HnAoZkDf2bUvU1iZ8RuW8c= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB0993.namprd21.prod.outlook.com (52.132.23.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.5; Sat, 3 Feb 2018 18:02:56 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:02:55 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Yuval Mintz , Jiri Pirko , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 110/110] mlxsw: pci: Wait after reset before accessing HW Thread-Topic: [PATCH AUTOSEL for 4.14 110/110] mlxsw: pci: Wait after reset before accessing HW Thread-Index: AQHTnRkItlwDpgw67EigJtJeNsydzw== Date: Sat, 3 Feb 2018 18:01:36 +0000 Message-ID: <20180203180015.29073-110-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-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;BL0PR2101MB0993;7:KZAN3tjdNz4JcTVyaXWdSEP/MS3qlduUISeaFSkbiVwaL6AEEEzXxY14F+4WtVmZnob5q8comDz3Lo4OWWm5ibaoJpBh0Y3GdJszOlN6HjG90T0UCGVPVlV22c4XDawl+o+1cSGhesxcMWvhvr1EYUdLDkMnxG7KLowV5YS+VQKbkkHE8zsQBM6VWB59zhnaJ98YfDnPhow5YhEGzmGm/bMFlGIxiudrTA44Rk41BbgLteTzL85QNDqbqtVGWuGX x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a94c638d-3368-4895-1773-08d56b305a45 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB0993; x-ms-traffictypediagnostic: BL0PR2101MB0993: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(2400082)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:BL0PR2101MB0993;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB0993; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39380400002)(39860400002)(376002)(366004)(396003)(189003)(199004)(6436002)(186003)(3660700001)(8936002)(105586002)(2906002)(6346003)(6116002)(3280700002)(3846002)(97736004)(6486002)(1076002)(2950100002)(6666003)(81156014)(86362001)(575784001)(76176011)(102836004)(2501003)(5250100002)(26005)(68736007)(10090500001)(81166006)(8676002)(59450400001)(53936002)(5660300001)(22452003)(305945005)(107886003)(7736002)(4326008)(86612001)(36756003)(99286004)(316002)(6512007)(10290500003)(72206003)(6506007)(14454004)(478600001)(25786009)(106356001)(2900100001)(54906003)(110136005)(66066001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB0993;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: BiQ4neJbDaXBPVg1NyJdmi+xifPKIBhvX9JMZNUVzseEKNCLLAVf2YyJZVkqTOqoH44ZhHH9mIxsk+AbLXzbHA== 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: a94c638d-3368-4895-1773-08d56b305a45 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:01:36.0190 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB0993 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yuval Mintz [ Upstream commit 8e033a93b37f37aa9fca71a370a895155320af60 ] After performing reset driver polls on HW indication until learning that the reset is done, but immediately after reset the device becomes unresponsive which might lead to completion timeout on the first read. Wait for 100ms before starting the polling. Fixes: 233fa44bd67a ("mlxsw: pci: Implement reset done check") Signed-off-by: Yuval Mintz Reviewed-by: Ido Schimmel Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlxsw/pci.c | 7 ++++++- drivers/net/ethernet/mellanox/mlxsw/pci_hw.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethern= et/mellanox/mlxsw/pci.c index 23f7d828cf67..6ef20e5cc77d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -1643,7 +1643,12 @@ static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxs= w_pci, return 0; } =20 - wmb(); /* reset needs to be written before we read control register */ + /* Reset needs to be written before we read control register, and + * we must wait for the HW to become responsive once again + */ + wmb(); + msleep(MLXSW_PCI_SW_RESET_WAIT_MSECS); + end =3D jiffies + msecs_to_jiffies(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS); do { u32 val =3D mlxsw_pci_read32(mlxsw_pci, FW_READY); diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h b/drivers/net/eth= ernet/mellanox/mlxsw/pci_hw.h index a6441208e9d9..fb082ad21b00 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h +++ b/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h @@ -59,6 +59,7 @@ #define MLXSW_PCI_SW_RESET 0xF0010 #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 5000 +#define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 #define MLXSW_PCI_FW_READY 0xA1844 #define MLXSW_PCI_FW_READY_MASK 0xFFFF #define MLXSW_PCI_FW_READY_MAGIC 0x5E --=20 2.11.0