From patchwork Wed Dec 20 06:56:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125053 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 8D5206019C for ; Wed, 20 Dec 2017 06:57:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 836A529649 for ; Wed, 20 Dec 2017 06:57:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7844D2964F; Wed, 20 Dec 2017 06:57:08 +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 575F729649 for ; Wed, 20 Dec 2017 06:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932392AbdLTG5G (ORCPT ); Wed, 20 Dec 2017 01:57:06 -0500 Received: from mail-by2nam01on0073.outbound.protection.outlook.com ([104.47.34.73]:24389 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932372AbdLTG5B (ORCPT ); Wed, 20 Dec 2017 01:57:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=97EQaimNptFGz9yPoV0K3j8GhtEscIEvjYUf1zqfs64=; b=TZCOTEbLLjlVKwg8SlBHtStk3Bh24ReWNslrFiKXD2CcR8DmSdU77mF0/zi0BdDbFn0gAHjh+BUyOmOV1GeMQAwn4NCih9FyQVvLTZPtmhdgDJ9b7l/h7dqBuXR3ckqyXM3yZKjDPsAPc/pWDdzAOJcj4kujmarzXqRmSjkS24k= Received: from CO2PR07CA0055.namprd07.prod.outlook.com (2603:10b6:100::23) by SN4PR0701MB3822.namprd07.prod.outlook.com (2603:10b6:803:4e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 06:56:59 +0000 Received: from BN1AFFO11FD043.protection.gbl (2a01:111:f400:7c10::179) by CO2PR07CA0055.outlook.office365.com (2603:10b6:100::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.323.15 via Frontend Transport; Wed, 20 Dec 2017 06:56:59 +0000 Authentication-Results: spf=permerror (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD043.mail.protection.outlook.com (10.58.52.190) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Wed, 20 Dec 2017 06:56:45 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Tue, 19 Dec 2017 22:56:45 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id vBK6ukrh021562; Tue, 19 Dec 2017 22:56:46 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6uk7N021561; Tue, 19 Dec 2017 22:56:46 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 04/43] qla2xxx: Use chip reset to bring down laser on unload. Date: Tue, 19 Dec 2017 22:56:05 -0800 Message-ID: <20171220065644.21511-5-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171220065644.21511-1-himanshu.madhani@cavium.com> References: <20171220065644.21511-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39860400002)(39380400002)(396003)(346002)(2980300002)(448002)(199004)(189003)(72206003)(356003)(81156014)(59450400001)(86362001)(1076002)(2950100002)(8676002)(6666003)(81166006)(110136005)(42186006)(87636003)(36756003)(54906003)(16586007)(76176011)(316002)(85326001)(478600001)(51416003)(106466001)(47776003)(8936002)(50226002)(69596002)(48376002)(5660300001)(50466002)(80596001)(4326008)(2906002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3822; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD043; 1:Ct95XyIWKRo15AMN53kQ525WkhaXgwD59vpm6cAbyX0LNcob247hWt0tx7IQLwsV2Cp+y2Gch/U3Y6qfUDmSYCHsx20Sm2uVVePhB2sttrOarOgimfrJTzSF0KEjNFle X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d587c9c-f9c3-4545-d22a-08d54776d5bf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:SN4PR0701MB3822; X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5NdEvhwgTORhGS8mfmZZFlyo6K4WJIsjF6rm8ISvWdCrhkNUOLNrynqgyw/xLU4T7nq/tTNhmVXVhA59uguCZI+ilearirtXZXfDAt9lxGr2UOYBNb7ugl4DGX+4ofH1aO2oeZg12NzoSUInkUqbf7+Hz8cYWTuBsAJB85A7hYsWXhlvnYBkXzFDO4dhSr6u01M8/bhTlULbfHAYI0oR+ADPyOS7+XLD8PtsZHatdGec52HRozm0vVsduAm4rfHgUCenKeFMwD3whIsCpcfQnDXSg+eyhgaAL2qiD9DvKf3tOPglXbejYAHnB5Obvape+XX0JQyFxjD8DcpWIg6LqIsNz7P6+3UxU3VdKPI1p49eBW0/BULXT5GaZZPR22Luj7hDRyA3HvfTzuZl1MWjBM9LtUGIk25gNY9/7aLhrXxaR084bT72l1Z3m0ffojRY36JDuwPl8JWbg4jFqAe+A4P9evh4UlTi0SrD3qo4Ws9AJJJc39s0BaW X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231023)(93006095)(93001095)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN4PR0701MB3822; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3822; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3822; 4:0My4wCvp1bt2EOn++fS3HR8xCKLeC75niAgrjLGrEMUDIXPxh4MtSDWBDd5PeeGd5oLJOYxMazYlrEYyl0pAowpv0XcO2D5r/ER86LszZEjAptxFNHpiW6r4V9bExLebZPU2Ixa9E1zuKF4Kwlcjc442C1dVmYRaqEUf8bmQ1xdUNBf/UhI+gOMh7MmfLboyhVCEScpVwOsCZCaLR5azYLOOWYsvD0hEbBBIi4GpsNQsEMwngL8q/jbaZzVgY8DWeNKO/j7WbTux8hUbXkMWcphSbLi8MdCA4mXfbChUCRfQY1J9SPnHS6x5Vzap8++e X-Forefront-PRVS: 0527DFA348 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN4PR0701MB3822; 23:2t7UqKS1xAaTuvtMU3Y6/cIWE7weRa29nKUbT77?= =?us-ascii?Q?WMDlkaYUp1STlGnRJbs0tHmXQw7/tOvlmN1ooc3MAF+hzCubb+Wii+AewsrS?= =?us-ascii?Q?rL/FkfHPTG79l6IeNEcOYiRcumfGbHgwksP3OWRjZkmfNBSVWHhWWyfPiIr4?= =?us-ascii?Q?IQ7GEc3v0g41BTZdo5Am/cR+fuSx9AFpC9isqafETNcn8WimbHy4YZLmu2An?= =?us-ascii?Q?l9ovewMDq8C1csHeNiMVvGcTZAu7anpV8EIXCs9oMv1Cg3wGCUjjV4YKzMQ0?= =?us-ascii?Q?SaCNODidz6/uCU9xtTECh/FrmU0tsu6zDMwi1WlYtJdbDs2aWWHOwu4aXd/v?= =?us-ascii?Q?j/IjPPQD4jkDJ2PoVLTQdPbXMJUEYxApqg6NvrtHH3ym7x/jWU0QMYSHoaod?= =?us-ascii?Q?MAruHJXmcTqj3p/US3MHm4u6uKrEPFL1Qz4asX1Wp63T5JCyC0rc3OIByDCL?= =?us-ascii?Q?b5lcXWGdDrWCFreCe3pwYIfiA8dbH5Ok1rb3WpuVBrD2dytBcIkZxJ+cHX14?= =?us-ascii?Q?me6Z7EYHIPtmXXHCYEjyCq22RFU795IbdGBlqhWD7sUoQRnjudBmw5obSxqd?= =?us-ascii?Q?21lu1cauf8fI/NL9dWgW0gkQL9VTpz8xx7Opo5N60HlhdgBeTDPY/JC0nxnJ?= =?us-ascii?Q?OWpmC0cDbmsp8Nb7qFxgFgoH2WR4mXaTqnWwFg1SypsaR9MV1lh8HeSzENq1?= =?us-ascii?Q?0kJLrJ6aKYr3qIao3xUuafQT7W9wX7DwXZexpmyBz43i9DWUKTmprjVdTgYR?= =?us-ascii?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swyDNkn4h/EKXw8SNszbBg+nn3r4mJSc/9wkc87A6SGeI9P8XjbcMCTnaKg4FztBb1ZSIbAL2rAi0pww/YDNof8onBGqx+8RlPqmIkDUAvoA0F2YP2Y8ytbE7dYefjABCxG3xMfxZJoABssxdlEgs7JmC1FuxVGIvQNW7oak2iDiZRfvTCcrM67mxKqo1Uoboe2HV1OY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:56:45.7036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d587c9c-f9c3-4545-d22a-08d54776d5bf X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0701MB3822 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 From: Quinn Tran Current code uses Stop Firmware MB cmd to stop the chip before driver unload. This will leave the laser in its current state. This give the illusion of this adapter is still alive. For 8G & newer adapters, use chip reset to stop the chip and bring down the laser. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 52 ++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 789030c9dd26..987bade1c606 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -294,7 +294,6 @@ static int qla2xxx_eh_host_reset(struct scsi_cmnd *); static void qla2x00_clear_drv_active(struct qla_hw_data *); static void qla2x00_free_device(scsi_qla_host_t *); -static void qla83xx_disable_laser(scsi_qla_host_t *vha); static int qla2xxx_map_queues(struct Scsi_Host *shost); static void qla2x00_destroy_deferred_work(struct qla_hw_data *); @@ -3449,8 +3448,13 @@ qla2x00_shutdown(struct pci_dev *pdev) if (ha->eft) qla2x00_disable_eft_trace(vha); - /* Stop currently executing firmware. */ - qla2x00_try_to_stop_firmware(vha); + if (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha)) { + if (ha->flags.fw_started) + qla2x00_abort_isp_cleanup(vha); + } else { + /* Stop currently executing firmware. */ + qla2x00_try_to_stop_firmware(vha); + } /* Turn adapter off line */ vha->flags.online = 0; @@ -3629,10 +3633,6 @@ qla2x00_remove_one(struct pci_dev *pdev) qla84xx_put_chip(base_vha); - /* Laser should be disabled only for ISP2031 */ - if (IS_QLA2031(ha)) - qla83xx_disable_laser(base_vha); - /* Disable timer */ if (base_vha->timer_active) qla2x00_stop_timer(base_vha); @@ -3693,8 +3693,16 @@ qla2x00_free_device(scsi_qla_host_t *vha) if (ha->eft) qla2x00_disable_eft_trace(vha); - /* Stop currently executing firmware. */ - qla2x00_try_to_stop_firmware(vha); + if (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha)) { + if (ha->flags.fw_started) + qla2x00_abort_isp_cleanup(vha); + } else { + if (ha->flags.fw_started) { + /* Stop currently executing firmware. */ + qla2x00_try_to_stop_firmware(vha); + ha->flags.fw_started = 0; + } + } vha->flags.online = 0; @@ -6617,32 +6625,6 @@ qla2xxx_pci_resume(struct pci_dev *pdev) ha->flags.eeh_busy = 0; } -static void -qla83xx_disable_laser(scsi_qla_host_t *vha) -{ - uint32_t reg, data, fn; - struct qla_hw_data *ha = vha->hw; - struct device_reg_24xx __iomem *isp_reg = &ha->iobase->isp24; - - /* pci func #/port # */ - ql_dbg(ql_dbg_init, vha, 0x004b, - "Disabling Laser for hba: %p\n", vha); - - fn = (RD_REG_DWORD(&isp_reg->ctrl_status) & - (BIT_15|BIT_14|BIT_13|BIT_12)); - - fn = (fn >> 12); - - if (fn & 1) - reg = PORT_1_2031; - else - reg = PORT_0_2031; - - data = LASER_OFF_2031; - - qla83xx_wr_reg(vha, reg, data); -} - static int qla2xxx_map_queues(struct Scsi_Host *shost) { int rc;