From patchwork Wed Dec 27 04:34: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: 10133429 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 37C206037D for ; Wed, 27 Dec 2017 04:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 204D22DA63 for ; Wed, 27 Dec 2017 04:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 150342DAA2; Wed, 27 Dec 2017 04:35:48 +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 902212DA63 for ; Wed, 27 Dec 2017 04:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751879AbdL0Efq (ORCPT ); Tue, 26 Dec 2017 23:35:46 -0500 Received: from mail-sn1nam01on0041.outbound.protection.outlook.com ([104.47.32.41]:60976 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751798AbdL0EfW (ORCPT ); Tue, 26 Dec 2017 23:35:22 -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=v18YRBydvP4cbOGIBhZXpo0l+Co7MmqSrZlZDzRCNyY=; b=PdYNHKXiUENpDJhMgNAEl4b75Y+U7id/hEM/O8nj/HniRkdhfs4vHDgpL1f7NZeC+LtMoKknu7nkV+4IpEiN0n7wwvudZSU0fkN8eh1R5R86pxzlZV5MX2VkOgFpn5saUkkSRwsJvbzenBUiieRpKkcmwiDHVAG6NRFlh21GWTc= Received: from CY4PR02CA0009.namprd02.prod.outlook.com (2603:10b6:903:18::19) by BN1PR0201MB0739.namprd02.prod.outlook.com (2a01:111:e400:56::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Wed, 27 Dec 2017 04:35:18 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::162) by CY4PR02CA0009.outlook.office365.com (2603:10b6:903:18::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Wed, 27 Dec 2017 04:35:18 +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 BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Wed, 27 Dec 2017 04:34:58 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 26 Dec 2017 20:35:00 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH v2 24/30] scsi: aacraid: Use hotplug handling function in place of scsi_scan_host Date: Tue, 26 Dec 2017 20:34:45 -0800 Message-ID: <20171227043451.27813-25-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171227043451.27813-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171227043451.27813-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)(346002)(376002)(39850400004)(39380400002)(396003)(2980300002)(438002)(199004)(189003)(6666003)(59450400001)(316002)(478600001)(106466001)(69596002)(53936002)(48376002)(104016004)(50466002)(4326008)(2906002)(86362001)(47776003)(97736004)(2201001)(77096006)(5660300001)(68736007)(106002)(2950100002)(305945005)(81156014)(356003)(36756003)(8676002)(57986006)(81166006)(1076002)(8936002)(76176011)(16586007)(72206003)(110136005)(76506005)(51416003)(50226002)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0739; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:sJzprMwHJV2+jZEI0XIwM7EeomGtlBoAQ9Oz6qCgCROUzNCphI8ZFXARWbmjbE2g9SG0y9U7uflZh1ljrfPKLlf0jtwZYfh+HfnVM0vLHAZwhuRZUE5jN2x40s0axLEM X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d984e9ef-5de9-480c-6513-08d54ce33004 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BN1PR0201MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0739; 3: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Y+enuaaIayy9QXfR+jdmlXrW98g58eL7O4pixutB+gHTW35YyRK4HguxTG5Tdb2T4GeT1drmmD058F7Ms4yYemmohiYDg2skURJnaOyW94xTtC/PT2dBWTE6b2CK1ZQN5GuJ2gNbZJLnWp/sG2uvM6o+s0EWDPqDp+JHDIWIo1cMTnvPkfjel0Ox5AErd2ex0mVGPrcax3BknANS6Wv4/LdcFu5OOPvvOgU6Jq+3jC0CJeuJZy1ggWcRD7LuAjdeVvJZJHAzIwL1c3FJndVXWnkEb95e9RXQ6N9eC5Mcz2qXMYHNacfL7gryx+gVzNBeFnMxjd742H6fIZIH+DgvEAnzx1BxttVQWrpqZpwE3v2fTWCkbDeUIPe/uaiuTMVIyz3NQeOkdKqAUGdoSYO/CcI3VqmhbVp5IYHltnYCZuyIlGv2JPkHkMF086G2wN13OdSguLSJW0DH4d1e2yXQfA3Fec+6wujInc6zi7VByzprIK2n2UZczbZFqK6948yLuC8LWgBfhf/x3D+lDEYocV6NiCFZ9Xp/Ksn/rYL1HY= 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)(10201501046)(3002001)(3231023)(944501075)(93006095)(93004095)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:BN1PR0201MB0739; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN1PR0201MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0739; 4:/2n6w8Dl2tmTYAqo8a9EFEub0RYIvMZjBm4pgZ8Blm1qggDMDRsN0nzrNhKLM5nYSYF2/UpknonBVbm+fsVE65iBNxNTrpDPdl8NqAJ6ff/oxMMMQykDSUCN8AVO09pfeCkyy6VsAjoNbc+Kb4Sg5g3aOP+7iiIqN2Cny8ODZUPMG+J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rdyPomvavM9Vhl8uQImKafj0a7gZffvciEfM76BjcagPDX1Ndy7arSvpAJ5iLvnQ=; 24:mn3CVyE7oFE8GY3P3ABIbbY75oK+10XnZrQ3PThcGVc/UnlJ5Uz/r0c0NdUbIR3DE7MA501txk83QqT8pku1cHuJTl9j98zedqRxh4xcaTQ=; 7:PyPWFoMNOhfYTJCXSGQYA86CtUz7mLzzwGGpgFc894W4DWsTV/j04AjU+skkAbudZ7LdLhUizIDCoZQyqEjw4HlFyK2sZ1xdcEJFvqSMgckbc/cyAUhhGIUhsDuzbBnZk8nYDvo2lx7Wj9E1R0FFXcLOFF65bygE1ERd+Av9A5SkbyWNwv105VexySfrwQbgg7DHUP46JZbKAr61IG8snUvzU9K5eDYpx7srqZNwtaU7VJEpcpFKEgJkwTV/NqWp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:58.6398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d984e9ef-5de9-480c-6513-08d54ce33004 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: BN1PR0201MB0739 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 Driver uses scsi_scan_host to add new devices in the driver init path, which adds all the fw exposed devices. The drivers resorts to queue command checks to block out commands to _hidden_ devices. Use the hotplug handler code to add new devices during driver init and other areas, this is only for safw. For ARC scsi_scan_host will still apply. Signed-off-by: Raghava Aditya Renukunta --- Changes in V2: None drivers/scsi/aacraid/aachba.c | 4 ---- drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commsup.c | 18 +++++++++++++++--- drivers/scsi/aacraid/linit.c | 5 +++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 4ad9d3f..426c61a 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -2150,10 +2150,6 @@ int aac_get_adapter_info(struct aac_dev* dev) dev->maximum_num_channels = le32_to_cpu(bus_info->BusCount); } - if (!dev->sync_mode && dev->sa_firmware && - dev->supplement_adapter_info.virt_device_bus != 0xffff) - rcode = aac_setup_safw_adapter(dev, AAC_INIT); - if (!dev->in_reset) { char buffer[16]; tmp = le32_to_cpu(dev->adapter_info.kernelrev); diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index c70c998..ba84d99 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2719,6 +2719,7 @@ static inline int aac_supports_2T(struct aac_dev *dev) return (dev->adapter_info.options & AAC_OPT_NEW_COMM_64); } +int aac_scan_host(struct aac_dev *dev, int rescan); char * get_container_type(unsigned type); extern int numacb; extern char aac_driver_version[]; diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 491e633..4e2687c 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1964,6 +1964,19 @@ static int aac_update_safw_host_devices(struct aac_dev *dev, int rescan) return rcode; } +int aac_scan_host(struct aac_dev *dev, int rescan) +{ + int rcode = 0; + + mutex_lock(&dev->scan_mutex); + if (dev->sa_firmware) + rcode = aac_update_safw_host_devices(dev, rescan); + else + scsi_scan_host(dev->scsi_host_ptr); + mutex_unlock(&dev->scan_mutex); + return rcode; +} + /** * aac_handle_sa_aif Handle a message from the firmware * @dev: Which adapter this fib is from @@ -1997,9 +2010,8 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) case SA_AIF_LDEV_CHANGE: case SA_AIF_BPCFG_CHANGE: - mutex_lock(&dev->scan_mutex); - aac_update_safw_host_devices(dev, AAC_RESCAN); - mutex_unlock(&dev->scan_mutex); + aac_scan_host(dev, AAC_RESCAN); + break; case SA_AIF_BPSTAT_CHANGE: diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 2c862cd..7ea7b2c 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1787,7 +1787,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) error = scsi_add_host(shost, &pdev->dev); if (error) goto out_deinit; - scsi_scan_host(shost); + + aac_scan_host(aac, AAC_INIT); pci_enable_pcie_error_reporting(pdev); pci_save_state(pdev); @@ -2071,7 +2072,7 @@ static void aac_pci_resume(struct pci_dev *pdev) if (sdev->sdev_state == SDEV_OFFLINE) sdev->sdev_state = SDEV_RUNNING; scsi_unblock_requests(aac->scsi_host_ptr); - scsi_scan_host(aac->scsi_host_ptr); + aac_scan_host(aac, AAC_RESCAN); pci_save_state(pdev); dev_err(&pdev->dev, "aacraid: PCI error - resume\n");