From patchwork Wed May 10 16:39:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 9719261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3BD5460236 for ; Wed, 10 May 2017 06:24:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D21F284D5 for ; Wed, 10 May 2017 06:24:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 220CC28552; Wed, 10 May 2017 06:24:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4AAF284D5 for ; Wed, 10 May 2017 06:24:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751792AbdEJGYX (ORCPT ); Wed, 10 May 2017 02:24:23 -0400 Received: from mail-by2nam03on0049.outbound.protection.outlook.com ([104.47.42.49]:64427 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751761AbdEJGYT (ORCPT ); Wed, 10 May 2017 02:24:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=U2P08TbZ5T2dCnRo4sjVcy6T63lq8OEaDJsC1mSV7EI=; b=RXLXST6h7mcRLv7jdPX8w/hV2TUL6TKj/fSldN6mDn2aCapYd2pQykEU0HMtgHV4iUEn9fGYR/ovIYvg1QnWg54bWE3mOoqZ65OmHEl9cEWATa1O/+3H29Wp99jAxaVl35vD/iLZEg1MN+ffW362HRzx3ojU788nGDdh6PR0m04= Received: from CY4PR02CA0035.namprd02.prod.outlook.com (10.175.57.149) by CY1PR0201MB1898.namprd02.prod.outlook.com (10.163.56.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Wed, 10 May 2017 06:24:17 +0000 Received: from BN1BFFO11FD011.protection.gbl (2a01:111:f400:7c10::1:195) by CY4PR02CA0035.outlook.office365.com (2603:10b6:903:117::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11 via Frontend Transport; Wed, 10 May 2017 06:24:16 +0000 Authentication-Results: spf=neutral (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microsemi.com; Received-SPF: Neutral (protection.outlook.com: 208.19.100.21 is neither permitted nor denied by domain of microsemi.com) Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BN1BFFO11FD011.mail.protection.outlook.com (10.58.144.74) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1047.9 via Frontend Transport; Wed, 10 May 2017 06:24:16 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.339.0; Tue, 9 May 2017 23:24:04 -0700 From: Raghava Aditya Renukunta To: , , CC: , , , Subject: [PATCH V2 11/19] aacraid: Add periodic checks to see IOP reset status Date: Wed, 10 May 2017 09:39:45 -0700 Message-ID: <1494434393-17261-12-git-send-email-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494434393-17261-1-git-send-email-RaghavaAditya.Renukunta@microsemi.com> References: <1494434393-17261-1-git-send-email-RaghavaAditya.Renukunta@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39840400002)(39400400002)(39850400002)(39450400003)(39860400002)(39410400002)(2980300002)(189002)(199003)(9170700003)(189998001)(36756003)(50226002)(5003940100001)(86362001)(81166006)(107886003)(47776003)(2201001)(53936002)(38730400002)(356003)(50466002)(54906002)(104016004)(8936002)(305945005)(6666003)(77096006)(2950100002)(8676002)(478600001)(106466001)(5660300001)(4326008)(76506005)(2906002)(50986999)(76176999)(57986006)(72206003)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB1898; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Neutral; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD011; 1:vxh2hn9k70KdFtXmQZJwJBgnKiK/kBVh8PFPWFcd0huct3soW2NoRGq39CQ6O7A9dSZjeGV8FK2Y7E6gvRwNiC9yFQTcgi7JL7/L3A+JeE9Pi2727OWWZz2eoPbDI3qcR6XyWaSt9wDG3uYWMCnxxeRcKJPCmVdKqwQ94gXzrOHjqtmK7tyrIFDkBHxYUBlb1dJiiHNtfi7ixebthiSOAUM/6A7R0grdWr0E69Af+a+ESQgHHrC18KFCuRDiM+NE/spQuH6dVuRQBKnPE5sVE/J6iAT/R1SqM+VSW4YFW+VWcN8rzUcOOy8BRBoynE/jEuVmxArUEBD5qd7Hxk6f9TgcXyjh7YX0dYduPkD+Xy4XTRpH3iqG/xT9YKh4P5rrooSntIqJBjGRvLMAVrzll5KSI2lPQ9ysoQIroGnqx0SpHgY5MkhR8FhXSDPYGxEQB+UBxZfB2Xya0vCSLg8Fq8/P4SZZ6V09+bid1hw+hVgYS4J/fcmPuv6FaJMDMwCEFbZS8ITlp8a0OfuN0z6oAnTvlq3KordteI4VSbfa+1ferIq2oRqTiuiOjgfFDqpKjat3QiVBI6p/N5YnUXVKXg== X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c5aab871-85b9-4385-6b4f-08d4976d2f84 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081); SRVR:CY1PR0201MB1898; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1898; 3:f0zcXNjLupE4S1iwRVqCxhn+2Kq93YiGxKK+MTDVfvlq8qTJRDcz1APvgUvLbyEbtSoKMQ7qA/ISLXysWArvDjamvOpmO+VCYaP9xpKFPTC2ybqatNvqGbdHVU1uM8yfIQ3OWHXfIlXDXfHzXhXAyB+TesoHkgll4SSkJ2RazvhYVweHi5yxhV8CNIslpxmuh06NuqeWDR3DZSLVGv9dGiQfVt+yjOuc85g9FviZ9wGoDMCS3s7Ft2jsyIceeIwtgzMgGe6CuavnftMq1CfmxqtuQOhiW7WXgRk0jp7au8MQ7TDaw0iYgqXON1nZwdLAE7q3yEgbb1YDGl75I/Wa/wfEk11c8ANpfXrUOSXsCE/EgQhXPokCLedQKlINynJ8VxHl/sXaitQ4erUl8RAim/LVmsjCNN4Zjij2yPTYlNpdSlK5+vvGOZloGTg9hqfT66iqbQqkuD0aKjTPKwnaxg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1898; 25:Ss5OfXOEkg4386Ou+mN5wLqz87EX3cHYP8rcNyA0W+pa2OS5Lmm6UXMHRnwbm+ENJfKOzhKSrCTPz6TZIVARSqx3K3gJKYmuCpv6hSAhfZ3pmw6tBRZjEQW2AmTqhNVEevJHoHKEDxPvuSVI7lWuw5wad+9xg58bRlzsCc6P2j8vF4s4iDxLSZYVBnq54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/3V86bTlUHuapzCFoEjTU+Sti8gmF/rRsnivOloTUguApAL4BsGfuz3BMrd+DRv/BLMvlojge7B+0Edw6Qs X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13023025)(13024025)(13018025)(13015025)(13017025)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123558100)(20161123560025)(6072148); SRVR:CY1PR0201MB1898; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB1898; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1898; 4:byBQUG/YCy0AL7FPCjHAfU4jILeXnNnF5g6AQd3EtP5KMnlL60dKDHESX5bN/HhxanBKJGR1Bc/L3bKky1F0tu2t/M+5F0h3fgvXygkai6I0xSvSUZN6DZq3K6mJ86N0BqUGb8At7LTehRDXHOL0Hasjnad6nikLkDhhVoDSAIAABjLtW87fqAUl6nVJmzuVEFZhRw/C04+ojCUUCs5XLSB3pgZk69gMKRp6nIlsRJrJUyc47A3HTU3H0DlxujopHDvOAiJgRWmNlJ5qJ08iFN2AMW4UYm18lw3IXTwE6YFZYiZRSa7DoJipYQAJyXNcuinKfpeuZFW1wRUJQ5X4kP9d6VT9EVhXX9/EHYIhLSVW9nq0GEMmkE1d82GjMaQLMAGQBqVYp0JqVF7UzInqv8UI6ZtRv6+AAwNtpNPd+BF7v7IpgV8VdAYafpgqakw6QiJp2W7rqrdVAjXEqy+/UvtCTPD++hCty7DvU9ffKP4JGl+knPIm0U6HVTM2ZFx8GpcfGjmThD+dx/MxvwOwOMHg/lKGDoARNNCmqjDsra9G7KMNujCas99wIWH9cGSGLcfEWYDQjWsuIaSNrNzlQ/vGfT9qKy2JcBRLNjrq2gqoEOJR6T/QwKL6eG4hQRLij+ACR7S9DmeAFlt+6o0a+ggMpw0BzuhV0+z582hdNTcJRl8uw+VfZD7fLt9SWM8J+Z0kbUUo0eqloUJ68DZ97lUchYLoX7NHvtNVISd6ehpthbgF/Evu+vact0bm0w63F2QMPp8OevvPppZiLPciNDB19Ef92KUTUncqOcK9mJ2Em0o0fOYMcvwXvlb6iwrntG/j4MKz0Crl870ZrrUKljpoW7Z+cDaRwZj+0weYT3l2zbQC37bF2C3zFfBaOaxRD9l22oIHo3OYZmtNu15ydlgFQiORHUuWbttPRs8l qU8t8xLFJVAFw02XwQnqRQR3 X-Forefront-PRVS: 03030B9493 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0201MB1898; 23:03u3vN3uPf8WvjDcrot8sDhGYA5Hf8DkSm7v9Ti?= =?us-ascii?Q?jCGTAY1LP+jJG9Cvtie63H8o8/s9p75E6UHqcDEKeAf2kvU+XKrNvJQ04j4F?= =?us-ascii?Q?coxdGc7nALkRYrNRmagYMg4zI8KSvcSDx4Xas8kTbK1PW1+99q/ujInYQ20m?= =?us-ascii?Q?sv30pl5paAM5cdSS8sgyYhpQdsgH9OClBCepA9GDm9g/0P5VLirIwNMn5P72?= =?us-ascii?Q?PeYYsMpittPFxrQPhwk9NDGypMwElLc/Lx2iyBticxMOlqKFoTfESRffjcds?= =?us-ascii?Q?eN1iJuelSa2Nz+K/W5kteG2tSRSU0NuP8uBWGm9ujzppI3WSMIPp6b/Yu0jM?= =?us-ascii?Q?3nmXREp7QbQM3E0FmRxhUCY9DkmLY0WH0eP1fyXGK86ATwazsIMfDESGN3CC?= =?us-ascii?Q?BYyw0+fTxc8RHGNCHTM/so8adPQN/iRjKBU3f9S2+gXEXw4SVb//Hli+Bq4o?= =?us-ascii?Q?uStzDq0q5nbFwyw+NpgjLLMD2nL+pABhyWWTkJ9RzExE3BkZDxSmTdGud8sT?= =?us-ascii?Q?FfniL/+CrkMKexJrGNdk91M3M2PCVUA/4rOnkEFt0TyjS0jjrZBkPH5OgFvq?= =?us-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f94Nezd0b60nGjikQHj7FI6vxfYOY3m8DsEhvyl6Z/RUHIS4C0sQNrLsOswBIriylFlpQr3iiLIiBSCr9abQJichZVT8TeKd2UttbHpRq9b8mrxYcrVqxpeO3gYcfvU+yoBiOOmamm8hI4yJaeOh897cZOQyK1wG0c9bZWtNUlY=; 5:g1Bt7kHwc/cs2iMFtHIWPZO/jKrij+ScgOZVdofEjBxDUAWVc/h6TIRNubGyFdOY8clGvKC78BXq+DHRnc3b3DG9wvqzMuAMqwfZRh5dovY1w2JkeOS7mtjkbBF/ZgjeEE7HAfPrTxLHfxZQBiOFKA==; 24:GAzhaMoAWXe/uotKeJmN3LFRbkS4m6tz1k++6vOtvmaOdd8OfntvBZnOLE4F53QO8O8yamrJEIEqoCtLLrySSI2eQl2sQGpTOTywfluvcuM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1898; 7:lOtQYXv2X5yuzmRr7evTNdbvwU8bpLzxYy1Ed57pNWkIKT7iF6+JEzGWbPNRNfmIurY8fb0oWITBwJga7LOnwHPqJLH+/cOfvuHy0AISjHIFo2tdWAdiyrfJbEo0dwm+CIiA/IvwPXtwS52rQeEvpfdBYT8neLKDPE/LH7VQqyQmU+w7BeZNBXhMPFytd1igIoAOQl9aEUfFbvF1uK5LTkwmx7JrW0aqb0Pjh2b2mMF9LeDvzbHQp6Jz4CZLSSMWI4P39mh4ejRIEc1dJx7Gm3ftW2bJ1G+gVDzZyvtHEIbj1Qgyp9nBxI+f5TpScLSLhV79Hh7U6Lrog4QF42gpGA== X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2017 06:24:16.7243 (UTC) X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.100.21]; Helo=[avsrvexchhts1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB1898 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added function that waits with a timeout for the ctrl to be up and running after triggering an IOP reset. Also removed 30 sec sleep as it is not needed. Signed-off-by: Raghava Aditya Renukunta Reviewed-by: David Carroll --- Changes in V2: None drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/src.c | 45 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 993f134..829f3d8 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2519,6 +2519,7 @@ struct aac_hba_info { #define SELF_TEST_FAILED 0x00000004 #define MONITOR_PANIC 0x00000020 +#define KERNEL_BOOTING 0x00000040 #define KERNEL_UP_AND_RUNNING 0x00000080 #define KERNEL_PANIC 0x00000100 #define FLASH_UPD_PENDING 0x00002000 diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index e8e9178..67185eb 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c @@ -694,6 +694,37 @@ static void aac_dump_fw_fib_iop_reset(struct aac_dev *dev) 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL); } +static bool aac_is_ctrl_up_and_running(struct aac_dev *dev) +{ + bool ctrl_up = true; + unsigned long status, start; + bool is_up = false; + + start = jiffies; + do { + schedule(); + status = src_readl(dev, MUnit.OMR); + + if (status == 0xffffffff) + status = 0; + + if (status & KERNEL_BOOTING) { + start = jiffies; + continue; + } + + if (time_after(jiffies, start+HZ*SOFT_RESET_TIME)) { + ctrl_up = false; + break; + } + + is_up = status & KERNEL_UP_AND_RUNNING; + + } while (!is_up); + + return ctrl_up; +} + static void aac_notify_fw_of_iop_reset(struct aac_dev *dev) { aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS, 0, 0, 0, 0, 0, 0, NULL, @@ -709,8 +740,6 @@ static void aac_send_iop_reset(struct aac_dev *dev) aac_set_intx_mode(dev); src_writel(dev, MUnit.IDR, IOP_SRC_RESET_MASK); - - msleep(30000); } static void aac_send_hardware_soft_reset(struct aac_dev *dev) @@ -726,6 +755,7 @@ static void aac_send_hardware_soft_reset(struct aac_dev *dev) static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type) { unsigned long status, start; + bool is_ctrl_up; if (bled < 0) goto invalid_out; @@ -745,6 +775,16 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type) switch (reset_type) { case IOP_HWSOFT_RESET: aac_send_iop_reset(dev); + + /* + * Creates a delay or wait till up and running comes thru + */ + is_ctrl_up = aac_is_ctrl_up_and_running(dev); + if (!is_ctrl_up) + dev_err(&dev->pdev->dev, "IOP reset failed\n"); + else + goto set_startup; + /* * Check to see if KERNEL_UP_AND_RUNNING * Wait for the adapter to be up and running. @@ -780,6 +820,7 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type) if (src_readl(dev, MUnit.OMR) & KERNEL_PANIC) return -ENODEV; +set_startup: if (startup_timeout < 300) startup_timeout = 300;