From patchwork Sat Jan 20 01:01:57 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: 10176185 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 8975360386 for ; Sat, 20 Jan 2018 01:02:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BA8028773 for ; Sat, 20 Jan 2018 01:02:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7051C287A6; Sat, 20 Jan 2018 01:02:15 +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 F397628773 for ; Sat, 20 Jan 2018 01:02:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756070AbeATBCO (ORCPT ); Fri, 19 Jan 2018 20:02:14 -0500 Received: from mail-bl2nam02on0052.outbound.protection.outlook.com ([104.47.38.52]:15104 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756037AbeATBCH (ORCPT ); Fri, 19 Jan 2018 20:02:07 -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=CW38MHOTelEJCJ/maJZcEWtokZYRfgCkj9DgC5wHXDE=; b=WGUFi0RRtc1tD40zkP7RkFf7ytBAecP2tc5I9OYQYE6V6AZXq2DnAeyWgi87YsbBMo3MswCgWOCFNuoZx8HBR21EvU4dyDGA9C10xsopVQR45tZhqvyeA2le/kYzJ+gTOuC2OLSfgjWjQADWH72/4LFBCKCI0/o4uSLtaJkQHas= Received: from MWHPR0201CA0068.namprd02.prod.outlook.com (10.167.160.45) by BY2PR0201MB1829.namprd02.prod.outlook.com (10.163.75.19) 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:05 +0000 Received: from BN1AFFO11FD038.protection.gbl (2a01:111:f400:7c10::197) by MWHPR0201CA0068.outlook.office365.com (2603:10b6:301:73::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Sat, 20 Jan 2018 01:02:04 +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:04 +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 3/3] scsi: aacraid: Auto detect INTx or MSIx mode during sync cmd processing Date: Fri, 19 Jan 2018 17:01:57 -0800 Message-ID: <20180120010157.22674-4-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)(376002)(396003)(39860400002)(39380400002)(346002)(2980300002)(438002)(189003)(199004)(72206003)(77096007)(54906003)(1076002)(5660300001)(26005)(8936002)(47776003)(81156014)(8676002)(478600001)(36756003)(305945005)(2201001)(59450400001)(86362001)(50226002)(69596002)(336011)(356003)(106002)(81166006)(2906002)(110136005)(2950100002)(4326008)(53936002)(106466001)(316002)(57986006)(76506005)(68736007)(16586007)(97736004)(104016004)(50466002)(51416003)(48376002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB1829; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD038; 1:UQEqmzBuH5W90eG4tpk9Mj8/LaINGNTUyfOdy97LiMOS7g2HYJ7kK7gc6oOXepgmZGY79qJaUce9wuAo+imyThUhZqaT9CqOC1Tq+3tgVo5FPY8Yiufupz0IAvS3SOiO X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e7d0d62-6f1c-4233-1eca-08d55fa16bc2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BY2PR0201MB1829; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1829; 3:gN03ZLaUDpAhWlCkHkWiYJUjBA80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X0SSeC929xs9T+Je+AKMg9S770eH4EHFA8qX+rfLnH09mOs7kKYctg/8YzNv+rwrIRPFqNyoReYfBud49v5QTqLTasYooFP+VKUojcgUE42xKFQSmfFdXJZFGQZoZZygFzG60jJa8aq3EPHxYraTQ+rzaFVZkU1U7AqM/YhGbIY4y4IbBGnHj8gslOF2Kyk3da1rgrcUcDgkE6AVCk3Q7Fhq+0sROr5z+sxKuzKYzrnjknKvG9L4pQBItR80jXE96TFWmO4HatpuxG9wS52mu9t7WKGoVU6ed79zWjp3NO4h0wFhbw6Tpp5MvrbNgwsSVwih3/hMYgjWY/zopvXUgcxHl6KrYaLbNh1ZZNls59RyhN2mDRadSZLDUR4z/q09PjTrBmKxlYFQHLrKnyA4NvlWUpUSIGoB11SzTRRiwou30sXfAkqpqBOgo9Oao4ook2lIqO3MHDA+XRxc/wcq2PqFyXSLECjoJQBvKWOmkBb7+gtnxrhxJQ/RJjeyJpEtoAE2jq9gDufNz9f4E00CqHZK/Uw92w8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93004095)(3231023)(2400081)(944501161)(10201501046)(6055026)(6041268)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BY2PR0201MB1829; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0201MB1829; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1829; 4:8+RmqFv8Jcq+18P/OMf7Vimita284nttc3OU1umuckqOk3+m5O/xkvKxFCFBATkSe6efac9TXy09wlJzthqjlqLq1uUvDOWcLUgULBY3Nj3eYyBG37fwqzhmZOoTJaw79GkE1AynwlXsStUrmLySPigWrluzzGGQxgM54jyB3CKtX4CJmwbWbFNrfRN5b5fNrbGWhAyxCRX7onGhjZJWSoHe96SoWcGXf9BebdX2hN5fO1rCTa0WdL1d/NKwcQGxKyVHETTmwkmnPbNVT5vdYyStTM73UpGg857ZVaQ2wuaPEPgAHdY4AKoJcnEsrddD X-Forefront-PRVS: 0558D3C5AC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0201MB1829; 23:4z4563AR30LFxwNMg0401NEpXhXpSuJ8e4BBcrH?= =?us-ascii?Q?iVSbXMHJaZHzXaTWdtHPEnRkJ4tU8461r9zl0H/qv/w+35GDqwISmzdZAlD2?= =?us-ascii?Q?gqBnl/1VJCO8YUK0MI4yp4vXJ/hZHmh+H7lnR1IOb3n4HOkzgNYHPKlz/hZa?= =?us-ascii?Q?hQg2Kij4xQoyrI62GNAU3dH2IYAodzWYmsfj2l+rIon8BKhYmVouUXuL3t8I?= =?us-ascii?Q?6ruTIoWiUJdJi3d2/jx9tWhFo3jIpl/Pb1h3Wy6QBQj04PBqMeSj90IKro4t?= =?us-ascii?Q?GxnQnUv90b6F0mCKM8PbqvGI568YUBKnfE8rqVb2fMHC3SX92wNfViPJoJaD?= =?us-ascii?Q?GX3ZR0J5XGxwvz4Sfyu5dbcILHMKlng6imJfxLiFVa5TkIHQm3oh/qDRrkIC?= =?us-ascii?Q?qak58ZlBgfgDf0Wpg6/JuDsF197xH8yr2suUHThKZOW71AfGMLKPrK/EJh0M?= =?us-ascii?Q?AQz9+T1QMJV0lwPq6mlRuMBW2TbDWybyAKmnwcmYRDruCd4Mpy1zzoUORt4G?= =?us-ascii?Q?JoUt7RKpj+vo1L3ZfHsGS0/l5m8ET5g3QZyZwEIqVH39Qa4XnqXuw7RFVYwY?= =?us-ascii?Q?Uf6wf70aGyL/5flYMjPspFGwlSayRgkNFpH3V3StsQwlKKwcULgk7/FC4BeD?= =?us-ascii?Q?XZN+q25Bg33Xbxcc0YnQEnA4vPG95fkWRdcnqZc+v1T9xdLdbgjJljAkyDtZ?= =?us-ascii?Q?dOClOIS6hm69rqAou1WCwQVdIsHy87njky5rnbgjmTq2uPQZjm3KKqsiuM6f?= =?us-ascii?Q?ufPcayVlU7QTok1KkahYkT63iyjj0sT/1VvOud9RP3I4fu1mqBsxERU8+ZAw?= =?us-ascii?Q?UmiStK49r7V04jKsGAaM4ooXM6R5EwrhH90rrW6KcZOZXt9g0419qvNpszGe?= =?us-ascii?Q?h2cRjm+Wgo7D6D8XvTdECWLHquNO3OEC/G/WKU1jdayhPNC1D6dr8ByrG5HO?= =?us-ascii?Q?uoazEZijN9BKwNZ2tRXfspOL/BZH253s8n/KIKF9R8AXUlGgqmRojjb8O4Gl?= =?us-ascii?Q?SR0WX+pLShOrglUtGNd9BHHqKWJpTyzmYAuZmtf1Wl53q6mIAjZgrqCDFyg1?= =?us-ascii?Q?1QLePJazofVobFpuXBNIduSa+W5774oT5WqQlvLNu5/2Rb8hsnjEORWroi58?= =?us-ascii?Q?jcPgGhlQOTXI=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1829; 6:RN4dVVtLXlnC4LkbjTIgnbww9TKKG1+bI1Fw7lqEKrk8Cs8XP1CL4ZU7ej/aWztF2eBNsgn1W20DeHl3WzlSMfuHpyiZPDaFSYjRDXqrT5py7V5kMbQ967gU0IFv3BUvQ5p0iYzIaPY6NFYivS73enqtV3rfxnnlN0E7JqopsNfgyrqxehhHEb3vUDg0iVGGFae/MmWArzZkn9lA155lHTFocEVWVQlM9af5X64MisZzECfoor0NpUV/Lo4nzd0XGbGOTGQOoNtVRZ0wwQD2DzzDu3FA0Q8dkuSJ0vjz4tvForz1urz6UfcoZ/hGizCm5M50lVrcpvhZOuNGg7F5etricSryC7nCuxRg9288Y/o=; 5:epe35uru9C9ljWlCwLlu+ya3XXQA/O8gmSTlBe38imOF9dme5d6hulAOe+60Agf3XNrOvyeG+AWQ/9+56L9QbWm3gF3HHPirRTO18vsz/eTO55zshJE18QpUDYUbfAA951GSy60GxrouQ2mScCkZJYmUHtjyHumwky1JeQCzodc=; 24:Qz/67W36FkSBib/WvWQnyLUghR06zaR/X5/UWGPLGpZwNUMab4CvjyheVsotKNYKwe3d6STqflDdwqp1p0uCFjr1DFv93jEyE1fdmcysg18=; 7:MM21tpXl9gzU0Gvo2dSuvqMYhWP3219PAHpCs0tZP7j9CcDrGJDRDrRtanj3NwijbAKui1Zx5SUPXDAi1/f3zs1PJ0xVvptdR5Q1qLv8YVOGb6Jk1uEUu4FSEd0kLW2hCZ4UDV5UQncLBxf7zoIOdf7wT76dBY5G8mR35PjvbI6DKvjBhUW1zf02B/DXciIS4HLaLxSYlzVFr8ITEIi/aVPtPwXUpE3fI7ZSEZAxAj5hz4lJaZE7Y4hU4D+Euh+K SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2018 01:02:04.0994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e7d0d62-6f1c-4233-1eca-08d55fa16bc2 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: BY2PR0201MB1829 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 During sync command processing if legacy INTx status indicates command is not completed, sample the MSIx register and check if it indicates command completion, set controller MSIx enabled flag. Signed-off-by: Prasad B Munirathnam Signed-off-by: Raghava Aditya Renukunta Reviewed-by: Dave Carroll --- drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/src.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 784783b..7834d09 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1231,6 +1231,7 @@ struct src_registers { #define SRC_ODR_SHIFT 12 #define SRC_IDR_SHIFT 9 +#define SRC_MSI_READ_MASK 0x1000 typedef void (*fib_callback)(void *ctxt, struct fib *fibctx); diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index b05c3cf..f9600b6 100644 --- a/drivers/scsi/aacraid/src.c +++ b/drivers/scsi/aacraid/src.c @@ -1399,13 +1399,23 @@ void aac_src_access_devreg(struct aac_dev *dev, int mode) static int aac_src_get_sync_status(struct aac_dev *dev) { + int msix_val = 0; + int legacy_val = 0; - int val; + msix_val = src_readl(dev, MUnit.ODR_MSI) & SRC_MSI_READ_MASK ? 1 : 0; - if (dev->msi_enabled) - val = src_readl(dev, MUnit.ODR_MSI) & 0x1000 ? 1 : 0; - else - val = src_readl(dev, MUnit.ODR_R) >> SRC_ODR_SHIFT; + if (!dev->msi_enabled) { + /* + * if Legacy int status indicates cmd is not complete + * sample MSIx register to see if it indiactes cmd complete, + * if yes set the controller in MSIx mode and consider cmd + * completed + */ + legacy_val = src_readl(dev, MUnit.ODR_R) >> SRC_ODR_SHIFT; + if (!(legacy_val & 1) && msix_val) + dev->msi_enabled = 1; + return legacy_val; + } - return val; + return msix_val; }