From patchwork Wed Sep 5 05:46:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas G X-Patchwork-Id: 10588269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF585679F for ; Wed, 5 Sep 2018 05:47:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFF042997C for ; Wed, 5 Sep 2018 05:47:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B27CC29984; Wed, 5 Sep 2018 05:47: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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 02E292997C for ; Wed, 5 Sep 2018 05:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726340AbeIEKPn (ORCPT ); Wed, 5 Sep 2018 06:15:43 -0400 Received: from mail-eopbgr710050.outbound.protection.outlook.com ([40.107.71.50]:50839 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726273AbeIEKPn (ORCPT ); Wed, 5 Sep 2018 06:15:43 -0400 Received: from MWHPR0201CA0033.namprd02.prod.outlook.com (2603:10b6:301:74::46) by BN7PR02MB4034.namprd02.prod.outlook.com (2603:10b6:406:fe::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 5 Sep 2018 05:47:12 +0000 Received: from BN1AFFO11FD024.protection.gbl (2a01:111:f400:7c10::164) by MWHPR0201CA0033.outlook.office365.com (2603:10b6:301:74::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1101.17 via Frontend Transport; Wed, 5 Sep 2018 05:47:11 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.22) 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.22 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.22; helo=AVMBX2.microsemi.net; Received: from AVMBX2.microsemi.net (208.19.100.22) by BN1AFFO11FD024.mail.protection.outlook.com (10.58.52.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.1122.11 via Frontend Transport; Wed, 5 Sep 2018 05:47:11 +0000 Received: from AVMBX2.microsemi.net (10.100.34.32) by AVMBX2.microsemi.net (10.100.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 4 Sep 2018 22:46:49 -0700 Received: from localhost (10.187.72.82) by avmbx2.microsemi.net (10.100.34.32) with Microsoft SMTP Server id 15.1.1531.3 via Frontend Transport; Tue, 4 Sep 2018 22:46:49 -0700 From: Viswas G To: CC: , , , , Subject: [PATCH 1/4] pm80xx : Fix for phy enable/disable functionality. Date: Wed, 5 Sep 2018 11:16:42 +0530 Message-ID: <20180905054645.19224-2-Viswas.G@microsemi.com> X-Mailer: git-send-email 2.19.0-rc1 In-Reply-To: <20180905054645.19224-1-Viswas.G@microsemi.com> References: <20180905054645.19224-1-Viswas.G@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.22;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(346002)(376002)(136003)(2980300002)(438002)(199004)(189003)(316002)(69596002)(1076002)(6916009)(476003)(53936002)(68736007)(478600001)(76176011)(86362001)(6666003)(51416003)(4326008)(2906002)(81166006)(36756003)(48376002)(81156014)(97736004)(2870700001)(26005)(2616005)(5024004)(336012)(54906003)(106002)(446003)(76506005)(8676002)(57986006)(50466002)(126002)(356003)(5660300001)(50226002)(486006)(11346002)(305945005)(106466001)(186003)(8936002)(47776003)(77096007)(2351001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR02MB4034;H:AVMBX2.microsemi.net;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD024;1:RQuNI9O3P6UzH0uvQY87E/oizno6L+CZO+loNDWw/IkLKN+5ga4MBAycCxnx/H1H/M46Q6sFb0TBx9mX6suU/MtXqaxzZrpddf3Z2OMHvpY1CdPkaRRE0JIBpLFxQw5h X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67343ffe-1103-4f8c-9ff8-08d612f30672 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:BN7PR02MB4034; X-Microsoft-Exchange-Diagnostics: 1;BN7PR02MB4034;3:1NTA7vEqBCVmtwFF1PZojUuYuUQ41kA0g7aB5rTGvz3OMoLhkqh3/Hjm7NiZFDTOAN/Z3DIkIexRpLce6MNMCbhEwK3BA5FPyWCqvsKFZqfWmqazAlhsJZhkgLQxKrjUhP2Dm0/804CepVsGIEDA4jaUP2a6CbvfRLUN7EXMvB2Sc/rSJBSL4qEAEfrGRpaUt3jWh4wdylLxwYiYOuXApxNzxmHRtv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mexQ2JnM14AZ+mCMS/1+jJ6wSYZW8TD3QlvIggqOIdOwe77G6LFoSP874b0Iyi4sPSdJQY1LYn7lv3St/c+mr2Rn5keT91/RtHjOljOUvChL5e3rNIu4Sj08g+tQmOSh3bzu9YHmm+mqsv5gmZ8plfl8TTn2Tp1xBmur/fNAKuFUSVFhhsTltBiyS+J9MKXoYDjYIjGQvzUypEAB7sMo6ekQ46I7CUilHk92YMDFiz2bWE70SwAY2GdgmFwnTquTEY0xHw2yivoe960mzJf52S3E1dLrjgpyB2ExoztoPvHOq7aMpq9U7EAYwDoKPz5O9FILoBpFzi83bOk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93004095)(3002001)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699016);SRVR:BN7PR02MB4034;BCL:0;PCL:0;RULEID:;SRVR:BN7PR02MB4034; X-Microsoft-Exchange-Diagnostics: 1;BN7PR02MB4034;4:EBEOnPV8QQha8TgFhe9WqaCuUCI6gST6PmxyhRwhxmxTJlhw3Rfdw17DmiYC/+yy8sN0ykAyD93v+lRfG5/JaMcUNFbuVSyH2MzK6bEzmEfB7c42g0U86B+ISb5G1gIWfrWLcHgszZZ8On2aI8HwA4b8QsS5yXzQKX9tUxumE6HUNsm8COJVjEw1CmB8ewVaxnxgRs0sTrDX1hMIKN3hSpy2R3bvVl86FYGk0c3F+m6gJAFoqIabiNycy0l7bVmrTWHp5ThhbYTmVvVuvuNavQ== X-Forefront-PRVS: 078693968A X-Microsoft-Exchange-Diagnostics: 1;BN7PR02MB4034;23:2KaYNFZXrKL3Iy9MSwdAonid0NA1pryRv5tJ+hEsSUN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zpzKthzU1lbRubxAbNKANvUCsXCBBvOsp3ef5OCIRqjjSH9wlkF7uS1kgiabai4KUFYKs6rkfKZWS5UQ=;7:NzwfPjRXO8CyvCEvPkOCrctqmRcr1jT2irmgHTzTq4sJ71prRWSZ6QmH7tchBSpLdnpI7EEEwAl0VEaUzNsKtsFRR54hjNATf+yNxlvqx036RVZ1nbUIePdoUBs5+yqr+sJ8zaKlnIlTYBOA2ywUrv9UGG+mVVaxjrKhsuHhMr8tEd7pxk/1Pw+RAZYzDhwHaqZOU37qGsDHHsCrFePTSpWYVDVur6X1hi6YeOPyxT+n6a58cC2GSS2+8O9Z+WLf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2018 05:47:11.1844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67343ffe-1103-4f8c-9ff8-08d612f30672 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.22];Helo=[AVMBX2.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB4034 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: Deepak Ukey Added proper mask for phy id in mpi_phy_stop_resp(). Signed-off-by: Deepak Ukey Signed-off-by: Viswas G --- drivers/scsi/pm8001/pm8001_defs.h | 7 +++++++ drivers/scsi/pm8001/pm8001_hwi.c | 4 ++-- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/pm8001/pm8001_sas.c | 16 +++++++++++++--- drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++--- drivers/scsi/pm8001/pm80xx_hwi.h | 4 ++++ 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_defs.h b/drivers/scsi/pm8001/pm8001_defs.h index 199527d..6b8bc66 100644 --- a/drivers/scsi/pm8001/pm8001_defs.h +++ b/drivers/scsi/pm8001/pm8001_defs.h @@ -132,4 +132,11 @@ enum pm8001_hba_info_flags { PM8001F_RUN_TIME = (1U << 1), }; +/** + * Phy Status + */ +#define PHY_LINK_DISABLE 0x00 +#define PHY_LINK_DOWN 0x01 +#define PHY_LINK_UP 0x02 + #endif diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 4dd6cad..fcfb4f7 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -3829,7 +3829,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) pm8001_printk("HW_EVENT_PHY_STOP_STATUS " "status = %x\n", status)); if (status == 0) - phy->phy_state = 0; + phy->phy_state = PHY_LINK_DISABLE; break; case HW_EVENT_SATA_SPINUP_HOLD: PM8001_MSG_DBG(pm8001_ha, @@ -3841,7 +3841,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) pm8001_printk("HW_EVENT_PHY_DOWN\n")); sas_ha->notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL); phy->phy_attached = 0; - phy->phy_state = 0; + phy->phy_state = PHY_LINK_DISABLE; hw_event_phy_down(pm8001_ha, piomb); break; case HW_EVENT_PORT_INVALID: diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 7a697ca..3dca1dc 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -121,7 +121,7 @@ static void pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, int phy_id) { struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; struct asd_sas_phy *sas_phy = &phy->sas_phy; - phy->phy_state = 0; + phy->phy_state = PHY_LINK_DISABLE; phy->pm8001_ha = pm8001_ha; sas_phy->enabled = (phy_id < pm8001_ha->chip->n_phy) ? 1 : 0; sas_phy->class = SAS; diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 947d601..96b173f 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -157,9 +157,12 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, int rc = 0, phy_id = sas_phy->id; struct pm8001_hba_info *pm8001_ha = NULL; struct sas_phy_linkrates *rates; + struct sas_ha_struct *sas_ha; + struct pm8001_phy *phy; DECLARE_COMPLETION_ONSTACK(completion); unsigned long flags; pm8001_ha = sas_phy->ha->lldd_ha; + phy = &pm8001_ha->phy[phy_id]; pm8001_ha->phy[phy_id].enable_completion = &completion; switch (func) { case PHY_FUNC_SET_LINK_RATE: @@ -172,7 +175,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, pm8001_ha->phy[phy_id].maximum_linkrate = rates->maximum_linkrate; } - if (pm8001_ha->phy[phy_id].phy_state == 0) { + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); wait_for_completion(&completion); } @@ -180,7 +183,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, PHY_LINK_RESET); break; case PHY_FUNC_HARD_RESET: - if (pm8001_ha->phy[phy_id].phy_state == 0) { + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); wait_for_completion(&completion); } @@ -188,7 +191,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, PHY_HARD_RESET); break; case PHY_FUNC_LINK_RESET: - if (pm8001_ha->phy[phy_id].phy_state == 0) { + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); wait_for_completion(&completion); } @@ -200,6 +203,13 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, PHY_LINK_RESET); break; case PHY_FUNC_DISABLE: + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_UP) { + sas_ha = pm8001_ha->sas; + sas_phy_disconnected(&phy->sas_phy); + sas_ha->notify_phy_event(&phy->sas_phy, + PHYE_LOSS_OF_SIGNAL); + phy->phy_attached = 0; + } PM8001_CHIP_DISP->phy_stop_req(pm8001_ha, phy_id); break; case PHY_FUNC_GET_EVENTS: diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 42f0405..17e74a3 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -3384,13 +3384,14 @@ static int mpi_phy_stop_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) u32 status = le32_to_cpu(pPayload->status); u32 phyid = - le32_to_cpu(pPayload->phyid); + le32_to_cpu(pPayload->phyid) & 0xFF; struct pm8001_phy *phy = &pm8001_ha->phy[phyid]; PM8001_MSG_DBG(pm8001_ha, pm8001_printk("phy:0x%x status:0x%x\n", phyid, status)); - if (status == 0) - phy->phy_state = 0; + if (status == PHY_STOP_SUCCESS || + status == PHY_STOP_ERR_DEVICE_ATTACHED) + phy->phy_state = PHY_LINK_DISABLE; return 0; } diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h index 889e69c..49fb769 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.h +++ b/drivers/scsi/pm8001/pm80xx_hwi.h @@ -170,6 +170,10 @@ #define LINKRATE_60 (0x04 << 8) #define LINKRATE_120 (0x08 << 8) +/*phy_stop*/ +#define PHY_STOP_SUCCESS 0x00 +#define PHY_STOP_ERR_DEVICE_ATTACHED 0x1046 + /* phy_profile */ #define SAS_PHY_ANALOG_SETTINGS_PAGE 0x04 #define PHY_DWORD_LENGTH 0xC From patchwork Wed Sep 5 05:46:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas G X-Patchwork-Id: 10588265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD03214E0 for ; Wed, 5 Sep 2018 05:47:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFB302997C for ; Wed, 5 Sep 2018 05:47:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B21A929984; Wed, 5 Sep 2018 05:47:03 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 2AAA22997C for ; Wed, 5 Sep 2018 05:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726273AbeIEKPb (ORCPT ); Wed, 5 Sep 2018 06:15:31 -0400 Received: from mail-eopbgr700069.outbound.protection.outlook.com ([40.107.70.69]:27399 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726189AbeIEKPb (ORCPT ); Wed, 5 Sep 2018 06:15:31 -0400 Received: from CY4PR02CA0010.namprd02.prod.outlook.com (2603:10b6:903:18::20) by SN6PR02MB5310.namprd02.prod.outlook.com (2603:10b6:805:71::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.18; Wed, 5 Sep 2018 05:46:58 +0000 Received: from BY2FFO11FD012.protection.gbl (2a01:111:f400:7c0c::168) by CY4PR02CA0010.outlook.office365.com (2603:10b6:903:18::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1101.15 via Frontend Transport; Wed, 5 Sep 2018 05:46:58 +0000 Authentication-Results: spf=pass (sender IP is 208.19.99.222) 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.99.222 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.99.222; helo=AUSMBX2.microsemi.net; Received: from AUSMBX2.microsemi.net (208.19.99.222) by BY2FFO11FD012.mail.protection.outlook.com (10.1.14.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.1122.11 via Frontend Transport; Wed, 5 Sep 2018 05:46:57 +0000 Received: from AUSMBX3.microsemi.net (10.201.34.33) by AUSMBX2.microsemi.net (10.201.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Wed, 5 Sep 2018 00:46:52 -0500 Received: from localhost (10.187.72.82) by ausmbx3.microsemi.net (10.201.34.33) with Microsoft SMTP Server id 15.1.1531.3 via Frontend Transport; Wed, 5 Sep 2018 00:46:52 -0500 From: Viswas G To: CC: , , , , Subject: [PATCH 2/4] pm80xx : Corrected dma_unmap_sg() parameter. Date: Wed, 5 Sep 2018 11:16:43 +0530 Message-ID: <20180905054645.19224-3-Viswas.G@microsemi.com> X-Mailer: git-send-email 2.19.0-rc1 In-Reply-To: <20180905054645.19224-1-Viswas.G@microsemi.com> References: <20180905054645.19224-1-Viswas.G@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.99.222;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(136003)(376002)(39860400002)(346002)(2980300002)(438002)(199004)(189003)(97736004)(48376002)(14444005)(446003)(486006)(126002)(2351001)(2616005)(50466002)(11346002)(476003)(57986006)(69596002)(336012)(478600001)(106466001)(76506005)(186003)(5660300001)(54906003)(106002)(51416003)(316002)(76176011)(53936002)(26005)(81166006)(8936002)(2906002)(50226002)(68736007)(6666003)(77096007)(2870700001)(6916009)(81156014)(1076002)(8676002)(4326008)(305945005)(86362001)(36756003)(356003)(47776003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR02MB5310;H:AUSMBX2.microsemi.net;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD012;1:q+X93P8sS9/PmKPRpsP4FxakbdTA/aXkXfX5L2Nz6qTRyFD+eRyGCPrnQxX2u50hsXFRA4bDU+b8aIPgJgYAXvP/VVGimKTM6fbe8rOvVQP5++5+4ZcXqaKpTqyo8MrB X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc28531d-9ce8-40f5-a866-08d612f2fe84 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR02MB5310; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB5310;3:IfaPrYTgAeTCFpRjMJyG3KhfmJEbB36EcptGrr+quZM1I3RkPphxnHZbVNe1NhwHfh0IjKUQaYMcTMIYfogfu7+FTT9Xu4YZ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ssL5G+TKgK8ck78jzHejiAFhSbJNCdAlpbuUPQlAl/2tLM6d8rbYZ3hoeCeF0TzbTah2PWZR15uWE42VyZxWczvxHvHXiD0sXoFaI4FA7G7U6EgYYVDA9I+brJ1p9s61ljyXj7YoW1Eic9ePvsQhxlYT+XTKXzRp9Z7G52zKgW9JbZCKn7H8yBMpjuYr9BkbymRHRTa4RnUCZUdAkaRq2wmPzAvyqKHrhvVvTjhT1e8NTGZS0HJYnO8e7MWVIR9mK7zrS1XbrnOaI7vncitHJysF75NTXZ9Ka8BJDOZ31YmpgJltcFe9wyJvKWJ2flMgi5lzqXRgabsdAD3p5045PiNvvnI6Fx X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231311)(944501410)(52105095)(93006095)(93004095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699016);SRVR:SN6PR02MB5310;BCL:0;PCL:0;RULEID:;SRVR:SN6PR02MB5310; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB5310;4:DPoUn68awG8JYlisv7kJqwTzvSRRfAAimQcPHcOSQ+Mm8CHnU0yOwC0G/yg8gl/eDL+3UmTzy9Gj+U0KY2gHP1AxBM3zrQvq6QuU63wsbjN5WVLeaM/7+GYP3kaejc1SI4F5iT5lgPqn1zb783Oov6X0NetmYTI89/RtWoiScWUhvMjLUIzou6I/BPBHox/0ynBmc5LClxZ9GK6+TkcN1i0L3RLF3fl2JQlPP9mmwgdZRQThdwB4UmaH7Uc0F2XNnSBxpWngM1RKXwnx0NXFk5JC/CYSuQOnVUslZT6ukU/ob7mZckpRHz2ouK4g3qX+ X-Forefront-PRVS: 078693968A X-Microsoft-Exchange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vOrLTaInA6joDH+TK0iuVtr+XLjQEIa7MfQxM2O5LkzVAZofk0bPZH2RBf42lqtxfaGV1C92hYzXWsUx2x0wDa41lNhKqrOrYaHtXdKJUuvB/8//Iq3/ozSjefLRye/BUoEhs5Q=;7:lIcjHwG1ZUHJ1Pb+3twvzF89YHFhggy/MeKM56wW7KUfnYwCo5YlpC18jomiUh487FvsvssO+Rky/z4bvSChjRD+g/0N5hLatB6CjrzdUtsrhIU8cgFnPV66QeZn/J+N7ZoZQ1ff6n0m6UnmgEUIPbBBhoby5Ol4/E2OMoopiqrVaUUNPcS7/S+LuBNFtLggcqPjeiGsgvkhhApgh9w8rOnqxCepRTLXKI4TxMIYi+U733enHTzxpqljkHl3N7UP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2018 05:46:57.9745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc28531d-9ce8-40f5-a866-08d612f2fe84 X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad;Ip=[208.19.99.222];Helo=[AUSMBX2.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5310 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: Deepak Ukey For the function dma_unmap_sg(), the parameter should be number of elements in the scatter list prior to the mapping, not after the mapping. Signed-off-by: Deepak Ukey Signed-off-by: Viswas G Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_sas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 96b173f..719233c 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -476,7 +476,7 @@ static int pm8001_task_exec(struct sas_task *task, dev_printk(KERN_ERR, pm8001_ha->dev, "pm8001 exec failed[%d]!\n", rc); if (!sas_protocol_ata(t->task_proto)) if (n_elem) - dma_unmap_sg(pm8001_ha->dev, t->scatter, n_elem, + dma_unmap_sg(pm8001_ha->dev, t->scatter, t->num_scatter, t->data_dir); out_done: spin_unlock_irqrestore(&pm8001_ha->lock, flags); From patchwork Wed Sep 5 05:46:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas G X-Patchwork-Id: 10588273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F14D14E0 for ; Wed, 5 Sep 2018 05:47:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80B362997C for ; Wed, 5 Sep 2018 05:47:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 748C129984; Wed, 5 Sep 2018 05:47:24 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 B91642997C for ; Wed, 5 Sep 2018 05:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726372AbeIEKPw (ORCPT ); Wed, 5 Sep 2018 06:15:52 -0400 Received: from mail-dm3nam03on0055.outbound.protection.outlook.com ([104.47.41.55]:28288 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726273AbeIEKPw (ORCPT ); Wed, 5 Sep 2018 06:15:52 -0400 Received: from BN6PR02CA0077.namprd02.prod.outlook.com (2603:10b6:405:60::18) by SN6PR02MB4045.namprd02.prod.outlook.com (2603:10b6:805:2c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 5 Sep 2018 05:47:13 +0000 Received: from BN1AFFO11FD018.protection.gbl (2a01:111:f400:7c10::183) by BN6PR02CA0077.outlook.office365.com (2603:10b6:405:60::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1101.14 via Frontend Transport; Wed, 5 Sep 2018 05:47:13 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.22) 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.22 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.22; helo=AVMBX2.microsemi.net; Received: from AVMBX2.microsemi.net (208.19.100.22) by BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.1122.11 via Frontend Transport; Wed, 5 Sep 2018 05:47:12 +0000 Received: from AVMBX3.microsemi.net (10.100.34.33) by AVMBX2.microsemi.net (10.100.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 4 Sep 2018 22:46:54 -0700 Received: from localhost (10.187.72.82) by avmbx3.microsemi.net (10.100.34.33) with Microsoft SMTP Server id 15.1.1531.3 via Frontend Transport; Tue, 4 Sep 2018 22:46:54 -0700 From: Viswas G To: CC: , , , , Subject: [PATCH 3/4] pm80xx : Fixed system hang issue during kexec boot. Date: Wed, 5 Sep 2018 11:16:44 +0530 Message-ID: <20180905054645.19224-4-Viswas.G@microsemi.com> X-Mailer: git-send-email 2.19.0-rc1 In-Reply-To: <20180905054645.19224-1-Viswas.G@microsemi.com> References: <20180905054645.19224-1-Viswas.G@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.22;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(396003)(376002)(136003)(2980300002)(438002)(199004)(189003)(8676002)(76506005)(97736004)(57986006)(50226002)(5660300001)(106466001)(14444005)(51416003)(486006)(4326008)(36756003)(2906002)(81166006)(2870700001)(186003)(316002)(86362001)(81156014)(6916009)(8936002)(76176011)(106002)(54906003)(48376002)(68736007)(2616005)(26005)(356003)(77096007)(476003)(305945005)(336012)(47776003)(6666003)(446003)(478600001)(126002)(53936002)(1076002)(11346002)(50466002)(69596002)(2351001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR02MB4045;H:AVMBX2.microsemi.net;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD018;1:1QN7CBcwozYnarPkYnSL03hhJU/eQvqCiGewFCFy0cY/8x8qudAnbBsL+L4zeBaLsQZqa8NpXEcGKUKLjr2uboOS0YeQgT/DovOijKO+JOfZHeh+germjF5Xx3i6JVyo X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a08e7a77-99e8-4ddc-7e1f-08d612f3077b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR02MB4045; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4045;3:jxCr3UZ+HLYcCYiT83VR7/bSiana31d/lGLBzZ4IBEdncpSXs/rlB9Om4OT/xMJDMe4/sX5gCsUF98Q25mKQzvfzaYjCwyIl4wMoeUmLW5A2lxPnMzwLtyLmqg0ea8gW+O+7ul6dWbxed+W1K58mkEm0NVHNrvvo64n2HZr6+30diUH3R5lf8k9K6URa8rxibA+o2zhn/2RoPj5gNTA6NNAZ7bQjYhgULvpp832mqeFQOb5ScU+WuSCoZKH7JyEEGzTfjiX+vuZ9zUweUEBhLVsAy3sYTtlojQsGG8yY5iu5LrO9B7s9PzyoKmIvvyCG2MzLBqiLsa5kI2sqzrW/Tw4zNLTe1XNUKN2J+7ISlbc=;25:u8p+ySadwgb7xOHRhdqQwzBER70oM9KRoIGG8ADMxR5M6lGAXC631IacnDC+1o0kDo8KTY19RReDrGjPKolMwChIEJaCxYrUgTZwqoCqTZ7gdP/c4ferCvfQLAErO/os1pRucKxVX0mS/vyaAj7oPKJ6071ZCszSg8UovzPoe3TsjpIwBSYOPw9pxtvH3LL6k5Oyvo5GjCzAF4s9QuO1npSqZiZj5r3cBjJQMWayGEZxOxNV8/40FH09R7Hp54ToASbrn4YBH/VBHlfNTmQaVIK9hnqjvYmevvIhlKKsPJXFHTBCyi0AAAPaRdFhryigdFUPq6/T1/UXE7X+taOg7g== X-MS-TrafficTypeDiagnostic: SN6PR02MB4045: X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4045;31:xh2dVknIvoMQb35pIxlCa+miHRYbI5calJ7XQFT9NFRfugOO8LAC/ZUkisDHT9Mz+RwNjfzwh6midvNzAdJamy1xz1KPgH+2CcgjRiJH5+rzJWh2mTB7Vn8/vDc7O9Oyr5I8lKfsT0qyQmyaBzfIcCnq2g0enA5OUFA+vaklFuBOyE//rm1XwmMK4HAK1OhFd1onJ0j59bqHIYLnzrwgXWp/mytB0TYQnGUaDOe1ZNo=;20:DRgezIZEUgoF+85q9X073WXR2hAeW/GTIQHaUZPr/yg55CcG17vG1PEGikMHlT5V6eH6KOHVHcTA0rJ2GdNsK3BfdLGnOWNKSMGibmDTfbpiKXvwkzWAP8Dh5lCvEK5Yk4uATFJIydWNWK3nx0iSgvpasxOmSgvBo68o6Qy4/m2H7FuOcZUr1TCt+DGJW0t8OqphFLVFlHo1Zzoj2rHRA65KTnD91GognJD0XeLn3Gre5drYrlXdJk0yScJhD8j0o7mKvZzCZFhLEG1m27VlgBm+kPtpmC6GKhSwLu13UlAW449ahEiRDoBRzlN0xKM2tSBrISXweREtKD5fbunka/lp4XdHackP5wrYRQlSYFqC7hEFT/0PXR6MXbHqEedoPAMfoguouK/AwlcT3Mkkparpa3GEcuEhfbhwBk5PrnnNhIXyb3N5MWWgbDzjKz2FV1kjWOd11iAjL2pC7xL8TraHX2Dn+bMdqqKHN6GRZAeY+2fELmwu1vVQV2df8zOUpU3Q71mxHRmP/3HGeplqmHhRMWb+RIcHAtZjj+8DbEXsQWZIZU9R3Ewn1XHQ8HhOINrWppf1pmW6fSRI6ZtFB5EYMaxYHCzYn0KV4G55bx8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93004095)(10201501046)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(201708071742011)(7699016);SRVR:SN6PR02MB4045;BCL:0;PCL:0;RULEID:;SRVR:SN6PR02MB4045; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4045;4:/6xOxPM64V32eDQeDykmJgsZaAOKuTbUlc7LnvzbaNAfj2uVzb6J+QXHd910OfFxN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LICN418ceFpt5zue3NsFg+LxojFVNiR5z7UG3hdIXdbesVA9VAMME/CRcJeiNa4HqrLRVFDU8Ksw1tJZZR0aL73vDzdNAC1pEoylETLqX3Y3+3aW8J/+OR/3ixcP/C/ufxvsZ4lQDsiK3omiljeT79ad4OmwkhlfJymp0GaoY9tXmgrhvHU6Kk2XDaBvp6HuG9fP0q65qAchQ1dJ0Jj+PojUrYgV5sXNFBzCA/iLgFdhhWExmL81GZogyLjaP5eLXA3+vpiSDPBLRNkzfhuvY4jCfsZigcRHTplGOOQ7t6a/A4inveX+HS35JSyfMY9Q77UzeXHJLQYzkZVzUtA4fcU8LZ+eFPIuPGznoAmskt+RBbWI1dc= X-Microsoft-Antispam-Message-Info: mqsST9qq+En2vnYSC4zwOMPkZp6+40+naC3QnCXlcwxzO/viv+YCUbfaj6qr6SCitVIclImzXNvD9eJfzW3HrIqt5z62DkRfSh+MFDR9LO5OkM/qROl756QvRjtRA7PutU/8GMv8IqZJqp0rzGe+veaX7GWVaDYaAUst2c05y6hY7DufDEMbi4dgIYGRU98XyoQp/yxlW+e7Ujem9EbH4RsDEYFJzlCsRsqIZSCU4ertZVVNWLIz8v82W3d279Z/AmbmVGAPlavkLVG3kuA+40YKd2lY+4tx92oOs23efwjcsVJsHlK3cdYD2cfdBLA9thnr6NQSRcJYy++ZB35sTyoV+aaeAJeJbnA3tbkABYU= X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4045;6:+moWA/KlK/pSW75wzR+tDf5SOYX2JPVVeE10+AEjtyokMYe1jymI0fLsskVWKGmVU5i5l4je7wieQfsqAAJ7r+QH520Jv4LEJHYrUyko5sMqRudrqgtxqlivLpyuwdI3BqBBsH71vz5TGyBq9ZbAPhKzK1MACAYs8I/8i6hiI39SnaLy3LdW7U2PFviCRDGI2tukdB46zGsfryT7gFcwXckqbWFL2NQTnnRWqr5iK3J4d5871O/jE2lPpioPcCJs5U+N9qTVu6zp0u8+OXwLfUEeIipJDbB5E+4h0PAmerzZgDvfkaJfKlqN2X3uMxtnjXuQaHepHV1nixoVOcjmK5CLb61SIFhQJ5tG4C+eoScFuPTJ+9xfVQdMAU0q0fs42GooPX6yFpS+oLZ9ESW72rbWW5RGpiVYQyLrkQvEHEWTa7YpM1MErUDfkCcxuRBHmsxuiNRsOw3ERrENgdiBfw==;5:Jl1VzyX7iN4JV4sVWJ6C0oQGMvW5ZfR+/awK1uVLkweokCDNtrQyVoak/oCQ63vXZ2+pJd2ZlJQuok0CfeqgsK4+pA3nPlQyvMZ4KMUIINp4R3xHeg+TzAATY22BTwh2KJM625GS3aAV/OCQ81gQn5tToUKUWN+Q/ol1NdZpkY0=;7:duJou6miBkmeeSxZToXHSxGilyU+Wsqn6R5aXBLdgGndVHIa2+w+jssr1JKHZRhN8RmY7w6bKFqCfW8LWB6VhNk1ivd9TNqTjbBfSxtGCWxTFlKF/MlBnz+vx5W/RdjV53Ex6frM9OXCmDT45VxJe1Aa5Aa3/ZAVX+w0qW51nQzwmYCLoZhRgYUAf28/KP6Xz8hnn2HRpPAh4d7BrKsK21by/S8MGjkd4wmPyY1Qcss9lHplOZX/KKCadr7IJD9n SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2018 05:47:12.9358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a08e7a77-99e8-4ddc-7e1f-08d612f3077b 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.22];Helo=[AVMBX2.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4045 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: Deepak Ukey When the firmware is not responding, execution of kexec boot causes a system hang. When firmware assertion happened, driver get notified with interrupt vector updated in MPI configuration table. Then, the driver will read scratchpad register and set controller_fatal_error flag to true. Signed-off-by: Deepak Ukey Signed-off-by: Viswas G Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_hwi.c | 6 +++ drivers/scsi/pm8001/pm8001_sas.c | 7 ++++ drivers/scsi/pm8001/pm8001_sas.h | 1 + drivers/scsi/pm8001/pm80xx_hwi.c | 80 +++++++++++++++++++++++++++++++++++++--- drivers/scsi/pm8001/pm80xx_hwi.h | 3 ++ 5 files changed, 91 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index fcfb4f7..403ea8c 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -1479,6 +1479,12 @@ u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha, } else { u32 producer_index; void *pi_virt = circularQ->pi_virt; + /* spurious interrupt during setup if + * kexec-ing and driver doing a doorbell access + * with the pre-kexec oq interrupt setup + */ + if (!pi_virt) + break; /* Update the producer index from SPC */ producer_index = pm8001_read_32(pi_virt); circularQ->producer_index = cpu_to_le32(producer_index); diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 719233c..f9c8f21 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -384,6 +384,13 @@ static int pm8001_task_exec(struct sas_task *task, return 0; } pm8001_ha = pm8001_find_ha_by_dev(task->dev); + if (pm8001_ha->controller_fatal_error) { + struct task_status_struct *ts = &t->task_status; + + ts->resp = SAS_TASK_UNDELIVERED; + t->task_done(t); + return 0; + } PM8001_IO_DBG(pm8001_ha, pm8001_printk("pm8001_task_exec device \n ")); spin_lock_irqsave(&pm8001_ha->lock, flags); do { diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 80b4dd6..1816e35 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -538,6 +538,7 @@ struct pm8001_hba_info { u32 logging_level; u32 fw_status; u32 smp_exp_mode; + bool controller_fatal_error; const struct firmware *fw_image; struct isr_param irq_vector[PM8001_MAX_MSIX_VEC]; u32 reset_in_progress; diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 17e74a3..6eec439 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -577,6 +577,9 @@ static void update_main_config_table(struct pm8001_hba_info *pm8001_ha) pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_size); pm8001_mw32(address, MAIN_PCS_EVENT_LOG_OPTION, pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity); + /* Update Fatal error interrupt vector */ + pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |= + ((pm8001_ha->number_of_intr - 1) << 8); pm8001_mw32(address, MAIN_FATAL_ERROR_INTERRUPT, pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt); pm8001_mw32(address, MAIN_EVENT_CRC_CHECK, @@ -1110,6 +1113,9 @@ static int pm80xx_chip_init(struct pm8001_hba_info *pm8001_ha) return -EBUSY; } + /* Initialize the controller fatal error flag */ + pm8001_ha->controller_fatal_error = false; + /* Initialize pci space address eg: mpi offset */ init_pci_device_addresses(pm8001_ha); init_default_table_values(pm8001_ha); @@ -1218,13 +1224,17 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha) u32 bootloader_state; u32 ibutton0, ibutton1; - /* Check if MPI is in ready state to reset */ - if (mpi_uninit_check(pm8001_ha) != 0) { - PM8001_FAIL_DBG(pm8001_ha, - pm8001_printk("MPI state is not ready\n")); - return -1; + /* Process MPI table uninitialization only if FW is ready */ + if (!pm8001_ha->controller_fatal_error) { + /* Check if MPI is in ready state to reset */ + if (mpi_uninit_check(pm8001_ha) != 0) { + regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); + PM8001_FAIL_DBG(pm8001_ha, pm8001_printk( + "MPI state is not ready scratch1 :0x%x\n", + regval)); + return -1; + } } - /* checked for reset register normal state; 0x0 */ regval = pm8001_cr32(pm8001_ha, 0, SPC_REG_SOFT_RESET); PM8001_INIT_DBG(pm8001_ha, @@ -3753,6 +3763,46 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb) } } +static void print_scratchpad_registers(struct pm8001_hba_info *pm8001_ha) +{ + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_SCRATCH_PAD_0: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_0))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_SCRATCH_PAD_1:0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_SCRATCH_PAD_2: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_2))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_SCRATCH_PAD_3: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_3))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_HOST_SCRATCH_PAD_0: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_0))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_HOST_SCRATCH_PAD_1: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_1))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_HOST_SCRATCH_PAD_2: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_2))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_HOST_SCRATCH_PAD_3: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_3))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_HOST_SCRATCH_PAD_4: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_4))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_HOST_SCRATCH_PAD_5: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_5))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_RSVD_SCRATCH_PAD_0: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_6))); + PM8001_FAIL_DBG(pm8001_ha, + pm8001_printk("MSGU_RSVD_SCRATCH_PAD_1: 0x%x\n", + pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_7))); +} + static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) { struct outbound_queue_table *circularQ; @@ -3760,10 +3810,28 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) u8 uninitialized_var(bc); u32 ret = MPI_IO_STATUS_FAIL; unsigned long flags; + u32 regval; + if (vec == (pm8001_ha->number_of_intr - 1)) { + regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); + if ((regval & SCRATCH_PAD_MIPSALL_READY) != + SCRATCH_PAD_MIPSALL_READY) { + pm8001_ha->controller_fatal_error = true; + PM8001_FAIL_DBG(pm8001_ha, pm8001_printk( + "Firmware Fatal error! Regval:0x%x\n", regval)); + print_scratchpad_registers(pm8001_ha); + return ret; + } + } spin_lock_irqsave(&pm8001_ha->lock, flags); circularQ = &pm8001_ha->outbnd_q_tbl[vec]; do { + /* spurious interrupt during setup if kexec-ing and + * driver doing a doorbell access w/ the pre-kexec oq + * interrupt setup. + */ + if (!circularQ->pi_virt) + break; ret = pm8001_mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc); if (MPI_IO_STATUS_SUCCESS == ret) { /* process the outbound message */ diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h index 49fb769..d2fbcd1 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.h +++ b/drivers/scsi/pm8001/pm80xx_hwi.h @@ -1388,6 +1388,9 @@ struct SASProtocolTimerConfig { #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0 #define SCRATCH_PAD_IOP0_READY 0xC00 #define SCRATCH_PAD_IOP1_READY 0x3000 +#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \ + SCRATCH_PAD_IOP0_READY | \ + SCRATCH_PAD_RAAE_READY) /* boot loader state */ #define SCRATCH_PAD1_BOOTSTATE_MASK 0x70 /* Bit 4-6 */ From patchwork Wed Sep 5 05:46:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas G X-Patchwork-Id: 10588267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6A1C14E0 for ; Wed, 5 Sep 2018 05:47:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99DDC2997C for ; Wed, 5 Sep 2018 05:47:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DC3229984; Wed, 5 Sep 2018 05:47:04 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 2110E2997C for ; Wed, 5 Sep 2018 05:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726366AbeIEKPc (ORCPT ); Wed, 5 Sep 2018 06:15:32 -0400 Received: from mail-eopbgr700048.outbound.protection.outlook.com ([40.107.70.48]:47486 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726202AbeIEKPc (ORCPT ); Wed, 5 Sep 2018 06:15:32 -0400 Received: from CY4PR02CA0014.namprd02.prod.outlook.com (2603:10b6:903:18::24) by DM6PR02MB5306.namprd02.prod.outlook.com (2603:10b6:5:48::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 5 Sep 2018 05:47:01 +0000 Received: from BY2FFO11FD012.protection.gbl (2a01:111:f400:7c0c::132) by CY4PR02CA0014.outlook.office365.com (2603:10b6:903:18::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1101.14 via Frontend Transport; Wed, 5 Sep 2018 05:47:00 +0000 Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.99.222 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.99.222; helo=AUSMBX2.microsemi.net; Received: from AUSMBX2.microsemi.net (208.19.99.222) by BY2FFO11FD012.mail.protection.outlook.com (10.1.14.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.1122.11 via Frontend Transport; Wed, 5 Sep 2018 05:47:00 +0000 Received: from AUSMBX2.microsemi.net (10.201.34.32) by AUSMBX2.microsemi.net (10.201.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Wed, 5 Sep 2018 00:46:57 -0500 Received: from localhost (10.187.72.82) by ausmbx2.microsemi.net (10.201.34.32) with Microsoft SMTP Server id 15.1.1531.3 via Frontend Transport; Wed, 5 Sep 2018 00:46:57 -0500 From: Viswas G To: CC: , , , , Subject: [PATCH 4/4] pm80xx : Update driver version to 0.1.39 Date: Wed, 5 Sep 2018 11:16:45 +0530 Message-ID: <20180905054645.19224-5-Viswas.G@microsemi.com> X-Mailer: git-send-email 2.19.0-rc1 In-Reply-To: <20180905054645.19224-1-Viswas.G@microsemi.com> References: <20180905054645.19224-1-Viswas.G@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.99.222;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(136003)(346002)(376002)(2980300002)(438002)(199004)(189003)(50226002)(305945005)(575784001)(68736007)(47776003)(76176011)(51416003)(126002)(356003)(8676002)(2616005)(476003)(6346003)(26005)(77096007)(186003)(86362001)(14444005)(8936002)(4326008)(36756003)(2906002)(69596002)(5660300001)(81156014)(48376002)(15650500001)(6666003)(6916009)(2870700001)(81166006)(446003)(76506005)(1076002)(106466001)(11346002)(2351001)(336012)(57986006)(97736004)(486006)(316002)(53936002)(50466002)(54906003)(478600001)(106002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB5306;H:AUSMBX2.microsemi.net;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD012;1:KMCiVAdzPcN7PG6PEen0XUSoZ4QGNbBhA4OYJ8VKO4b1Nrlfub49t473WqjDjL0Rcc2OSuAa3fN9cAhsjZCVcqnxZrlwxDb+OwZh84nmBiHRbPzBi6wA3ee15nWJKbRA X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74bdbe24-ae08-4d5a-4c05-08d612f30028 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR02MB5306; X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB5306;3:2CkB9ll/PHcWsQu8jxcDc6gZ1L01XgZF/iIOZ5gJuIdjPcDOCdSUXnp7mi+sCp74dC2QGX8OXskCi+9Bf6OTFQVPrZmjvEhtcXu+7NaXtqHsrUFGPH9nJTxX5fR8Bz5QhfB4uQ/0pH88o8kAhIpSFyVBwlUKI0BoMVc9UYt/TLgxEachhbVWj71kIR/A3MfH69BrDVeAH6Fn2975hDvGz+NbQuAtV+q/dzGtIdjjdt1q0GZegR4bQ8IRnchwveUYLheBes1tZFhMl3z4KPNj2iD+OdOGeF1KmuPTHF6PMwrz7ibt1xbHWkOYj41OlAZEbuVgqq/JjFJLmIxng2DQO6txErecyh6UhEIPSD8hnQs=;25:w+wqIJpC0B7HgqSKWt5la601J4idQXe0NWdETH/iuEL0qXro+YFpSJxRKC7NQjW+ngDTMgebPdhn3S5N4oVFhjsnpILMNrJemgLp/CsM07GOyAjsQdhjEoCop7IjOttLJGXp7VeWrB0XxpwvXdExDMlqZOHtMd22zLJK2pfI8dIwZx/9gpUS8smHP1zACzEwBG2tDPOe8JVtFjvzEMz3TUHx4PcHyr6rsfMPvR6WlKV2JrGuzcda2cew9oJVslQ63gjkbZp2cfD6GmFYiI1Qfql0NQ0ksfgplyBPYnu6oOX1cPW3cqaPYFTmErvl+ViLsqxVEZ02ILNht5151AKogQ== X-MS-TrafficTypeDiagnostic: DM6PR02MB5306: X-Microsoft-Exchange-Diagnostics: 1;DM6PR02MB5306;31:uProL0YV3lXIRKR8n8i1CnXpA+QL/ITJPeY58QbwsVap+SjAycUN8H8SjhVE2wSIk/FI8bU9GC+LzajA9d3rchvLDv5osmcujJh9hn4wtCp4L9buwyXIDX4gBV7WDAfU88Eqb4/2/Z8AZEv42ZvZyJI44y7tvnS605pTnU87qPFtKCOfwKuVRFCbSUbt61jJoHanWvlpAB9BqovvyTxAI0/IUVOnuaKVAa8Qn1qg+iI=;20:Ceh/28GEfLCl4usIAlyl5WisHeeKann8V+ty15tVmTabbWuKc2HGhUrj28o+z/HzDmQlMxMou/kkBFioNnUlL7w8qqjUvKLNew1E7mDPPox6Wu4PXCu7wstIPa/npOGVjVV2wC9KlmsNc1K67QCTufDJSe37OTvRCSbsLosmRFGv22uBjLcFQaapPIE0lx9io/pVrpbP0tgSkE+T0ow7VME9W6hYWBA5tBdnWx7rQFJ+ANlYyU5gWhGVcdrbw0F7ExgAF6QmHIRhLIbU9Ascg/X/YjURZdpeLKA+sL4JAJJpLPSpTJK1cFo9vTdtqxUgiwNhRhIKQIMrc689LlTRkqezOrre/AAKADSKQ8kO7ZRsIL1jE8AVzHgoZLlATT5FbfkM/jd/rvlktr1+OoxM5Hlkpy6EFozqrrW803VTlnSLjPe8+vxiKDrCWV6NEaCTvnocLLqqtoy8easR9blP5ND0NoxSNqZTburMPKqmkXqrpYH0bq2M6vDxK3QchYn2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3231344)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699016);SRVR:DM6PR02MB5306;BCL:0;PCL:0;RULEID:;SRVR:DM6PR02MB5306; X-Microsoft-Exchange-Di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GUZD/s52CFF0vz3fOJHNmnvAfABR0dCJK2QZ+1AXvwQzDOFeD5R4GmHm25NkpRtS9/SwI4sobeS6rN1c/JkP7/eio/kufY6UeixFbfUVRxckfbu8t/5wUsHFA4ys1VXh6nVrcPdxBPLpkK9uK9+F9S108lcq63DdygOGRWpVJ5mnp5fjBWYb8ZSIfaH1Xpav6UKeImjDW50WHI5+42M/F5Omi2+iTNEDOkykuX5yZHtppQgUlbH3xsbOvutvtGc58o4Dc55UmlyJ/iz8E52CB1OVWXYnccEDVr8qMcP5JdJo271ML9K0u75zOQrKA3VUrWTd3LZKWXVFBSDJrOe2LNsU5nxqfXfGU4SzfqZCBsGJA==;5:zf6+UrrAkKgYOky6lKhEkkxjXG4ltXKXLaUYPVkoeaXUm+5w4zK6aXn32xSWRc/lK+0v5BpkVEzGaz7moHzv+xHVB77lyt92H/u9MH/i0cdSkAy7D4vThlCuvuhOr7zlWNsLBtG0TPKrH31PIn3cSNnSvPqCGdQOk0WYb4uK7HY=;7:daQ7GAx4Ito8Gj0d6iaEwNewrTbOESGVoJ9Ud5KR9aFFzgYq5D2YxIG+jK3Xb1T9RxwjYt6dgHBYl+2t3NKMFHc76UkxF+GoQUVnj170DxxQTZQx3SdDCGoHrmVVAXxK2lIteknXd9eJI1gUBAHm7dj7A/m1j+VEqA1QSoX/g9UhVJsmZ5lJVFMxi63VOzMu7w3GXc95ol5XdI07bh/X600rmlyX2I/xjMN72dnvTOlxKyn94ST2LhX6w6ebHXKg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2018 05:47:00.7247 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74bdbe24-ae08-4d5a-4c05-08d612f30028 X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad;Ip=[208.19.99.222];Helo=[AUSMBX2.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5306 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: Deepak Ukey Updated the driver version from 0.1.38 to 0.1.39. Signed-off-by: Deepak Ukey Signed-off-by: Viswas G Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_sas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 1816e35..f88b0d3 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -58,7 +58,7 @@ #include "pm8001_defs.h" #define DRV_NAME "pm80xx" -#define DRV_VERSION "0.1.38" +#define DRV_VERSION "0.1.39" #define PM8001_FAIL_LOGGING 0x01 /* Error message logging */ #define PM8001_INIT_LOGGING 0x02 /* driver init logging */ #define PM8001_DISC_LOGGING 0x04 /* discovery layer logging */