From patchwork Wed Feb 7 16:40:56 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: 10205653 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 C8D12602D8 for ; Wed, 7 Feb 2018 16:42:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 615B429067 for ; Wed, 7 Feb 2018 16:42:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5155F290B0; Wed, 7 Feb 2018 16:42:20 +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 C278B28DF5 for ; Wed, 7 Feb 2018 16:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754647AbeBGQlQ (ORCPT ); Wed, 7 Feb 2018 11:41:16 -0500 Received: from mail-sn1nam02on0068.outbound.protection.outlook.com ([104.47.36.68]:34357 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754378AbeBGQlO (ORCPT ); Wed, 7 Feb 2018 11:41:14 -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=aK/4ifhXaAM3+FeQp/BZk/4sgf9kqlKnleFseiaOH/k=; b=NSdsxKzkZw71Wa9RZf1s7oKUI2OY/GIOyyu5ES1iPwDKtrJE9C2Q0bCITnKOwIU/6iw03yIx3vEJw8hZHBVMMcp34qnmNGnmv6FIGwvDCLVyn9wdQzoTvUwi/Rxu1ghtfNjsJIkkz07t34yLzWH/THxWcrgaF5RJR4g8jTUDTFo= Received: from SN4PR0201CA0069.namprd02.prod.outlook.com (2603:10b6:803:20::31) by CO1PR02MB141.namprd02.prod.outlook.com (2a01:111:e400:101e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 7 Feb 2018 16:41:11 +0000 Received: from BN1AFFO11FD015.protection.gbl (2a01:111:f400:7c10::146) by SN4PR0201CA0069.outlook.office365.com (2603:10b6:803:20::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.464.11 via Frontend Transport; Wed, 7 Feb 2018 16:41:11 +0000 Authentication-Results: spf=pass (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=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 BN1AFFO11FD015.mail.protection.outlook.com (10.58.52.75) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.464.8 via Frontend Transport; Wed, 7 Feb 2018 16:41:11 +0000 Received: from localhost (10.181.117.15) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server id 14.3.361.1; Wed, 7 Feb 2018 08:40:59 -0800 From: Raghava Aditya Renukunta To: , , CC: , Subject: [PATCH v2 1/3] scsi: aacraid: Implement DropIO sync command Date: Wed, 7 Feb 2018 08:40:56 -0800 Message-ID: <20180207164058.29598-2-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20180207164058.29598-1-RaghavaAditya.Renukunta@microsemi.com> References: <20180207164058.29598-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)(39860400002)(376002)(39380400002)(396003)(346002)(2980300002)(438002)(199004)(189003)(50466002)(48376002)(68736007)(478600001)(72206003)(51416003)(107886003)(356003)(6666003)(305945005)(36756003)(4326008)(2950100002)(69596002)(8936002)(110136005)(2906002)(54906003)(2201001)(81156014)(81166006)(76506005)(50226002)(1076002)(76176011)(59450400001)(5660300001)(106002)(8676002)(26005)(104016004)(86362001)(77096007)(53936002)(186003)(16586007)(97736004)(336011)(106466001)(316002)(47776003)(57986006); DIR:OUT; SFP:1101; SCL:1; SRVR:CO1PR02MB141; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD015; 1:jr6WJ9eBcsv9lCbjJlF0qAUYwrPg08ft3naO4iLFtIWdrJMhmPuvTmi5l2ZOGAkk8wGhQI2ABC3bCSYmiKcxXCFO9NbeF2jhdhbmvDeceO3EGPxlzmB3DFJkjnOMX+Eg X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9ef972d-9eb8-42f8-8dac-08d56e4998a1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:CO1PR02MB141; X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB141; 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Wm2j+G9cZKCrFWFh4tWxD3LWTgjnZFenpBucaXTaLj2PyRSqCi47zmudQpmwfxVIQj+FTpLoTxUr+M6X9QSeXBOqplF330LDlk3YfIaeQfLSUEDwxlrVxuix2991znY5vFqn0usYjIeIoO8D5OgfIqqnJ9R79G/JP5r2jKeTdMpl+kgizBIGu+cgH3sUB+aOBF5Pw9YIvMMQ5r2O1yEepQqHA5nKR2a7qlT0dgjJ8pkjQPLyfiRqAnkc9mJqFCo3OC7bAp48Oc4WwUcTvHWrIM51y4XejUfhr5sb1l0j96QnXy1Wt4a32FgJtCp/GdbPFOMfhJxC7KrIx3G3gVLZxOF/WqqgaSyN7P5YCV1Wxk5rc0eqSVAULVgD6/oZ8ZMRGoSxF2/DWGeeVs+soOeXjnQ+D6ZG/IWaMTEl4WZilUkdxqnW90a0HDSpNysNoek7hciGtmiZZ1bOSmdocfTkaxucweQdXnzKWLXtwvlelh8L0UfeyUa5jgPxmCfX1b8feqIgfRIYqEnir2TluQm/u667gshsbUWU0VvDiEjUS0JxqI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3002001)(3231101)(2400082)(944501161)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:CO1PR02MB141; BCL:0; PCL:0; RULEID:; SRVR:CO1PR02MB141; X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB141; 4:nhbNuBjq4wMfe8niGkZyYTawTuQJKdBEvaSCIG2hXt0E0OmKG1i6I+pIA+o05PRHtTqKddQifQKWd5i8Iona8EwloTgg8i/qs4+91PEJSRCwetg7nitCwTaG4MVp6JcY49bsoPtL0hbuOyuTDdhtBX9aewnjIa4mMlYtg8a2CNGQupO4xf7K5NgKQrI2Uz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o3u6EG8vyFk5ZH0OrUDhu83RkdjaX4jKxejhCvOQRGUCVdppfErGOzj66gCIjEBwSxWnh/v+exoHfNP3VadNnyGVRxEwzXJQwjBwW0dPgqCn41k=; 24:FHgik0j/F34cfi/d2kI8M+BHjDaa3bsyKpikGBAySX94o61uicfh8aTrekdLPykxBYtNQ3P3vSuaQmGQm3P0xUMTAvHTtfqH3oM/f4ypD4Y=; 7:H8PMGEvuMgEoZ/z8P92Iyi56aIb4Y01/PaKit8bcD8eucWNjdUy7M01WTcZMebD3UHJBhbGEu91Ga1aXZnLCRXkjOBJYYMYkNNeeBrHg9OyUsEAUmubac1hveMRkAKYYooGmmN3FxM6K1rtynQ7rmxseaLCEMaUhBAAUaU5TKgIyTAO1VJcRyKAtPTDlP8B8FyvwOKZslqe6Yhc1mgz++nPy/NWRVPemvafA0NBQr0d0alfYqqs4tQgFzmqwzfqh SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2018 16:41:11.1285 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9ef972d-9eb8-42f8-8dac-08d56e4998a1 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: CO1PR02MB141 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 --- Changes in V2: Re based on Linus Master drivers/scsi/aacraid/aacraid.h | 4 + drivers/scsi/aacraid/src.c | 161 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 159 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 0095fcb..c3fdec9 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; @@ -2504,6 +2506,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 @@ -2539,6 +2542,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 fde6b6a..de48845 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; @@ -992,6 +993,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 @@ -1021,8 +1164,10 @@ int aac_srcv_init(struct aac_dev *dev) if (dev->init_reset) { dev->init_reset = false; - if (!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) + if (aac_src_soft_reset(dev)) { + aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET); ++restart; + } } /* @@ -1072,13 +1217,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)) { @@ -1098,7 +1246,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; /*