From patchwork Sat Jan 20 01:01:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 10176181 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 0C73860386 for ; Sat, 20 Jan 2018 01:02:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F33B728773 for ; Sat, 20 Jan 2018 01:02:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E72C6287A9; Sat, 20 Jan 2018 01:02:12 +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=-6.9 required=2.0 tests=BAYES_00,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 821DD28773 for ; Sat, 20 Jan 2018 01:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932152AbeATBCK (ORCPT ); Fri, 19 Jan 2018 20:02:10 -0500 Received: from mail-bn3nam01on0076.outbound.protection.outlook.com ([104.47.33.76]:10752 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756027AbeATBCF (ORCPT ); Fri, 19 Jan 2018 20:02:05 -0500 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=yZb0RtsJ9VRr0Vh+NdvFMHPkPCcMM7zQzJVtcbr+xwk=; b=cLwKKbk/W49i1khe7QQR10czwkSX1yKvByno7T+Ca9vPIQRobStDZpAozxkvpZC6apAOY1mMzRcESeAN0Fl5AMQxH6AosBq/nzPBiJoYJ+gWGeipZFGC9fs/OthNRcVg69sKYqejRB0JUgGEMDCNlQt0Y63izhPeNHpJpp0S/yE= Received: from MWHPR0201CA0052.namprd02.prod.outlook.com (10.167.160.29) by BY2PR02MB139.namprd02.prod.outlook.com (10.242.45.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Sat, 20 Jan 2018 01:02:02 +0000 Received: from BN1AFFO11FD038.protection.gbl (2a01:111:f400:7c10::126) by MWHPR0201CA0052.outlook.office365.com (2603:10b6:301:73::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Sat, 20 Jan 2018 01:02:02 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.21 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.21; helo=avsrvexchhts1.microsemi.net; Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BN1AFFO11FD038.mail.protection.outlook.com (10.58.52.242) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.428.12 via Frontend Transport; Sat, 20 Jan 2018 01:02:01 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server id 14.3.361.1; Fri, 19 Jan 2018 17:01:58 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH 1/3] scsi: aacraid: Implement DropIO sync command Date: Fri, 19 Jan 2018 17:01:55 -0800 Message-ID: <20180120010157.22674-2-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20180120010157.22674-1-RaghavaAditya.Renukunta@microsemi.com> References: <20180120010157.22674-1-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)(396003)(39860400002)(346002)(39380400002)(376002)(2980300002)(438002)(189003)(199004)(51416003)(68736007)(26005)(59450400001)(4326008)(2201001)(36756003)(106466001)(104016004)(1076002)(77096007)(336011)(2950100002)(47776003)(6666003)(72206003)(478600001)(86362001)(2906002)(5660300001)(57986006)(8936002)(50226002)(97736004)(106002)(8676002)(76176011)(316002)(81166006)(356003)(16586007)(69596002)(50466002)(48376002)(54906003)(110136005)(53936002)(305945005)(81156014)(76506005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB139; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD038; 1:x1+3/UMDS0Z038gbZqVn6BM5Pw5obDbtSN1Tzc0YAcgei55gs89UQqPijOKKacn7vf+PwpAOKMsPbsKTji94BQB64xr5fW7MWly3x8Up6fCV+Si+0nN1CeK2LyYn9HOX X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4bb6bf81-0926-40bb-a696-08d55fa16a15 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BY2PR02MB139; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB139; 3:Yqf/iOsfexN3tiZhKNGzShyXHQI2XVlXLfJXC/dci+lEaUCkV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nlXBxviIjsuppRuezxDOpY3C+Xyw6tQ0E7W4NkXTxlFKbcWLPKnbwqkqzlxzGMSWwzIF7yBt5Tv8fAWmnTMLBd2D3f1OhZZJqGrp1ys/dH3yI4ay1/OxF6f1PdsowLRkvUwdPNXoYUUqWC9RFYfy2aD7R7mtAR8bANRNJOcke1x7j+wOQC00mmx4otRymER7ffrVb33Ce2/634FBcqEB0lOSNGGUjNCTo4IBTwBKUYiHwNxcmWDDehwf1EBMRzqsTq8CSB/k7SDIi6Wq8oXCpo1mSkT41AskRFS8ePcQ7hpkyFy7mixMnwSrDDKcEtKY5d/WwM77vz7eQYcHpPG8+Kn8DyQ49k+3md3MUY0UkBrThMGRTd2mVDPFXJv6EPiUAg95Oe9t0nJHJB+kK9+hoqXnsJb8imBVfG2CeYoFxEGB4ooinken6LmnKVgJ95GPPipWu9K/y5Yg+ojzS2yjjbWr2YPKfTt66mBS4oUPrmMREBR5Ih6MDi+jeNeFzo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040498)(2401047)(8121501046)(5005006)(93006095)(93004095)(3002001)(10201501046)(3231023)(2400081)(944501161)(6055026)(6041285)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:BY2PR02MB139; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR02MB139; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB139; 4:Fop2VJqonEl6CxLqZTkJk3so6sBjDLwKGPSRH6+xYEEks/nECrJ/jyW3lmDJsIN7PaK6l40kxwKDSKTr5X8OHiFokmTdPQUzzjAs594WkES6eOzdt/hQdcx/aotisG6iQfNbS61/K0SCf8dGUq6bNtqfNti47PXsZ2y7fcGVjEyGxbF7x9WOOWZKeRbZt65CT5dSjZURMCmQsKFBM4+8Fi+c628dpK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Kmwe7RzJ3Hw0hz3ehUM=; 24:p42bp3HdT8esyUnT1200ud+dnWS/14fn14rsfqrBnMPmoY1Hc8fozt24YWD4LmaI9W/BY+b8ei0/jGlxQbyc/ovlhW9Cdb+JmFhKDYcycXk=; 7:nfp4pPpbosY+LTCFSJeKi0bNJsArKg84GmtuGBWL6tODlFECEPhed3hlec60aBQnUW4+I5/RLL73GGy9R4ULBmFGmqnrDZ8qd00wHorutwQKqCej3XYrXYtifXbj1dyJuHlCSZDrB1CaChx/WPnTVBZ+rpZ6ejHJI+LpQFmav2mLnjBWlNsmqdHWSIu8g94zrJnrSmnCIXI1luVMxDFkVbq1RasztAPBsGjDnXcrC0nOBkySqsmaMmE0Aihnw8MV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2018 01:02:01.3226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bb6bf81-0926-40bb-a696-08d55fa16a15 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: BY2PR02MB139 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 IOP_RESET takes longer time to complete, if controller is in a state where we can bring it back with init struct, controller DropIO sync command is implemented. - If controller is faulted perform standard IOP_RESET in aac_srcv_init. - If controller is not faulted get adapter properties and extended properties. - Update the sa_firmware variable and determine if DropIO request is supported. - Issue DropIO request, and get the number of outstanding commands. - If all commands are complete with success (CT_OK), consider IOP_RESET is complete. - If any commands timeout, Perform the IOP_RESET. Signed-off-by: Prasad B Munirathnam Signed-off-by: Raghava Aditya Renukunta Reviewed-by: Dave Carroll --- drivers/scsi/aacraid/aacraid.h | 4 + drivers/scsi/aacraid/src.c | 167 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 163 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 3e8bfcf..784783b 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1528,6 +1528,7 @@ struct aac_bus_info_response { #define AAC_COMM_MESSAGE_TYPE3 5 #define AAC_EXTOPT_SA_FIRMWARE cpu_to_le32(1<<1) +#define AAC_EXTOPT_SOFT_RESET cpu_to_le32(1<<16) /* MSIX context */ struct aac_msix_ctx { @@ -1662,6 +1663,7 @@ struct aac_dev u8 raw_io_64; u8 printf_enabled; u8 in_reset; + u8 in_soft_reset; u8 msi; u8 sa_firmware; int management_fib_count; @@ -2502,6 +2504,7 @@ struct aac_hba_info { #define RCV_TEMP_READINGS 0x00000025 #define GET_COMM_PREFERRED_SETTINGS 0x00000026 #define IOP_RESET_FW_FIB_DUMP 0x00000034 +#define DROP_IO 0x00000035 #define IOP_RESET 0x00001000 #define IOP_RESET_ALWAYS 0x00001001 #define RE_INIT_ADAPTER 0x000000ee @@ -2537,6 +2540,7 @@ struct aac_hba_info { #define FLASH_UPD_PENDING 0x00002000 #define FLASH_UPD_SUCCESS 0x00004000 #define FLASH_UPD_FAILED 0x00008000 +#define INVALID_OMR 0xffffffff #define FWUPD_TIMEOUT (5 * 60) /* diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 0c9361c..df98f37 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c @@ -255,7 +255,8 @@ static int src_sync_cmd(struct aac_dev *dev, u32 command, */ src_writel(dev, MUnit.IDR, INBOUNDDOORBELL_0 << SRC_IDR_SHIFT); - if (!dev->sync_mode || command != SEND_SYNCHRONOUS_FIB) { + if ((!dev->sync_mode || command != SEND_SYNCHRONOUS_FIB) && + !dev->in_soft_reset) { ok = 0; start = jiffies; @@ -988,6 +989,148 @@ int aac_src_init(struct aac_dev *dev) return -1; } +static int aac_src_wait_sync(struct aac_dev *dev, int *status) +{ + unsigned long start = jiffies; + unsigned long usecs = 0; + int delay = 5 * HZ; + int rc = 1; + + while (time_before(jiffies, start+delay)) { + /* + * Delay 5 microseconds to let Mon960 get info. + */ + udelay(5); + + /* + * Mon960 will set doorbell0 bit when it has completed the + * command. + */ + if (aac_src_get_sync_status(dev) & OUTBOUNDDOORBELL_0) { + /* + * Clear: the doorbell. + */ + if (dev->msi_enabled) + aac_src_access_devreg(dev, AAC_CLEAR_SYNC_BIT); + else + src_writel(dev, MUnit.ODR_C, + OUTBOUNDDOORBELL_0 << SRC_ODR_SHIFT); + rc = 0; + + break; + } + + /* + * Yield the processor in case we are slow + */ + usecs = 1 * USEC_PER_MSEC; + usleep_range(usecs, usecs + 50); + } + /* + * Pull the synch status from Mailbox 0. + */ + if (status && !rc) { + status[0] = readl(&dev->IndexRegs->Mailbox[0]); + status[1] = readl(&dev->IndexRegs->Mailbox[1]); + status[2] = readl(&dev->IndexRegs->Mailbox[2]); + status[3] = readl(&dev->IndexRegs->Mailbox[3]); + status[4] = readl(&dev->IndexRegs->Mailbox[4]); + } + + return rc; +} + +/** + * aac_src_soft_reset - perform soft reset to speed up + * access + * + * Assumptions: That the controller is in a state where we can + * bring it back to life with an init struct. We can only use + * fast sync commands, as the timeout is 5 seconds. + * + * @dev: device to configure + * + */ + +static int aac_src_soft_reset(struct aac_dev *dev) +{ + u32 status_omr = src_readl(dev, MUnit.OMR); + u32 status[5]; + int rc = 1; + int state = 0; + char *state_str[7] = { + "GET_ADAPTER_PROPERTIES Failed", + "GET_ADAPTER_PROPERTIES timeout", + "SOFT_RESET not supported", + "DROP_IO Failed", + "DROP_IO timeout", + "Check Health failed" + }; + + if (status_omr == INVALID_OMR) + return 1; // pcie hosed + + if (!(status_omr & KERNEL_UP_AND_RUNNING)) + return 1; // not up and running + + /* + * We go into soft reset mode to allow us to handle response + */ + dev->in_soft_reset = 1; + dev->msi_enabled = status_omr & AAC_INT_MODE_MSIX; + + /* Get adapter properties */ + rc = aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, 0, 0, 0, + 0, 0, 0, status+0, status+1, status+2, status+3, status+4); + if (rc) + goto out; + + state++; + if (aac_src_wait_sync(dev, status)) { + rc = 1; + goto out; + } + + state++; + if (!(status[1] & le32_to_cpu(AAC_OPT_EXTENDED) && + (status[4] & le32_to_cpu(AAC_EXTOPT_SOFT_RESET)))) { + rc = 2; + goto out; + } + + if ((status[1] & le32_to_cpu(AAC_OPT_EXTENDED)) && + (status[4] & le32_to_cpu(AAC_EXTOPT_SA_FIRMWARE))) + dev->sa_firmware = 1; + + state++; + rc = aac_adapter_sync_cmd(dev, DROP_IO, 0, 0, 0, 0, 0, 0, + status+0, status+1, status+2, status+3, status+4); + + if (rc) + goto out; + + state++; + if (aac_src_wait_sync(dev, status)) { + rc = 3; + goto out; + } + + if (status[1]) + dev_err(&dev->pdev->dev, "%s: %d outstanding I/O pending\n", + __func__, status[1]); + + state++; + rc = aac_src_check_health(dev); + +out: + dev->in_soft_reset = 0; + dev->msi_enabled = 0; + if (rc) + dev_err(&dev->pdev->dev, "%s: %s status = %d", __func__, + state_str[state], rc); + +return rc; +} /** * aac_srcv_init - initialize an SRCv card * @dev: device to configure @@ -1014,9 +1157,13 @@ int aac_srcv_init(struct aac_dev *dev) /* Failure to reset here is an option ... */ dev->a_ops.adapter_sync_cmd = src_sync_cmd; dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; - if ((aac_reset_devices || reset_devices) && - !aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) - ++restart; + if (aac_reset_devices || reset_devices) { + if (aac_src_soft_reset(dev)) { + aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET); + ++restart; + } + } + /* * Check to see if flash update is running. * Wait for the adapter to be up and running. Wait up to 5 minutes @@ -1064,13 +1211,16 @@ int aac_srcv_init(struct aac_dev *dev) printk(KERN_ERR "%s%d: adapter monitor panic.\n", dev->name, instance); goto error_iounmap; } + start = jiffies; /* * Wait for the adapter to be up and running. Wait up to 3 minutes */ - while (!((status = src_readl(dev, MUnit.OMR)) & - KERNEL_UP_AND_RUNNING) || - status == 0xffffffff) { + do { + status = src_readl(dev, MUnit.OMR); + if (status == INVALID_OMR) + status = 0; + if ((restart && (status & (KERNEL_PANIC|SELF_TEST_FAILED|MONITOR_PANIC))) || time_after(jiffies, start+HZ*startup_timeout)) { @@ -1090,7 +1240,8 @@ int aac_srcv_init(struct aac_dev *dev) ++restart; } msleep(1); - } + } while (!(status & KERNEL_UP_AND_RUNNING)); + if (restart && aac_commit) aac_commit = 1; /*