From patchwork Tue Feb 1 21:47:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ED0FC433EF for ; Tue, 1 Feb 2022 21:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236006AbiBAVry (ORCPT ); Tue, 1 Feb 2022 16:47:54 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:19880 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235995AbiBAVrx (ORCPT ); Tue, 1 Feb 2022 16:47:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752073; x=1675288073; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9jwKpXgIGRiAgCml0weWCctF7Ds1lVxof1cPp+TLdJ4=; b=L/CJ0nAJaa4Hvcb+7kqKNCbzzGhDPf2wVhCo0TAdQvfyaBVU53Y55TS4 PFwV0o4a4+KVdaDYghLBQ8lrJ6ICAGiOLSriw4XIuKdESaBohn0aQ5C3A r1aeyIQdtqoKBAsXcYEJ2TmwmdCOA4Nr3VAK8g3NdMzqQu0d6ldllBKa3 k5OhBQG3o+SMRgAzQsfdON2+gh8PJwavNCh1/RFNGhj2YNBh6ECobBW7p mXdrT2a3DAPZ3SCXzPuT41ot/WOZ4nd+57sdE0q/K0be/gYmbcYq1liMC VGtPWy+Uk9GDBluTrMxwyRMMYBZ38S8yozekFhWUPMyEAfxbNPBGLKaDj w==; IronPort-SDR: NC+YY86P6c8vWwJEHU5EKOvBY6Xb5mWF1SCgcruyW7O5MSBJNGOH5ifp/g6GGj/2Ec2D5O0iba ejuI1PKsi/nqdWVNhU2sa/Px55AS+h0tYzibx+5lrsywPYg2xsPzt3VDXz1BmZAZxO9A1jRylD BMCMo2AOURqQTDeD4kdu0SrWjEzuebTm7UFoj5afWnWqI+VMlnCucbD0u2seUUZgVcKGTz1jCz mMduykWXNoj0BwwHtxnK6PmfSG0ZF9JSY2kR9lOR0dq1feDueV4kXpcvLAyGDkiKGQ1BJVQ5fj p7p3iD672jt4f88Rld97v6OR X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="152163252" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:47:53 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:47:53 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:47:53 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 0426C70236E; Tue, 1 Feb 2022 15:47:53 -0600 (CST) Subject: [PATCH 01/18] smartpqi: fix rmmod stack trace From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:47:53 -0600 Message-ID: <164375207296.440833.4996145011193819683.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Prevent "BUG: scheduling while atomic: rmmod" stack trace. Stop setting spin_locks before calling OS functions to remove devices. Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index f0897d587454..2db9f874cc51 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2513,17 +2513,15 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info) struct pqi_scsi_dev *device; struct pqi_scsi_dev *next; - spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); - list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list, scsi_device_list_entry) { if (pqi_is_device_added(device)) pqi_remove_device(ctrl_info, device); + spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); list_del(&device->scsi_device_list_entry); pqi_free_device(device); + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); } - - spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); } static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info) From patchwork Tue Feb 1 21:47:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16009C433EF for ; Tue, 1 Feb 2022 21:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236064AbiBAVsA (ORCPT ); Tue, 1 Feb 2022 16:48:00 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:30963 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236013AbiBAVr7 (ORCPT ); Tue, 1 Feb 2022 16:47:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752080; x=1675288080; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+RBln9NHiNY8AVsTmj25PNxSX+lzxroPsWH/7v0vyA0=; b=zkYZThflaK7rvIETjdovzoi1ASwBFGQMQr55lVVr6IEh1XKQieyh9lhd w9u/FnKic/2oQ+RLHRAEkt0q2a0W4pTvqrkB9NUiL8OqS5G9U1VMy386y 3YYboKF0bMSnBnC8aw+CIJuQsJdVfavLv+H7MaYatg6fTcZwwtwsVq/A2 N/TWVMcbHs7dheCYGN3xgJi2Y6Mn2NeFmhiStTtF4hoBqN8CnaMLys+Sv N9MXtj6Qf8pyZIQrOcoKjHMS7fsh1wMr3Gi871e9RJJaYY/9uE2C7BZxv HMPmVEUlhblbSEZMsLNgFxjQ+FVaWSrHggxQgIgub6lrlu8f/gni/sBh8 w==; IronPort-SDR: E9Rb/qd8gVR6Z/qCr7/PcThHvZWra8UEIEB4heBUtw1WH913MJ8Nk2Bw6FghdVv7XhfyK5cfEj K8KAS8E9myesrn2ERR0RiarayZI90q3xc0p9xn/WxTOx5WmLQm9P9XRko0Exb3+Rvc67Jbw3CB mQl2IV35c9lXTb2TYbyb2oBd+gh8bdUvcWA07ounmeyFmyDYyIuMyo77kguA4s2AjAOgjbFMC/ 0Nnkju3dinnn5V3UmkjhDaYZD8nRi7XqMOR8yd479saE8g4w0p1GUWwtN5b2H9a5OvIBZwtyd+ PR/0IV+CgpkSQo1F1DurPUne X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="151639042" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:00 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:47:58 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:47:58 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 0E06170236E; Tue, 1 Feb 2022 15:47:58 -0600 (CST) Subject: [PATCH 02/18] smartpqi: add PCI IDs From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:47:58 -0600 Message-ID: <164375207802.440833.15947108153078495425.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add in new ZTE controllers: VID / DID / SVID / SDID ---- ---- ---- ---- ZTE SmartROC3100 RS241-18i 2G 9005 / 028F / 1CF2 / 5449 ZTE SmartROC3100 RS242-18i 4G 9005 / 028F / 1CF2 / 544A ZTE SmartIOC2100 RS243-18i 9005 / 028F / 1CF2 / 544B ZTE SmartROC3100 RM241B-18i 2G 9005 / 028F / 1CF2 / 544D ZTE SmartROC3100 RM242B-18i 4G 9005 / 028F / 1CF2 / 544E ZTE SmartIOC2100 RM243B-18i 9005 / 028F / 1CF2 / 544F Add PCI ID for 1100-24i controller: VID / DID / SVID / SDID ---- ---- ---- ---- HBA 1100-24i 9005 / 028F / 9005 / 1304 Add PCI IDs for HPE and Adaptec devices: VID / DID / SVID / SDID ---- ---- ---- ---- Adaptec Smart HBA 2200-8io /e 9005 / 028F / 9005 / 1463 Adaptec Smart HBA 2200-16io /e 9005 / 028F / 9005 / 14C2 HPE SR308i-p Gen11 9005 / 028F / 1590 / 0382 HPE SR308i-o Gen11 9005 / 028F / 1590 / 0383 HPE SR932i-p Gen11 9005 / 028F / 1590 / 0381 Add PCI IDs for Inspur controllers: VID / DID / SVID / SDID ---- ---- ---- ---- INSPUR RS0800M5H24i 9005 / 028F / 1BD4 / 006B INSPUR RS0800M5E8I 9005 / 028F / 1BD4 / 006C INSPUR RS0800M5H8I 9005 / 028F / 1BD4 / 006D INSPUR RS0804M5R16i 9005 / 028F / 1BD4 / 006F INSPUR RS0800M5E16i 9005 / 028F / 1BD4 / 0070 INSPUR RS0800M5H16i 9005 / 028F / 1BD4 / 0071 INSPUR RS0800M5E16i 9005 / 028F / 1BD4 / 0072 NT RAID 3100-24i 9005 / 028F / 1F0C / 3161 Add HPE and Adaptec OROC PCI IDs: VID / DID / SVID / SDID ---- ---- ---- ---- HPE SR216i-o Gen11 9005 / 028F / 9005 / 036F Adaptec SmartRAID 3284-16io /e/uC 9005 / 028F / 9005 / 1473 Adaptec SmartRAID 3254-16io /e 9005 / 028F / 9005 / 1474 Add PCI IDs for new channel controllers: VID / DID / SVID / SDID ---- ---- ---- ---- Adaptec SmartRAID 3254-8i /e 9005 / 028F / 9005 / 14A4 Adaptec SmartRAID 3252-8i /e 9005 / 028F / 9005 / 14A5 Adaptec SmartRAID 3204-8i /e 9005 / 028F / 9005 / 14A6 Align PCI IDs with OOB driver Realign the PCI ID table with our Out of Box driver. Easier to check for differences. Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Mike McGowen Signed-off-by: Murthy Bhat Signed-off-by: Sagar Biradar Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 108 ++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 2db9f874cc51..d34e49caa3f3 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -8941,10 +8941,6 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x152d, 0x8a37) }, - { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, - 0x193d, 0x8460) - }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x193d, 0x1104) @@ -9041,6 +9037,34 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x1bd4, 0x0054) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1bd4, 0x006b) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1bd4, 0x006c) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1bd4, 0x006d) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1bd4, 0x006f) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1bd4, 0x0070) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1bd4, 0x0071) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1bd4, 0x0072) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x19e5, 0xd227) @@ -9197,6 +9221,10 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x1303) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x1304) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x1380) @@ -9257,6 +9285,10 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x1462) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x1463) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x1470) @@ -9269,6 +9301,14 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x1472) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x1473) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x1474) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x1480) @@ -9293,6 +9333,18 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x14a2) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x14a4) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x14a5) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x14a6) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x14b0) @@ -9309,6 +9361,10 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x14c1) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + PCI_VENDOR_ID_ADAPTEC2, 0x14c2) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, PCI_VENDOR_ID_ADAPTEC2, 0x14d0) @@ -9413,6 +9469,22 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x1590, 0x032e) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1590, 0x036f) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1590, 0x0381) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1590, 0x0382) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1590, 0x0383) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x1d8d, 0x0800) @@ -9437,6 +9509,10 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x1dfc, 0x3161) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1f0c, 0x3161) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x1cf2, 0x5445) @@ -9449,6 +9525,30 @@ static const struct pci_device_id pqi_pci_id_table[] = { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x1cf2, 0x5447) }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1cf2, 0x5449) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1cf2, 0x544a) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1cf2, 0x544b) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1cf2, 0x544d) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1cf2, 0x544e) + }, + { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, + 0x1cf2, 0x544f) + }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x028f, 0x1cf2, 0x0b27) From patchwork Tue Feb 1 21:48:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67026C433F5 for ; Tue, 1 Feb 2022 21:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236099AbiBAVsH (ORCPT ); Tue, 1 Feb 2022 16:48:07 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:39807 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236074AbiBAVsE (ORCPT ); Tue, 1 Feb 2022 16:48:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752083; x=1675288083; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+AjclKvQxtKx4gyF8Tdkv4vsdL2XPpiCOQvLwVLrHBw=; b=mbsDFZn7egWVIVjIRY3krs0E7S0o6D0YnsNe1jKEujPbyHLlaLzRAVjB ZSkljNWot3HQ+D/PhVnxgBRswcLNLmr9Zere0qpIrMVI/V1RhyEuOXOUP RNJs7pFS4LTF/BwFQrRWYgHqMXDNjuRq5f9+3IUANOT+VF5IovB40eBGr b83pHGqv+9JWpyOuvDrgEXcvbeY8RYRxLChdVlFzQzknfmWbfb7KhGp0p CBO+ToyU1G4nCHlayiSX8tHrJgqqXlhR5qFzFDzWSaPxrTU9Mian6Jqt3 DZvDVtpuVpls6WZ3FSthcEQhXG8INt3fRzIR2teVdJDs4Ahz6lTahbXYM w==; IronPort-SDR: Ny9Hbf6WeWcp3xqL4242/9BJaX/7i9DALTusXwvUZ+74WeSFogCll9OIKBaS0tMsZ2WHpQVnmL mPrT/gmjkdk65gcnnEYrVBMP2/AXA8fMH1c79UZhrM9wrIIYlRRV49I1MNhG0fRz/eT9m7Klse L35x0v4Bhd95XfktIaOXtkACSePWuypiGqeQNHhoY0zDeqpH6l23Nhlxpx8qZQIDyKCAv+p542 L3WWI9Eap0B3+LUrAll8ifljn2kagIihr5SFEszOU/uFQGj74IdDoRQ1rLltN5XxPp7XeHg94/ zzqYUTae2+rCAj2/0VGswQVo X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="160764649" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:03 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:03 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:03 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 187C070236E; Tue, 1 Feb 2022 15:48:03 -0600 (CST) Subject: [PATCH 03/18] smartpqi: enable SATA NCQ priority in sysfs From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:03 -0600 Message-ID: <164375208306.440833.7392577382127815362.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gilbert Wu Add device attribute sas_ncq_prio_enable for IO utility to enable SATA NCQ priority support and recognize IO priority in SCSI command and then pass IO priority information to controller firmware. This device attribute works only when device has NCQ priority support and controller firmware can handle IO with NCQ priority attribute. Reviewed-by: Mike McGowen Reviewed-by: Scott Teel Signed-off-by: Gilbert Wu Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi.h | 2 + drivers/scsi/smartpqi/smartpqi_init.c | 119 ++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h index aac88ac0a0b7..f192745ee488 100644 --- a/drivers/scsi/smartpqi/smartpqi.h +++ b/drivers/scsi/smartpqi/smartpqi.h @@ -1127,6 +1127,8 @@ struct pqi_scsi_dev { u8 box[8]; u16 phys_connector[8]; u8 phy_id; + u8 ncq_prio_enable; + u8 ncq_prio_support; bool raid_bypass_configured; /* RAID bypass configured */ bool raid_bypass_enabled; /* RAID bypass enabled */ u32 next_bypass_group; diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index d34e49caa3f3..ad9fa1628a69 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -68,7 +68,7 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, static int pqi_aio_submit_io(struct pqi_ctrl_info *ctrl_info, struct scsi_cmnd *scmd, u32 aio_handle, u8 *cdb, unsigned int cdb_length, struct pqi_queue_group *queue_group, - struct pqi_encryption_info *encryption_info, bool raid_bypass); + struct pqi_encryption_info *encryption_info, bool raid_bypass, bool io_high_prio); static int pqi_aio_submit_r1_write_io(struct pqi_ctrl_info *ctrl_info, struct scsi_cmnd *scmd, struct pqi_queue_group *queue_group, struct pqi_encryption_info *encryption_info, struct pqi_scsi_dev *device, @@ -1549,6 +1549,7 @@ static void pqi_get_volume_status(struct pqi_ctrl_info *ctrl_info, device->volume_offline = volume_offline; } +#define PQI_DEVICE_NCQ_PRIO_SUPPORTED 0x01 #define PQI_DEVICE_PHY_MAP_SUPPORTED 0x10 static int pqi_get_physical_device_info(struct pqi_ctrl_info *ctrl_info, @@ -1597,6 +1598,10 @@ static int pqi_get_physical_device_info(struct pqi_ctrl_info *ctrl_info, else device->phy_id = 0xFF; + device->ncq_prio_support = + ((get_unaligned_le32(&id_phys->misc_drive_flags) >> 16) & + PQI_DEVICE_NCQ_PRIO_SUPPORTED); + return 0; } @@ -3007,7 +3012,7 @@ static int pqi_raid_bypass_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info, return pqi_aio_submit_io(ctrl_info, scmd, rmd.aio_handle, rmd.cdb, rmd.cdb_length, queue_group, - encryption_info_ptr, true); + encryption_info_ptr, true, false); } #define PQI_STATUS_IDLE 0x0 @@ -5560,18 +5565,55 @@ static void pqi_aio_io_complete(struct pqi_io_request *io_request, pqi_scsi_done(scmd); } +static inline bool pqi_is_io_high_prioity(struct pqi_ctrl_info *ctrl_info, + struct pqi_scsi_dev *device, struct scsi_cmnd *scmd) +{ + bool io_high_prio; + int priority_class; + + io_high_prio = false; + if (device->ncq_prio_enable) { + priority_class = + IOPRIO_PRIO_CLASS(req_get_ioprio(scsi_cmd_to_rq(scmd))); + if (priority_class == IOPRIO_CLASS_RT) { + /* set NCQ priority for read/write command */ + switch (scmd->cmnd[0]) { + case WRITE_16: + case READ_16: + case WRITE_12: + case READ_12: + case WRITE_10: + case READ_10: + case WRITE_6: + case READ_6: + io_high_prio = true; + break; + default: + break; + } + } + } + + return io_high_prio; +} + static inline int pqi_aio_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_dev *device, struct scsi_cmnd *scmd, struct pqi_queue_group *queue_group) { + bool io_high_prio; + + io_high_prio = pqi_is_io_high_prioity(ctrl_info, device, scmd); return pqi_aio_submit_io(ctrl_info, scmd, device->aio_handle, - scmd->cmnd, scmd->cmd_len, queue_group, NULL, false); + scmd->cmnd, scmd->cmd_len, queue_group, NULL, + false, io_high_prio); } static int pqi_aio_submit_io(struct pqi_ctrl_info *ctrl_info, struct scsi_cmnd *scmd, u32 aio_handle, u8 *cdb, unsigned int cdb_length, struct pqi_queue_group *queue_group, - struct pqi_encryption_info *encryption_info, bool raid_bypass) + struct pqi_encryption_info *encryption_info, bool raid_bypass, + bool io_high_prio) { int rc; struct pqi_io_request *io_request; @@ -5589,6 +5631,7 @@ static int pqi_aio_submit_io(struct pqi_ctrl_info *ctrl_info, put_unaligned_le32(aio_handle, &request->nexus_id); put_unaligned_le32(scsi_bufflen(scmd), &request->buffer_length); request->task_attribute = SOP_TASK_ATTRIBUTE_SIMPLE; + request->command_priority = io_high_prio; put_unaligned_le16(io_request->index, &request->request_id); request->error_index = request->request_id; if (cdb_length > sizeof(request->cdb)) @@ -7121,6 +7164,71 @@ static ssize_t pqi_raid_bypass_cnt_show(struct device *dev, return scnprintf(buffer, PAGE_SIZE, "0x%x\n", raid_bypass_cnt); } +static ssize_t pqi_sas_ncq_prio_enable_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct pqi_ctrl_info *ctrl_info; + struct scsi_device *sdev; + struct pqi_scsi_dev *device; + unsigned long flags; + int output_len = 0; + + sdev = to_scsi_device(dev); + ctrl_info = shost_to_hba(sdev->host); + + spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); + + device = sdev->hostdata; + if (!device) { + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); + return -ENODEV; + } + + output_len = snprintf(buf, PAGE_SIZE, "%d\n", + device->ncq_prio_enable); + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); + + return output_len; +} + +static ssize_t pqi_sas_ncq_prio_enable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct pqi_ctrl_info *ctrl_info; + struct scsi_device *sdev; + struct pqi_scsi_dev *device; + unsigned long flags; + u8 ncq_prio_enable = 0; + + if (kstrtou8(buf, 0, &ncq_prio_enable)) + return -EINVAL; + + sdev = to_scsi_device(dev); + ctrl_info = shost_to_hba(sdev->host); + + spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); + + device = sdev->hostdata; + + if (!device) { + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); + return -ENODEV; + } + + if (!device->ncq_prio_support || + !device->is_physical_device) { + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); + return -EINVAL; + } + + device->ncq_prio_enable = ncq_prio_enable; + + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); + + return strlen(buf); +} + static DEVICE_ATTR(lunid, 0444, pqi_lunid_show, NULL); static DEVICE_ATTR(unique_id, 0444, pqi_unique_id_show, NULL); static DEVICE_ATTR(path_info, 0444, pqi_path_info_show, NULL); @@ -7128,6 +7236,8 @@ static DEVICE_ATTR(sas_address, 0444, pqi_sas_address_show, NULL); static DEVICE_ATTR(ssd_smart_path_enabled, 0444, pqi_ssd_smart_path_enabled_show, NULL); static DEVICE_ATTR(raid_level, 0444, pqi_raid_level_show, NULL); static DEVICE_ATTR(raid_bypass_cnt, 0444, pqi_raid_bypass_cnt_show, NULL); +static DEVICE_ATTR(sas_ncq_prio_enable, 0644, + pqi_sas_ncq_prio_enable_show, pqi_sas_ncq_prio_enable_store); static struct attribute *pqi_sdev_attrs[] = { &dev_attr_lunid.attr, @@ -7137,6 +7247,7 @@ static struct attribute *pqi_sdev_attrs[] = { &dev_attr_ssd_smart_path_enabled.attr, &dev_attr_raid_level.attr, &dev_attr_raid_bypass_cnt.attr, + &dev_attr_sas_ncq_prio_enable.attr, NULL }; From patchwork Tue Feb 1 21:48:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DBBFC433F5 for ; Tue, 1 Feb 2022 21:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236156AbiBAVsJ (ORCPT ); Tue, 1 Feb 2022 16:48:09 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:39807 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236013AbiBAVsI (ORCPT ); Tue, 1 Feb 2022 16:48:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752088; x=1675288088; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DJ3T2ggtpSoCill2TfLc2bOreHs/JxdSczSCFxUAlWI=; b=ACI0hcvtBC2QtuTM7by+uQQ+JCuP7GgAPzjmcz/bV3zUoQB040uFb83C hMmyjnKMLrPjRlylg5cZiGWHmzTYFX2rckLgaHVsabGR2f/qQUOPhA+3R ElbuSFwpro40AjaN4+KauOVJDEtN4k0AQAOc/RtNC3BdhLavBEuW8W3OK CXwJG3fhJ4QaVmV1u6NigOb/Fh5ddmyW5E2cgI0+2DJsB3OEs59m0pjBW CconQ14HZuzpHnv7BM5Q7qfPvhtaSZywc0TvgBLxpF/UdRNEF8sImvOlE LzK/vSYETo9iAdKJvUqQoWkSEj62cnOWYULM0F7bVsIZwRNzm3VXoKOpC g==; IronPort-SDR: AP4jPGN/5xfBq8iFnYJc3iNS2A1krDFNq9iekpQwnHEAfy+pLie/zDk0rz7ePPQcEDr8kn1VWE 9LLp9RJQXsDBeruz/jDbCAtCpZm849Wps+LUDOnOTeOUcoHNtMwLohLqwL7fjFodc/Oncibvq0 03dDtXHzJtrmshNhSOp1iHaGsPToRuIdtnlsf0Msxtkg9dYTxJye30kclqnQjD8xHiXJYnenbU eh8QnHoz+PloZ1Ss6JjrRjFKs8922/nzbfIO7FF0mefkgd/yg2sGyl0Fr01YsS6ovIrdhQr39F VHlr+oF61/EONkh9oknaI/mG X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="160764656" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:08 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:08 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:08 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 1FC7C70236E; Tue, 1 Feb 2022 15:48:08 -0600 (CST) Subject: [PATCH 04/18] smartpqi: eliminate drive spin down on warm boot From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:08 -0600 Message-ID: <164375208810.440833.11254644025650871435.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Sagar Biradar Avoid drive spin down during a warm boot on Linux. Call the BMIC Flush Cache command (0xc2) to indicate the reason for the flush cache (shutdown, hibernate, suspend, or restart). Reviewed-by: Mike McGowen Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Sagar Biradar Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index ad9fa1628a69..f51605cd098c 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -8902,6 +8902,7 @@ static void pqi_shutdown(struct pci_dev *pci_dev) { int rc; struct pqi_ctrl_info *ctrl_info; + enum bmic_flush_cache_shutdown_event shutdown_event; ctrl_info = pci_get_drvdata(pci_dev); if (!ctrl_info) { @@ -8917,11 +8918,16 @@ static void pqi_shutdown(struct pci_dev *pci_dev) pqi_ctrl_block_requests(ctrl_info); pqi_ctrl_wait_until_quiesced(ctrl_info); + if (system_state == SYSTEM_RESTART) + shutdown_event = RESTART; + else + shutdown_event = SHUTDOWN; + /* * Write all data in the controller's battery-backed cache to * storage. */ - rc = pqi_flush_cache(ctrl_info, SHUTDOWN); + rc = pqi_flush_cache(ctrl_info, shutdown_event); if (rc) dev_err(&pci_dev->dev, "unable to flush controller cache\n"); From patchwork Tue Feb 1 21:48:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B72BC433EF for ; Tue, 1 Feb 2022 21:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236212AbiBAVsP (ORCPT ); Tue, 1 Feb 2022 16:48:15 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:39807 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236013AbiBAVsN (ORCPT ); Tue, 1 Feb 2022 16:48:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752093; x=1675288093; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aqtJqpMWVGv5tB5DS5LDnw+CBwpRS41P24HWh48M/7g=; b=Dhcp9eStj/pyOX97tPqjM8YdnQH93FT7/68EypUC37tmKAhEk8Ls/baX W9VOsf2CWooryHcziEFBTxcatOhZmnavOERGYGfetggD8B3kQRYxqAEdu XD8H46u9I8ShqeFqTtoKn3BHgP1rx3wTxDGPy3GO2hYvKNG/gSnzphVkx RX80l83Us0MYdxHoNZMKoVGGDlbp1zaZnrQ4bM6F40AYP/rs5ZzdtuD/n cWpLG5+bfbYNHW35S3vek963RFlDK2ecrRdlvjCv6s70x2VPMhBtAQysA dKGFgAE/DW9+miEuklZgavJukttWJp6HWLv0GaeX11Fl3/kWL5FMadd50 w==; IronPort-SDR: qJZkNDPXuk5vajnhsKUpJN8GWyPnwIHet1sy65UqxjT6y/xV7z8i7b1c7JohQhrWlFBJYVkMSS bzB09ZRpLiv9Jxznb1txRO6e3443Mnvh9NndEm5zkRtbR/LNeFGPYNZzFo+RDlWMooAkxe2e3v wCxPW9sZljmO0ZZ8h16UT0O/hiW1SX2AfUy+VpO3KVcbpXu8uU4U05AU5LV3Cfhj6fRcZEB+bS A+4OIBaHtWogPSy+FGapRc+SfHyVEv6Rt0o/RG4Mm9bBuS+XXCJ06h31Y8KmHRg+cMoZfmAJZd SjwufRvm+e2kOHoGQU9RcYO4 X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="160764664" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:13 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:13 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 2A07D70236E; Tue, 1 Feb 2022 15:48:13 -0600 (CST) Subject: [PATCH 05/18] smartpqi: propagate path failures to SML quickly From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:13 -0600 Message-ID: <164375209313.440833.9992416628621839233.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Murthy Bhat Return DID_NO_CONNECT when a path failure is detected. When a path fails during IO and AIO path gets disabled for a multipath device, the IO was retried in the RAID path slowing down path fail detection. Returning DID_NO_CONNECT allows multipath to switch paths more quickly. Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Sagar Biradar Signed-off-by: Murthy Bhat Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index f51605cd098c..9bc2987e280f 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2291,6 +2291,14 @@ static inline bool pqi_is_device_with_sas_address(struct pqi_scsi_dev *device) return false; } +static inline bool pqi_is_multipath_device(struct pqi_scsi_dev *device) +{ + if (pqi_is_logical_device(device)) + return false; + + return (device->path_map & (device->path_map - 1)) != 0; +} + static inline bool pqi_expose_device(struct pqi_scsi_dev *device) { return !device->is_physical_device || !pqi_skip_device(device->scsi3addr); @@ -3216,12 +3224,14 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request) int residual_count; int xfer_count; bool device_offline; + struct pqi_scsi_dev *device; scmd = io_request->scmd; error_info = io_request->error_info; host_byte = DID_OK; sense_data_length = 0; device_offline = false; + device = scmd->device->hostdata; switch (error_info->service_response) { case PQI_AIO_SERV_RESPONSE_COMPLETE: @@ -3246,8 +3256,14 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request) break; case PQI_AIO_STATUS_AIO_PATH_DISABLED: pqi_aio_path_disabled(io_request); - scsi_status = SAM_STAT_GOOD; - io_request->status = -EAGAIN; + if (pqi_is_multipath_device(device)) { + pqi_device_remove_start(device); + host_byte = DID_NO_CONNECT; + scsi_status = SAM_STAT_CHECK_CONDITION; + } else { + scsi_status = SAM_STAT_GOOD; + io_request->status = -EAGAIN; + } break; case PQI_AIO_STATUS_NO_PATH_TO_DEVICE: case PQI_AIO_STATUS_INVALID_DEVICE: From patchwork Tue Feb 1 21:48:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5F5CC433F5 for ; Tue, 1 Feb 2022 21:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236198AbiBAVsU (ORCPT ); Tue, 1 Feb 2022 16:48:20 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:30982 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236230AbiBAVsT (ORCPT ); Tue, 1 Feb 2022 16:48:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752100; x=1675288100; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X4YzdE4/1rrDmkaBXykXhh9Uw+FgtDBcnrsOX8pyx8Y=; b=tEVQbdso9aTHlAJxj5QJDfEb8xvBZUKEB4pkjTz+HfbNNy4Os1Tw2S3w 5bsr7VJSNLj/mzUqMm8QgLzixryOjsk6BChvhDcFOgWLRp2pEHbusedrC oZ3hko0Y3WTbr1N5uzHebTkrplZsB+0X9l+ZT+X98WIPYb8R3yRVrvddx EXQn3QyoWHuH+3MEhtoQhYB/cGQSIAQNeIZOxBmHHiCvUH5h6ZbEjripk 2qIhRwDhFhbVwtD8ptAbGL+2/cEGcZrSX6DPDpoT2i/+ecTnzLfLoNpSN JfHpsCv5U1/ppf6+V1Mq1ad2PeJ05q3V3Pt0Ht9fAToPLf6Naq1bFJBU3 g==; IronPort-SDR: iaFQUVlZ0Fn+YEU9VpVF6hjztFx4DYAZGAgG4F/2Ti8vmZDV1yx+6FDCI0RT9Epmv1ff1jstjU LFXkWzmYPpAVDB1ptfdXkCkpx1qotISo8S3OsvotQDeVrTn9nPk5BEPqg8dPGTBpCfbW6CAmAa Il5eamG9qY1B+R8uoerMf4X/7BcI1dl5jSPdjcADY40Yw7IG0YTPKB92RNjvzIJ7BDRJhVxnw3 eG5TbuGVSe2sJQwnsJjkSU6XRIinuzyuyqvY0i4LuxTdhAp4bH+kLfCbs+LkSmR2owmd8F/6Jn Ap3Z2Va7TvPiWvSbztnn2kVf X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="151639069" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:20 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:18 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:18 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 3399670236E; Tue, 1 Feb 2022 15:48:18 -0600 (CST) Subject: [PATCH 06/18] smartpqi: fix a name typo and cleanup code From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:18 -0600 Message-ID: <164375209818.440833.10908948825731635853.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Kevin Barnett Rename the function pqi_is_io_high_priority() to pqi_is_io_high_priority(), removed 2 unnecessary lines from the function, and adjusted the white space. Reviewed-by: Mike McGowen Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 9bc2987e280f..8ff38e3ecd09 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -5581,18 +5581,19 @@ static void pqi_aio_io_complete(struct pqi_io_request *io_request, pqi_scsi_done(scmd); } -static inline bool pqi_is_io_high_prioity(struct pqi_ctrl_info *ctrl_info, +static inline bool pqi_is_io_high_priority(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_dev *device, struct scsi_cmnd *scmd) { bool io_high_prio; int priority_class; io_high_prio = false; + if (device->ncq_prio_enable) { priority_class = IOPRIO_PRIO_CLASS(req_get_ioprio(scsi_cmd_to_rq(scmd))); if (priority_class == IOPRIO_CLASS_RT) { - /* set NCQ priority for read/write command */ + /* Set NCQ priority for read/write commands. */ switch (scmd->cmnd[0]) { case WRITE_16: case READ_16: @@ -5604,8 +5605,6 @@ static inline bool pqi_is_io_high_prioity(struct pqi_ctrl_info *ctrl_info, case READ_6: io_high_prio = true; break; - default: - break; } } } @@ -5619,7 +5618,8 @@ static inline int pqi_aio_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info, { bool io_high_prio; - io_high_prio = pqi_is_io_high_prioity(ctrl_info, device, scmd); + io_high_prio = pqi_is_io_high_priority(ctrl_info, device, scmd); + return pqi_aio_submit_io(ctrl_info, scmd, device->aio_handle, scmd->cmnd, scmd->cmd_len, queue_group, NULL, false, io_high_prio); From patchwork Tue Feb 1 21:48:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 066F9C433EF for ; Tue, 1 Feb 2022 21:48:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236325AbiBAVs2 (ORCPT ); Tue, 1 Feb 2022 16:48:28 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:30982 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236218AbiBAVsY (ORCPT ); Tue, 1 Feb 2022 16:48:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752105; x=1675288105; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3VBkh0H7BmbBEB3KIm7RiyYljVMQPpin7e6PGAJCnt8=; b=TwjqnB5RiG173cS6s2oyz56jI8clVDG/4X6DkyjGl/EB4NM5HgqyHAxL JRC7tI3mMQI2HMRg7cZOutLqZf8Wtn6Avs9D08ODLeH7fcjiTWOY2VUrY w7nRS1N1u3CwZyps7p9q6GeypvmBQFoQkM1QSEY01nAxyJsXHxgGZGXmB wYAv5isODQHDcLeCTYRs754fP1iQ1ljFp5KHKvwdgiQ6l86ifMrL+4EgB Gk+cWpHB8Rea7xwqkYfMi0CUg4O38CUodn239ijQs8IFVLQNlw2/IZnZ9 ehKDba8nu7P8EnnnijkLzs2afRgiw0yUK+3hdNoQnaN0sd3IkxuLiY9P2 Q==; IronPort-SDR: f5+pxna6rT1mnRk/A9Esg05uzxQVvW2/e/k3TcPD20bmChCEdq43ruU4Xxp1NqGDxPShMD6nfk gRwBlSuWfoFkKF4Tlbxay8rpSRQYPFJ2eqYPztaQPy3hS4qwIfm+ESSp8ZJij1YcdnNWU3Zm0q wWzmnkGiHTx57qkuYwoWVL0HDv3yHidHhzbmCLMPyXXO9hZG3aZL3qpTxa0JJEkpbTjF/dmFkI AlT53+AyIvNtHjUKvc19vZy7+7dbLB8WhChMTKqWmhnfeI29m6kX2Qx9/SaZLDstCHeFcoPEZf sMllUomhOhZqueqsOJsTtY5n X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="151639074" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:25 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:23 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:23 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 3E30F70236E; Tue, 1 Feb 2022 15:48:23 -0600 (CST) Subject: [PATCH 07/18] smartpqi: fix a typo in func pqi_aio_submit_io From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:23 -0600 Message-ID: <164375210321.440833.2566086558909686629.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Kevin Barnett Use correct pqi_aio_path_request structure to calculate the offset to sg_descriptors. The function pqi_aio_submit_io() uses the pqi_raid_path_request structure to calculate the offset of the structure member sg_descriptors. This is incorrect. It should be using the pqi_aio_path_request structure instead. This typo is benign because the offsets are the same in both structures. Reviewed-by: Mike McGowen Reviewed-by: Scott Teel Signed-off-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 8ff38e3ecd09..075e41b5ceaa 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -5641,7 +5641,7 @@ static int pqi_aio_submit_io(struct pqi_ctrl_info *ctrl_info, io_request->raid_bypass = raid_bypass; request = io_request->iu; - memset(request, 0, offsetof(struct pqi_raid_path_request, sg_descriptors)); + memset(request, 0, offsetof(struct pqi_aio_path_request, sg_descriptors)); request->header.iu_type = PQI_REQUEST_IU_AIO_PATH_IO; put_unaligned_le32(aio_handle, &request->nexus_id); From patchwork Tue Feb 1 21:48:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82E01C433FE for ; Tue, 1 Feb 2022 21:48:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236237AbiBAVsc (ORCPT ); Tue, 1 Feb 2022 16:48:32 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:38010 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236218AbiBAVsa (ORCPT ); Tue, 1 Feb 2022 16:48:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752110; x=1675288110; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dPx9KQ8uxdEoym0zFezuZVm5BbPDYSZ52CTdf5DXXLg=; b=bZF1K9QT/IXP2RcyY0BmzT1JLdWeAAIlADb8HDVPj74bpPllKAoGCW+s iQAI/hCRG/uuD+B9H/hdwwNQph+G5kct7ariQzPRqwZ63+PP9xk/8Pv68 QnkTQVRsxhxzZ957SpupjO5AQiNO5fVkmNZCyJUWeNytyPCyutkiQXyXI 1WqAQ7HjoSFS90PDk14bztvmSa1I1LdoUY0QtyeIfkWqGF8jGAFziRqUP pUlJQ++ANQoXjGeg/V5h4sYxfoxBlIgoXsSZMKqhtrVjfmQvvk1s6ifOR HO+XOkTSsiWMNLTcp0RES1jKo25kbkBC7OzVVnCdce8mqZgQdORi2c+kJ w==; IronPort-SDR: 1C+JTRzyaP7dGTYr5Qv500z0avFFKfBvmMGn+JMFjt1a5HribGuxVU8m0y/LnPfyb+Wkawm2d4 wVtp3b/oBYGAlGbv59vVTyWK4qxmgZDCSaU144i6kqf+BUIZ9MdZDx7vbas50F9tVMfgtI2xFv boPaOZnspmTLp7zSniigCrJ70C4oywE3GRpUohDO2i3z84HwMtSEd8iiPFvYSZM/PvlVMD9BFs eQX72eTpW/B2YkClxPKWTqOr3vyelYF/X1mCoOln+IVW7t6cw/gXYj6RDINd+cV53ee7Zy28yV Pc/xUFpeWtlNY2RWtXnGLldI X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="147312681" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:29 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:28 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:28 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 4822670236E; Tue, 1 Feb 2022 15:48:28 -0600 (CST) Subject: [PATCH 08/18] smartpqi: resolve delay issue with PQI_HZ value From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:28 -0600 Message-ID: <164375210825.440833.15510172447583227486.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Balsundar P Change PQI_HZ to HZ. PQI_HZ macro was set to 1000 when HZ value is less than 1000. By default, PQI_HZ will result into a delay of 10 seconds(for kernel, which has HZ = 100). So in this case when firmware raises an event, rescan worker will be scheduled after a delay of (10 x PQI_HZ) = 100 seconds instead of 10 seconds. Also driver uses PQI_HZ at many instances, which might result in some other issues with respect to delay. Align driver with our out-of-box driver for timeout values. Reviewed-by: Kevin Barnett Reviewed-by: Mike McGowen Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Balsundar P Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi.h | 6 ------ drivers/scsi/smartpqi/smartpqi_init.c | 32 ++++++++++++++++---------------- drivers/scsi/smartpqi/smartpqi_sis.c | 8 ++++---- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h index f192745ee488..81ec5fbf570a 100644 --- a/drivers/scsi/smartpqi/smartpqi.h +++ b/drivers/scsi/smartpqi/smartpqi.h @@ -96,12 +96,6 @@ struct pqi_ctrl_registers { struct pqi_device_registers pqi_registers; /* 4000h */ }; -#if ((HZ) < 1000) -#define PQI_HZ 1000 -#else -#define PQI_HZ (HZ) -#endif - #define PQI_DEVICE_REGISTERS_OFFSET 0x4000 /* shutdown reasons for taking the controller offline */ diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 075e41b5ceaa..b32a5a5a5c21 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -376,7 +376,7 @@ static inline void pqi_ctrl_wait_until_quiesced(struct pqi_ctrl_info *ctrl_info) displayed_warning = false; start_jiffies = jiffies; - warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * PQI_HZ) + start_jiffies; + warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * HZ) + start_jiffies; while (atomic_read(&ctrl_info->num_busy_threads) > atomic_read(&ctrl_info->num_blocked_threads)) { @@ -385,7 +385,7 @@ static inline void pqi_ctrl_wait_until_quiesced(struct pqi_ctrl_info *ctrl_info) "waiting %u seconds for driver activity to quiesce\n", jiffies_to_msecs(jiffies - start_jiffies) / 1000); displayed_warning = true; - warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * PQI_HZ) + jiffies; + warning_timeout = (PQI_QUIESCE_WARNING_TIMEOUT_SECS * HZ) + jiffies; } usleep_range(1000, 2000); } @@ -462,7 +462,7 @@ static inline void pqi_schedule_rescan_worker(struct pqi_ctrl_info *ctrl_info) pqi_schedule_rescan_worker_with_delay(ctrl_info, 0); } -#define PQI_RESCAN_WORK_DELAY (10 * PQI_HZ) +#define PQI_RESCAN_WORK_DELAY (10 * HZ) static inline void pqi_schedule_rescan_worker_delayed(struct pqi_ctrl_info *ctrl_info) { @@ -1038,7 +1038,7 @@ static int pqi_write_current_time_to_host_wellness( return rc; } -#define PQI_UPDATE_TIME_WORK_INTERVAL (24UL * 60 * 60 * PQI_HZ) +#define PQI_UPDATE_TIME_WORK_INTERVAL (24UL * 60 * 60 * HZ) static void pqi_update_time_worker(struct work_struct *work) { @@ -3045,7 +3045,7 @@ static int pqi_wait_for_pqi_mode_ready(struct pqi_ctrl_info *ctrl_info) u8 status; pqi_registers = ctrl_info->pqi_registers; - timeout = (PQI_MODE_READY_TIMEOUT_SECS * PQI_HZ) + jiffies; + timeout = (PQI_MODE_READY_TIMEOUT_SECS * HZ) + jiffies; while (1) { signature = readq(&pqi_registers->signature); @@ -3539,7 +3539,7 @@ static enum pqi_soft_reset_status pqi_poll_for_soft_reset_status( u8 status; unsigned long timeout; - timeout = (PQI_SOFT_RESET_STATUS_TIMEOUT_SECS * PQI_HZ) + jiffies; + timeout = (PQI_SOFT_RESET_STATUS_TIMEOUT_SECS * HZ) + jiffies; while (1) { status = pqi_read_soft_reset_status(ctrl_info); @@ -3717,7 +3717,7 @@ static void pqi_event_worker(struct work_struct *work) pqi_ctrl_unbusy(ctrl_info); } -#define PQI_HEARTBEAT_TIMER_INTERVAL (10 * PQI_HZ) +#define PQI_HEARTBEAT_TIMER_INTERVAL (10 * HZ) static void pqi_heartbeat_timer_handler(struct timer_list *t) { @@ -4264,7 +4264,7 @@ static int pqi_alloc_admin_queues(struct pqi_ctrl_info *ctrl_info) return 0; } -#define PQI_ADMIN_QUEUE_CREATE_TIMEOUT_JIFFIES PQI_HZ +#define PQI_ADMIN_QUEUE_CREATE_TIMEOUT_JIFFIES HZ #define PQI_ADMIN_QUEUE_CREATE_POLL_INTERVAL_MSECS 1 static int pqi_create_admin_queues(struct pqi_ctrl_info *ctrl_info) @@ -4358,7 +4358,7 @@ static int pqi_poll_for_admin_response(struct pqi_ctrl_info *ctrl_info, admin_queues = &ctrl_info->admin_queues; oq_ci = admin_queues->oq_ci_copy; - timeout = (PQI_ADMIN_REQUEST_TIMEOUT_SECS * PQI_HZ) + jiffies; + timeout = (PQI_ADMIN_REQUEST_TIMEOUT_SECS * HZ) + jiffies; while (1) { oq_pi = readl(admin_queues->oq_pi); @@ -4473,7 +4473,7 @@ static int pqi_wait_for_completion_io(struct pqi_ctrl_info *ctrl_info, while (1) { if (wait_for_completion_io_timeout(wait, - PQI_WAIT_FOR_COMPLETION_IO_TIMEOUT_SECS * PQI_HZ)) { + PQI_WAIT_FOR_COMPLETION_IO_TIMEOUT_SECS * HZ)) { rc = 0; break; } @@ -6065,7 +6065,7 @@ static int pqi_wait_until_inbound_queues_empty(struct pqi_ctrl_info *ctrl_info) displayed_warning = false; start_jiffies = jiffies; - warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * PQI_HZ) + start_jiffies; + warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * HZ) + start_jiffies; while (1) { queued_io_count = pqi_queued_io_count(ctrl_info); @@ -6080,7 +6080,7 @@ static int pqi_wait_until_inbound_queues_empty(struct pqi_ctrl_info *ctrl_info) "waiting %u seconds for queued I/O to drain (queued I/O count: %u; non-empty inbound queue count: %u)\n", jiffies_to_msecs(jiffies - start_jiffies) / 1000, queued_io_count, nonempty_inbound_queue_count); displayed_warning = true; - warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * PQI_HZ) + jiffies; + warning_timeout = (PQI_INBOUND_QUEUES_NONEMPTY_WARNING_TIMEOUT_SECS * HZ) + jiffies; } usleep_range(1000, 2000); } @@ -6148,7 +6148,7 @@ static int pqi_device_wait_for_pending_io(struct pqi_ctrl_info *ctrl_info, unsigned long msecs_waiting; start_jiffies = jiffies; - warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * PQI_HZ) + start_jiffies; + warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * HZ) + start_jiffies; while ((cmds_outstanding = atomic_read(&device->scsi_cmds_outstanding)) > 0) { pqi_check_ctrl_health(ctrl_info); @@ -6167,7 +6167,7 @@ static int pqi_device_wait_for_pending_io(struct pqi_ctrl_info *ctrl_info, "scsi %d:%d:%d:%d: waiting %lu seconds for %d outstanding command(s)\n", ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun, msecs_waiting / 1000, cmds_outstanding); - warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * PQI_HZ) + jiffies; + warning_timeout = (PQI_PENDING_IO_WARNING_TIMEOUT_SECS * HZ) + jiffies; } usleep_range(1000, 2000); } @@ -6196,7 +6196,7 @@ static int pqi_wait_for_lun_reset_completion(struct pqi_ctrl_info *ctrl_info, while (1) { if (wait_for_completion_io_timeout(wait, - PQI_LUN_RESET_POLL_COMPLETION_SECS * PQI_HZ)) { + PQI_LUN_RESET_POLL_COMPLETION_SECS * HZ)) { rc = 0; break; } @@ -7994,7 +7994,7 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info) return rc; } sis_soft_reset(ctrl_info); - msleep(PQI_POST_RESET_DELAY_SECS * PQI_HZ); + ssleep(PQI_POST_RESET_DELAY_SECS); } else { rc = pqi_force_sis_mode(ctrl_info); if (rc) diff --git a/drivers/scsi/smartpqi/smartpqi_sis.c b/drivers/scsi/smartpqi/smartpqi_sis.c index d66eb8ea161c..e176a1a0534d 100644 --- a/drivers/scsi/smartpqi/smartpqi_sis.c +++ b/drivers/scsi/smartpqi/smartpqi_sis.c @@ -92,7 +92,7 @@ static int sis_wait_for_ctrl_ready_with_timeout(struct pqi_ctrl_info *ctrl_info, unsigned long timeout; u32 status; - timeout = (timeout_secs * PQI_HZ) + jiffies; + timeout = (timeout_secs * HZ) + jiffies; while (1) { status = readl(&ctrl_info->registers->sis_firmware_status); @@ -209,7 +209,7 @@ static int sis_send_sync_cmd(struct pqi_ctrl_info *ctrl_info, * the top of the loop in order to give the controller time to start * processing the command before we start polling. */ - timeout = (SIS_CMD_COMPLETE_TIMEOUT_SECS * PQI_HZ) + jiffies; + timeout = (SIS_CMD_COMPLETE_TIMEOUT_SECS * HZ) + jiffies; while (1) { msleep(SIS_CMD_COMPLETE_POLL_INTERVAL_MSECS); doorbell = readl(®isters->sis_ctrl_to_host_doorbell); @@ -355,7 +355,7 @@ static int sis_wait_for_doorbell_bit_to_clear( u32 doorbell_register; unsigned long timeout; - timeout = (SIS_DOORBELL_BIT_CLEAR_TIMEOUT_SECS * PQI_HZ) + jiffies; + timeout = (SIS_DOORBELL_BIT_CLEAR_TIMEOUT_SECS * HZ) + jiffies; while (1) { doorbell_register = @@ -452,7 +452,7 @@ int sis_wait_for_fw_triage_completion(struct pqi_ctrl_info *ctrl_info) enum sis_fw_triage_status status; unsigned long timeout; - timeout = (SIS_FW_TRIAGE_STATUS_TIMEOUT_SECS * PQI_HZ) + jiffies; + timeout = (SIS_FW_TRIAGE_STATUS_TIMEOUT_SECS * HZ) + jiffies; while (1) { status = sis_read_firmware_triage_status(ctrl_info); if (status == FW_TRIAGE_COND_INVALID) { From patchwork Tue Feb 1 21:48:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E0C4C433EF for ; Tue, 1 Feb 2022 21:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236439AbiBAVsf (ORCPT ); Tue, 1 Feb 2022 16:48:35 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:19926 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236393AbiBAVse (ORCPT ); Tue, 1 Feb 2022 16:48:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752114; x=1675288114; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pITlBycQY8G9WEbV9LzMe+lca6eLk4z69yWy0dPWgRg=; b=J2LfXveVpx0WUFAjw4MxzhSkw6mIvxYEIvQgMiGvIjAoMU2CjswAPR/a COAMufF6jhTRoRPVe27GaFz64K8p2yUtB9yMWLuf02bCMCcWcme7q53Qz G1C3eCHpdI6lErIEC+t1UkiSjRdy3SQUTLvvshp/c4+/c/OObrXP558dg jnFeUtkP1iU18iOEuT6Vh9yUzNIqSpFDvmzfcr/T6cX4EBrQH+zVaboFR tqSqsqN0h3fF4WTd2Hwm1iHH074I50vS8YZy6Wt3tAzUPvFyEGTHhoJqd vS/1cQg77pLRkzMuLu6KBjz8QiA9JXFp5N63tWXz7S3llD8QsNUbaAGxv g==; IronPort-SDR: a4mrNviVTf8TYJu51oSwbCrEfDTNIh9VoNzSTMDwCIfozjzGHef7QzELOP0vAjLzkkkN/IDfJT kHPGbAZKcSYMebnlO89zqt1gS4WPA7Uo3r7ihq/jn1w10IfDACvzW9KKXUwLl5WYnaQs0EvjJg xyf8vIj0EEf3Dpeg0THv2iBgK38rHWtwn7XFj5XXyrAjwmUDSa6R57Fe+sbegUcUxYqTV5JzwO 5ZugQB+mv5D10Zx75DBvbkH/V4JtsAE68pXxRjCvR8GxXtO9kEUexzZgkE0Qn8/mq8A19/1Uah l12K5z0TP8e0PcLJzi+x0L6j X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="152163268" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:33 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:33 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:33 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 5168F70236E; Tue, 1 Feb 2022 15:48:33 -0600 (CST) Subject: [PATCH 09/18] smartpqi: avoid drive spin-down during suspend From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:33 -0600 Message-ID: <164375211330.440833.7203813692110347698.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Sagar Biradar Avoid drive spin-down during system RESTARTs. On certain systems (based on PCI IDs), when the OS transitions the system into the suspend (S3) state, the BMIC flush cache command will indicate a system RESTART instead of SUSPEND. This avoids drive spin-down. Reviewed-by: Kevin Barnett Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Sagar Biradar Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index b32a5a5a5c21..ab12507da436 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -8976,10 +8976,19 @@ static void pqi_process_module_params(void) pqi_process_lockup_action_param(); } +static inline enum bmic_flush_cache_shutdown_event pqi_get_flush_cache_shutdown_event(struct pci_dev *pci_dev) +{ + if (pci_dev->subsystem_vendor == PCI_VENDOR_ID_ADAPTEC2 && pci_dev->subsystem_device == 0x1304) + return RESTART; + return SUSPEND; +} + static __maybe_unused int pqi_suspend(struct pci_dev *pci_dev, pm_message_t state) { struct pqi_ctrl_info *ctrl_info; + enum bmic_flush_cache_shutdown_event shutdown_event; + shutdown_event = pqi_get_flush_cache_shutdown_event(pci_dev); ctrl_info = pci_get_drvdata(pci_dev); pqi_wait_until_ofa_finished(ctrl_info); @@ -8989,7 +8998,7 @@ static __maybe_unused int pqi_suspend(struct pci_dev *pci_dev, pm_message_t stat pqi_ctrl_block_device_reset(ctrl_info); pqi_ctrl_block_requests(ctrl_info); pqi_ctrl_wait_until_quiesced(ctrl_info); - pqi_flush_cache(ctrl_info, SUSPEND); + pqi_flush_cache(ctrl_info, shutdown_event); pqi_stop_heartbeat_timer(ctrl_info); pqi_crash_if_pending_command(ctrl_info); From patchwork Tue Feb 1 21:48:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 609E4C433EF for ; Tue, 1 Feb 2022 21:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236463AbiBAVsj (ORCPT ); Tue, 1 Feb 2022 16:48:39 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:31008 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236420AbiBAVsj (ORCPT ); Tue, 1 Feb 2022 16:48:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752119; x=1675288119; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DEZbWvlQ/b7VBOwfF76O610SkYzx53clfPETm3e6phs=; b=tR7t/N4QvS6ffh8P/++Pl3eDqFrbP4gknHuoBYW5hdnSAi7r/ZD9kelM tUstb6AS8yVxrbhGwjzowEaZcd22DTzBQO0TIyGzYfyIcVRZ3G+9jP2qD 0HFBzn1b1UMvM3lQlQ/oAyg1mdYR/vAFP6XEddzBbLC4s0+pNzzcCk/3m prauAo52UCbK2rEW1j//AZPWmhG89XVNqB8ON/xaFzezU0uMhenJiSdkv drjtGCylfrHb0VnP7MKM0KL7i7dpr2LMLHNMlLfYCIhnShT+qtgSfCsF8 x6ZD+j80LYQBXryk0M6T2967eYNOZK0fuLRsAKjqQHBLC1QxpIlbg00xm Q==; IronPort-SDR: kVkdxCXPYTyLpW/SkgnTPB1qpbBL4sV5NWARI+1ru2m1mEFAZFNvF12epl2aIwkplcs+7W7T8V KIO3O/oh7BAIoF4VD0nMoNO+PzWTs5IIXeC0vauFKbllXzfb5ZHbBTL8hMYrPeWT54iJ23hUsA D8923uGz4QPEDxeLBks33JJe8TsP4tGko29B+MNFidUSMJEnMTAObCLIfoGwrP/Ud9YxPERSk3 gBgy46rBekdLbHM3KFxCAwAj48agd0lPY3u0vikn8Wmty/y8D9HprJBhvTmgMr7YDvits9EouL 2+4Jr2teyyeGddqmHQg59B74 X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="151639093" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:38 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:38 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:38 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 5AF7270236E; Tue, 1 Feb 2022 15:48:38 -0600 (CST) Subject: [PATCH 10/18] smartpqi: update volume size after expansion From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:38 -0600 Message-ID: <164375211833.440833.17023155389220583731.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Mahesh Rajashekhara Rescan devices after volume expansion. After modifying logical volume size, lsblk command still shows up previous size of logical volume. When driver gets any event from f/w, driver schedules rescan worker with delay of 10 seconds. If array expansion is so quick and gets complete in a second, driver could not catch logical volume expansion due to worker delay. Since driver does not detect volume expansion, driver would not call rescan device to update new size to the OS. Reviewed-by: Kevin Barnett Reviewed-by: Mike McGowen Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Mahesh Rajashekhara Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi.h | 1 + drivers/scsi/smartpqi/smartpqi_init.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h index 81ec5fbf570a..4f6e48854c66 100644 --- a/drivers/scsi/smartpqi/smartpqi.h +++ b/drivers/scsi/smartpqi/smartpqi.h @@ -1322,6 +1322,7 @@ struct pqi_ctrl_info { bool controller_online; bool block_requests; bool scan_blocked; + u8 logical_volume_rescan_needed : 1; u8 inbound_spanning_supported : 1; u8 outbound_spanning_supported : 1; u8 pqi_mode_enabled : 1; diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index ab12507da436..de53180fab9c 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2015,8 +2015,8 @@ static void pqi_dev_info(struct pqi_ctrl_info *ctrl_info, /* Assumes the SCSI device list lock is held. */ -static void pqi_scsi_update_device(struct pqi_scsi_dev *existing_device, - struct pqi_scsi_dev *new_device) +static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info, + struct pqi_scsi_dev *existing_device, struct pqi_scsi_dev *new_device) { existing_device->device_type = new_device->device_type; existing_device->bus = new_device->bus; @@ -2026,9 +2026,8 @@ static void pqi_scsi_update_device(struct pqi_scsi_dev *existing_device, existing_device->target_lun_valid = true; } - if ((existing_device->volume_status == CISS_LV_QUEUED_FOR_EXPANSION || - existing_device->volume_status == CISS_LV_UNDERGOING_EXPANSION) && - new_device->volume_status == CISS_LV_OK) + if (pqi_is_logical_device(existing_device) && + ctrl_info->logical_volume_rescan_needed) existing_device->rescan = true; /* By definition, the scsi3addr and wwid fields are already the same. */ @@ -2146,7 +2145,7 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info, */ device->new_device = false; matching_device->device_gone = false; - pqi_scsi_update_device(matching_device, device); + pqi_scsi_update_device(ctrl_info, matching_device, device); break; case DEVICE_NOT_FOUND: /* @@ -2218,8 +2217,8 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info, } /* - * Notify the SCSI ML if the queue depth of any existing device has - * changed. + * Notify the SML of any existing device changes such as; + * queue depth, device size. */ list_for_each_entry(device, &ctrl_info->scsi_device_list, scsi_device_list_entry) { if (device->sdev && device->queue_depth != device->advertised_queue_depth) { @@ -2248,6 +2247,9 @@ static void pqi_update_device_list(struct pqi_ctrl_info *ctrl_info, } } } + + ctrl_info->logical_volume_rescan_needed = false; + } static inline bool pqi_is_supported_device(struct pqi_scsi_dev *device) @@ -3703,6 +3705,8 @@ static void pqi_event_worker(struct work_struct *work) } else { ack_event = true; rescan_needed = true; + if (event->event_type == PQI_EVENT_TYPE_LOGICAL_DEVICE) + ctrl_info->logical_volume_rescan_needed = true; } if (ack_event) pqi_acknowledge_event(ctrl_info, event); From patchwork Tue Feb 1 21:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EB3FC433F5 for ; Tue, 1 Feb 2022 21:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235481AbiBAVso (ORCPT ); Tue, 1 Feb 2022 16:48:44 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:31008 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235300AbiBAVso (ORCPT ); Tue, 1 Feb 2022 16:48:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752124; x=1675288124; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=55GNMhVo0eq8tWzrWM4uU9abRD43u7HxSrKCAQWIO74=; b=IoXu9qZxcz7/GuBz5KF94+BvLEmtq28p2kW3Foguy7HU2hNzDLXiHgGW BP/j0Ws8TZX7tx5ZqG2hO0Cr7a6t9aiOuGmBwd73wGaXTd0/7rirW4EN7 fZFZwH4wtk8DFirNlyrHCHq5RXrmQnyMrknyaRSMLXH/rlv+FtBE8bTDJ h9BnpGFAegQ7bBR64i20dJfRD6bcNdsvwYU4Wk42EgN71Op8raoWHHgT6 Fq8bMNBpV+8N3aX7nMHDMGp3xmdE8QhluRWFzNRWPGqF09B1GKuQc6AS+ RGbbIu/HQXPFoI1XPn7Nr8g/Z78WdZHS67/ZhtigT/wP017OEsMPpggQ5 w==; IronPort-SDR: 322xLewW2QjTHhLVpITwcdd/lLJWoFhrEBLeFackYE6pd04t66xGFrR4uueedvd4WY9qRa/7IN bCEAsh2wp/06/5DeQeYjz46RUFHFZSozy03EPmiuvkmrXmzlnaxauiDchx5LmoZAQYpeIU06Sw xb8TLOfjva/fsyCjWfXJYuO2AtdxJC19FUnOCe/lWue0YXmUI2l6bLuMbZ+v7OBUolIc569AgP n9RvJa2loS5yg5NpQI+vclEkGnOguGLPtTnMiDgdbsEgDePORXBu0wROkY6S0LUFgmPD+dfTxq DI4iFVHgERZz6ZMrU7RWaqyh X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="151639105" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:44 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:43 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:43 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 655A970236E; Tue, 1 Feb 2022 15:48:43 -0600 (CST) Subject: [PATCH 11/18] smartpqi: fix kdump issue when ctrl is locked up From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:43 -0600 Message-ID: <164375212337.440833.11955356190354940369.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Mahesh Rajashekhara Avoid dropping into shell if the controller is in locked up state. Driver issues SIS soft reset to bring back the controller to SIS mode while OS boots into kdump mode. If the controller is in lockup state, SIS soft reset does not work. Since the controller lockup code has not been cleared, driver considers the firmware is no longer up and running. Driver returns back an error code to OS and the kdump fails. Reviewed-by: Kevin Barnett Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Mahesh Rajashekhara Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 39 +++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index de53180fab9c..8bd4de6306db 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -7986,6 +7986,21 @@ static int pqi_force_sis_mode(struct pqi_ctrl_info *ctrl_info) return pqi_revert_to_sis_mode(ctrl_info); } +static void pqi_perform_lockup_action(void) +{ + switch (pqi_lockup_action) { + case PANIC: + panic("FATAL: Smart Family Controller lockup detected"); + break; + case REBOOT: + emergency_restart(); + break; + case NONE: + default: + break; + } +} + static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info) { int rc; @@ -8010,8 +8025,15 @@ static int pqi_ctrl_init(struct pqi_ctrl_info *ctrl_info) * commands. */ rc = sis_wait_for_ctrl_ready(ctrl_info); - if (rc) + if (rc) { + if (reset_devices) { + dev_err(&ctrl_info->pci_dev->dev, + "kdump init failed with error %d\n", rc); + pqi_lockup_action = REBOOT; + pqi_perform_lockup_action(); + } return rc; + } /* * Get the controller properties. This allows us to determine @@ -8736,21 +8758,6 @@ static int pqi_ofa_ctrl_restart(struct pqi_ctrl_info *ctrl_info, unsigned int de return pqi_ctrl_init_resume(ctrl_info); } -static void pqi_perform_lockup_action(void) -{ - switch (pqi_lockup_action) { - case PANIC: - panic("FATAL: Smart Family Controller lockup detected"); - break; - case REBOOT: - emergency_restart(); - break; - case NONE: - default: - break; - } -} - static struct pqi_raid_error_info pqi_ctrl_offline_raid_error_info = { .data_out_result = PQI_DATA_IN_OUT_HARDWARE_ERROR, .status = SAM_STAT_CHECK_CONDITION, From patchwork Tue Feb 1 21:48:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46CFFC433F5 for ; Tue, 1 Feb 2022 21:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235553AbiBAVst (ORCPT ); Tue, 1 Feb 2022 16:48:49 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:24300 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235300AbiBAVst (ORCPT ); Tue, 1 Feb 2022 16:48:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752129; x=1675288129; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nlM/by5K+QNRXVBGCL1PTrOaWFRVxhjKDW8gDGcHaiA=; b=T9SjhXslgDaJFb49mcBGzj7qufSi9SAnoSWxQJtA1dvAxlTKLFVec+05 Wi/pYJt08hRlPWjOCkhSe5ZSC4H8CQj8G+PPFR9egIcb7BTl7LwPLkZkp vYKONMYTEeXZpCv1J9cm2bOlq1Bz/+gG9YFeOW7VxsTQmvtG/4JlKT1PJ duLYXf/4Rby+1urfY6nmNuLEMRPr7hpCf9q4FyhpKYwGwhuYAqyG7WNKE bE+aghyvDm7C7gBwZwGmvOZh1epaC8t+7QgeC4ATXZyFWyAOYNiSea28U 8bhOYIegsCNH0MdFVxrSABpiSV+URdTh45EOM5W+hlFkn83KSn5rg++aj Q==; IronPort-SDR: PRX+a0Qvq6NhLOnY7Cp/0TxLBIPl1w8OdzKyNn5JKDh3DOzDrSqCoine2MAwV9/bI3eBJqxk2N FsOk4i56xXd6lcZR8RY9l6dtjK0uXyo/4bsCe3k7a0de9w0+ECcdcqDbt5AMxDVNwHNN4LUdAw UMijkp/uUSdxWtO7bM/hYVZ6xd1x0/er2CBh6EA7LB5C/FPvrHCOoCxgEaMDEVNMdAAfwgkSsV a99t1O+oBqTGt6zbpfpJjdT24ENwwi0s8DzN493hsBvxpbIeJyO/m/G88NQzaoyUYzH/kGK3yn m8DNRGwOJRibHrWGL1z/xTAO X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="144582881" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:48 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:48 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:48 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 6F08570236E; Tue, 1 Feb 2022 15:48:48 -0600 (CST) Subject: [PATCH 12/18] smartpqi: speed up RAID 10 sequential reads From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:48 -0600 Message-ID: <164375212842.440833.6733971458765002128.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Mike McGowen Use all data disks for sequential read operations. Testing discovered inconsistent performance on RAID 10 volumes when performing 256K sequential reads. The driver was only using a single tracker to determine which physical drive to send a request to for AIO requests. Change the single tracker (next_bypass_group) to an array of trackers based on the number of data disks in a row of the RAID map. Reviewed-by: Kevin Barnett Reviewed-by: Mike McGowen Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Mike McGowen Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi.h | 5 +++-- drivers/scsi/smartpqi/smartpqi_init.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h index 4f6e48854c66..826c4001bac2 100644 --- a/drivers/scsi/smartpqi/smartpqi.h +++ b/drivers/scsi/smartpqi/smartpqi.h @@ -918,7 +918,8 @@ union pqi_reset_register { #define PQI_MAX_TRANSFER_SIZE (1024U * 1024U) #define PQI_MAX_TRANSFER_SIZE_KDUMP (512 * 1024U) -#define RAID_MAP_MAX_ENTRIES 1024 +#define RAID_MAP_MAX_ENTRIES 1024 +#define RAID_MAP_MAX_DATA_DISKS_PER_ROW 128 #define PQI_PHYSICAL_DEVICE_BUS 0 #define PQI_RAID_VOLUME_BUS 1 @@ -1125,7 +1126,7 @@ struct pqi_scsi_dev { u8 ncq_prio_support; bool raid_bypass_configured; /* RAID bypass configured */ bool raid_bypass_enabled; /* RAID bypass enabled */ - u32 next_bypass_group; + u32 next_bypass_group[RAID_MAP_MAX_DATA_DISKS_PER_ROW]; struct raid_map *raid_map; /* RAID bypass map */ u32 max_transfer_encrypted; diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 8bd4de6306db..18c695202c52 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2058,7 +2058,7 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info, sizeof(existing_device->box)); memcpy(existing_device->phys_connector, new_device->phys_connector, sizeof(existing_device->phys_connector)); - existing_device->next_bypass_group = 0; + memset(existing_device->next_bypass_group, 0, sizeof(existing_device->next_bypass_group)); kfree(existing_device->raid_map); existing_device->raid_map = new_device->raid_map; existing_device->raid_bypass_configured = @@ -2963,11 +2963,11 @@ static int pqi_raid_bypass_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info, if (rmd.is_write) { pqi_calc_aio_r1_nexus(raid_map, &rmd); } else { - group = device->next_bypass_group; + group = device->next_bypass_group[rmd.map_index]; next_bypass_group = group + 1; if (next_bypass_group >= rmd.layout_map_count) next_bypass_group = 0; - device->next_bypass_group = next_bypass_group; + device->next_bypass_group[rmd.map_index] = next_bypass_group; rmd.map_index += group * rmd.data_disks_per_row; } } else if ((device->raid_level == SA_RAID_5 || From patchwork Tue Feb 1 21:48:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00AC0C433EF for ; Tue, 1 Feb 2022 21:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235562AbiBAVsz (ORCPT ); Tue, 1 Feb 2022 16:48:55 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:39875 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235300AbiBAVsy (ORCPT ); Tue, 1 Feb 2022 16:48:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752134; x=1675288134; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EUtA/YtUkif9sUP59gUGSDmEapkZ3sVZMoaxZyr6094=; b=Dm5Mnf0Q6ET2OtQ8A5xfDzdH8x5e/uFxH6Rk8lfARZvFMvbxFXITKYC9 4vcxiPf7cvFH6KTZdEDf7HeaChfpCzE7YirMgIpNEugdBu8QEEU7AM1kr UOSTeiSMu3wtdGw9jdxIpb1ErGpB0DUD6IhGjOghcS5Djp7yEnRe4NWHu KegYpzmO1/ULGkY/vUggT6JKDirCdlK7MZAXHkWnjCix3bYlWgIdA+YMb cOC676a5HhUahD1iDq2tg2eB5C45e+k2/bl0NchJxHnbu8rcU4J7njpy2 hzMXDX7ecCDZBUVyTWTl/dwl4JcY1vfF20l93uXyVFvewnhkpcXCyiyoF A==; IronPort-SDR: Q33TkUd4WDwqZ+CcOFYLELOrvz5sPB6URoo7aXVqH1tpQkHH8BRmNJUy+2MfJnxvHiDnpndT7i kHsufpPMZ8EaXHMYOB1yshJFa6it7pM+i1XvyF6EIqXVUhRbt7WEreGOXFOhw4q0MYzOiL2awA qZjqswzBBd9lq/Siew4dpUJ/TaJaquLqA2K2tzGKQxQbH+uLkvrbRdlxQ+4JKOAmXAwfdQvmQ+ jdWXUxxukhK7kiMC14FUNO+yUKMGQpYD+PzMMTSC31EO6Ata2aJqRL6IomsbSfrEAzneca4VVC o3tDmeuYZI/E65otuUv3ypSx X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="160764729" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:54 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:53 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:53 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 7A11870236E; Tue, 1 Feb 2022 15:48:53 -0600 (CST) Subject: [PATCH 13/18] smartpqi: expose SAS address for SATA drives From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:53 -0600 Message-ID: <164375213346.440833.12379222470149882747.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Kevin Barnett Remove UNIQUE_WWID_IN_REPORT_PHYS_LUN PQI feature. This feature was originally added to solve a problem with NVMe drives, but this problem has since been solved a different way, so this PQI feature is no longer required for any type of drive. Linux kernel was not creating symbolic links in sysfs between SATA drives and their enclosure. The driver was enabling the UNIQUE_WWID_IN_REPORT_PHYS_LUN PQI feature, which causes the FW to return a WWID for SATA drives that is derived from a unique ID read from the SATA drive itself. The driver was exposing this WWID as the drive's SAS address. However, because this SAS address does not match the SAS address returned by an enclosure's SES Page 0xA data, the Linux kernel was not able to match a SATA drive with its enclosure. Reviewed-by: Mike McGowen Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi.h | 2 -- drivers/scsi/smartpqi/smartpqi_init.c | 43 ++------------------------------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h index 826c4001bac2..c4c48272d8ad 100644 --- a/drivers/scsi/smartpqi/smartpqi.h +++ b/drivers/scsi/smartpqi/smartpqi.h @@ -1141,7 +1141,6 @@ struct pqi_scsi_dev { struct pqi_stream_data stream_data[NUM_STREAMS_PER_LUN]; atomic_t scsi_cmds_outstanding; atomic_t raid_bypass_cnt; - u8 page_83_identifier[16]; }; /* VPD inquiry pages */ @@ -1331,7 +1330,6 @@ struct pqi_ctrl_info { u8 soft_reset_handshake_supported : 1; u8 raid_iu_timeout_supported : 1; u8 tmf_iu_timeout_supported : 1; - u8 unique_wwid_in_report_phys_lun_supported : 1; u8 firmware_triage_supported : 1; u8 rpl_extended_format_4_5_supported : 1; u8 enable_r1_writes : 1; diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 18c695202c52..76ad919b0812 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -1588,9 +1588,6 @@ static int pqi_get_physical_device_info(struct pqi_ctrl_info *ctrl_info, sizeof(device->phys_connector)); device->bay = id_phys->phys_bay_in_box; - memcpy(&device->page_83_identifier, &id_phys->page_83_identifier, - sizeof(device->page_83_identifier)); - if ((id_phys->even_more_flags & PQI_DEVICE_PHY_MAP_SUPPORTED) && id_phys->phy_count) device->phy_id = @@ -2281,18 +2278,6 @@ static inline void pqi_mask_device(u8 *scsi3addr) scsi3addr[3] |= 0xc0; } -static inline bool pqi_is_device_with_sas_address(struct pqi_scsi_dev *device) -{ - switch (device->device_type) { - case SA_DEVICE_TYPE_SAS: - case SA_DEVICE_TYPE_EXPANDER_SMP: - case SA_DEVICE_TYPE_SES: - return true; - } - - return false; -} - static inline bool pqi_is_multipath_device(struct pqi_scsi_dev *device) { if (pqi_is_logical_device(device)) @@ -2306,17 +2291,6 @@ static inline bool pqi_expose_device(struct pqi_scsi_dev *device) return !device->is_physical_device || !pqi_skip_device(device->scsi3addr); } -static inline void pqi_set_physical_device_wwid(struct pqi_ctrl_info *ctrl_info, - struct pqi_scsi_dev *device, struct report_phys_lun_16byte_wwid *phys_lun) -{ - if (ctrl_info->unique_wwid_in_report_phys_lun_supported || - ctrl_info->rpl_extended_format_4_5_supported || - pqi_is_device_with_sas_address(device)) - memcpy(device->wwid, phys_lun->wwid, sizeof(device->wwid)); - else - memcpy(&device->wwid[8], device->page_83_identifier, 8); -} - static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info) { int i; @@ -2484,7 +2458,7 @@ static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info) pqi_assign_bus_target_lun(device); if (device->is_physical_device) { - pqi_set_physical_device_wwid(ctrl_info, device, phys_lun); + memcpy(device->wwid, phys_lun->wwid, sizeof(device->wwid)); if ((phys_lun->device_flags & CISS_REPORT_PHYS_DEV_FLAG_AIO_ENABLED) && phys_lun->aio_handle) { @@ -2497,8 +2471,7 @@ static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info) sizeof(device->volume_id)); } - if (pqi_is_device_with_sas_address(device)) - device->sas_address = get_unaligned_be64(&device->wwid[8]); + device->sas_address = get_unaligned_be64(&device->wwid[8]); new_device_list[num_valid_devices++] = device; } @@ -7087,7 +7060,7 @@ static ssize_t pqi_sas_address_show(struct device *dev, spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); device = sdev->hostdata; - if (!device || !pqi_is_device_with_sas_address(device)) { + if (!device) { spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); return -ENODEV; } @@ -7643,10 +7616,6 @@ static void pqi_ctrl_update_feature_flags(struct pqi_ctrl_info *ctrl_info, case PQI_FIRMWARE_FEATURE_TMF_IU_TIMEOUT: ctrl_info->tmf_iu_timeout_supported = firmware_feature->enabled; break; - case PQI_FIRMWARE_FEATURE_UNIQUE_WWID_IN_REPORT_PHYS_LUN: - ctrl_info->unique_wwid_in_report_phys_lun_supported = - firmware_feature->enabled; - break; case PQI_FIRMWARE_FEATURE_FW_TRIAGE: ctrl_info->firmware_triage_supported = firmware_feature->enabled; pqi_save_fw_triage_setting(ctrl_info, firmware_feature->enabled); @@ -7744,11 +7713,6 @@ static struct pqi_firmware_feature pqi_firmware_features[] = { .feature_bit = PQI_FIRMWARE_FEATURE_RAID_BYPASS_ON_ENCRYPTED_NVME, .feature_status = pqi_firmware_feature_status, }, - { - .feature_name = "Unique WWID in Report Physical LUN", - .feature_bit = PQI_FIRMWARE_FEATURE_UNIQUE_WWID_IN_REPORT_PHYS_LUN, - .feature_status = pqi_ctrl_update_feature_flags, - }, { .feature_name = "Firmware Triage", .feature_bit = PQI_FIRMWARE_FEATURE_FW_TRIAGE, @@ -7858,7 +7822,6 @@ static void pqi_ctrl_reset_config(struct pqi_ctrl_info *ctrl_info) ctrl_info->enable_r6_writes = false; ctrl_info->raid_iu_timeout_supported = false; ctrl_info->tmf_iu_timeout_supported = false; - ctrl_info->unique_wwid_in_report_phys_lun_supported = false; ctrl_info->firmware_triage_supported = false; ctrl_info->rpl_extended_format_4_5_supported = false; } From patchwork Tue Feb 1 21:48:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539528 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED76C433EF for ; Tue, 1 Feb 2022 21:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235633AbiBAVs7 (ORCPT ); Tue, 1 Feb 2022 16:48:59 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:19958 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235681AbiBAVs7 (ORCPT ); Tue, 1 Feb 2022 16:48:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752139; x=1675288139; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d4qmYxC+2pSAN2U2kE8TvUuaRcJQTWkrVblstSBcc3Q=; b=W4Z9qfdsFz/v0IsOtKiR1FdRLjmkABNiNfXz9EnhrcNkwO/7XklLmqv6 NEfSh644eWxYnLA9H0w3W5YXYNGSjfjX1yktkTBb2N/ZJKmIxkdWULwV5 aE9Tk1bXI3xVTGgCh4jWpLv15q8XyfoRLPveB3aQcL8UH3DHSPvKa2YX2 5KXH16BqIHdePNva7xrHZ1QuMhtKRPLaN60VPJHSr7gfC/4I8mzpLKNwh +40Lf0rFE+9GinZkS7nqQN+Llg5iKf5u0ZBlmb103FHDrtaZk02qhuaVw ko+CnWdB+zaqP6K82A+d0DpAROsCk8rUWAgeuPwuAk/BnC21Y3CgOnd5y w==; IronPort-SDR: 2GQQFaDxGp414F3VhqnhozMh+mXnREZxOBGtPs/YQZkn5WgiVhVS8YjXb4ESYSoMRvIHGqsjg5 vn6JyF+MPK4QaSHWiInyYh0e+KomsNeWqHDInM2ZscQ8apFJLF9BFLVI8bwYrEz0YDprtAb6Xz DDp7mk3dDQK+n223V+2u6fgqP77QsXyYFC70XJ3tsEhpet/mOQwAwPdrBUAKRgnA1727FXk6OR ZzJ3xvtOvum990rP+yYqSTv4dI/RBhkozbOz+kgshgwRQHDajQmH5PBXd5hLncyuQAxksyci/6 sRV8c9HJXLVWhpG+Zm/GQ0QL X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="152163289" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:48:59 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:48:58 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:48:58 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 84AB670236E; Tue, 1 Feb 2022 15:48:58 -0600 (CST) Subject: [PATCH 14/18] smartpqi: fix NUMA node not updated during init From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:48:58 -0600 Message-ID: <164375213850.440833.5243014942807747074.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Mike McGowen Correct NUMA node association when calling pqi_pci_probe(). In the function pqi_pci_probe(), the driver makes an OS call to get the NUMA node associated with a controller. If the call returns that there is no associated node, the driver attempts to set it to node 0. The problem is that a different local variable (cp_node) was being used to do this, but the original local variable (node) was still being used in the call to pqi_alloc_ctrl_info(). The value of "node" is not updated if the conditional after the call to dev_to_node() evaluates to TRUE. Reviewed-by: Kevin Barnett Reviewed-by: Scott Teel Signed-off-by: Mike McGowen Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 76ad919b0812..d886a9c860af 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -8811,7 +8811,7 @@ static int pqi_pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) { int rc; - int node, cp_node; + int node; struct pqi_ctrl_info *ctrl_info; pqi_print_ctrl_info(pci_dev, id); @@ -8830,10 +8830,10 @@ static int pqi_pci_probe(struct pci_dev *pci_dev, node = dev_to_node(&pci_dev->dev); if (node == NUMA_NO_NODE) { - cp_node = cpu_to_node(0); - if (cp_node == NUMA_NO_NODE) - cp_node = 0; - set_dev_node(&pci_dev->dev, cp_node); + node = cpu_to_node(0); + if (node == NUMA_NO_NODE) + node = 0; + set_dev_node(&pci_dev->dev, node); } ctrl_info = pqi_alloc_ctrl_info(node); From patchwork Tue Feb 1 21:49:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B79BFC433F5 for ; Tue, 1 Feb 2022 21:49:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235798AbiBAVtF (ORCPT ); Tue, 1 Feb 2022 16:49:05 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:24331 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235681AbiBAVtE (ORCPT ); Tue, 1 Feb 2022 16:49:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752144; x=1675288144; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vUA+jNzZpOc9M6v/r997xoceaLfTlf0TsKVQm2oh7aY=; b=UOX+DIMJC9cGS8/2GouliRzN+ITWHxjk0ZAL1Or3Scx2xtPtUxxDZL3w vLwVqdgiSEDfvJ7R78yzu+M1K1qRn7ctwuRwu+wU1B2Dh6jn2xkglMygg bnvtOat48P7hbltmG24F2/eTex0MsL8IWiC+uOFQegF7NHD6vxgx4gJ/R uvT0UVxJ4efdHj20syHFwoIZ9/BS33Eux1jMOChdnAmFooupTMqSxAHUm 8A8Ot6Hj3K1OmF5f81HZ7j22qz7bqyQrPJ38OgWZymtj9BUuyLp8rGTHa wRovjVufw4YWfjOkTChd5D2CL8L2A1ZVi/yJACMIReugAonPMc5W3YAmq A==; IronPort-SDR: rcNhhH+NOBtxorrEiNiD7/S4oDw6hVAQDq6TF8Eqk62PhBz5nZygANptBjSTsufHV8fooX7PfV 0/12FagiuXcNso5PcYGMBx31BwunO+TBuae+NKBuEuv2m0Dz7QxnFyeghhF76AxL1XTJf46xyv n8H1EwGG4fH6oyhpLO8THGGOReg1CTUklBBWeMSKr/CgNueXn6bDsgTjOVIA6MDHRLbbqtQgWE iGBAPZK/dE8Fy+718yc+cL11Q3C5ObCVcXq9veB9WXtgbcxKpyXlyBRcGnSx1uGSo7E6zt1mKC +ekkqbMRmXihsT2MM9s6SPSb X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="144582923" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:49:03 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:49:03 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:49:03 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 8F38070236E; Tue, 1 Feb 2022 15:49:03 -0600 (CST) Subject: [PATCH 15/18] smartpqi: fix BUILD_BUG_ON() statements From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:49:03 -0600 Message-ID: <164375214355.440833.13129778749209816497.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Mike McGowen Add calls to the functions at the beginning driver initialization. The BUILD_BUG_ON() statements that are currently in functions named verify_structures() in the modules smartpqi_init.c and smartpqi_sis.c do not work as currently implemented. Reviewed-by: Kevin Barnett Reviewed-by: Scott Teel Reviewed-by: Scott Benesh Signed-off-by: Mike McGowen Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 5 ++++- drivers/scsi/smartpqi/smartpqi_sis.c | 2 +- drivers/scsi/smartpqi/smartpqi_sis.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index d886a9c860af..29cef682bde9 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -54,6 +54,7 @@ MODULE_DESCRIPTION("Driver for Microchip Smart Family Controller version " MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL"); +static void pqi_verify_structures(void); static void pqi_take_ctrl_offline(struct pqi_ctrl_info *ctrl_info, enum pqi_ctrl_shutdown_reason ctrl_shutdown_reason); static void pqi_ctrl_offline_worker(struct work_struct *work); @@ -9703,6 +9704,8 @@ static int __init pqi_init(void) int rc; pr_info(DRIVER_NAME "\n"); + pqi_verify_structures(); + sis_verify_structures(); pqi_sas_transport_template = sas_attach_transport(&pqi_sas_transport_functions); if (!pqi_sas_transport_template) @@ -9726,7 +9729,7 @@ static void __exit pqi_cleanup(void) module_init(pqi_init); module_exit(pqi_cleanup); -static void __attribute__((unused)) verify_structures(void) +static void pqi_verify_structures(void) { BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers, sis_host_to_ctrl_doorbell) != 0x20); diff --git a/drivers/scsi/smartpqi/smartpqi_sis.c b/drivers/scsi/smartpqi/smartpqi_sis.c index e176a1a0534d..afc27adf68e9 100644 --- a/drivers/scsi/smartpqi/smartpqi_sis.c +++ b/drivers/scsi/smartpqi/smartpqi_sis.c @@ -479,7 +479,7 @@ int sis_wait_for_fw_triage_completion(struct pqi_ctrl_info *ctrl_info) return rc; } -static void __attribute__((unused)) verify_structures(void) +void sis_verify_structures(void) { BUILD_BUG_ON(offsetof(struct sis_base_struct, revision) != 0x0); diff --git a/drivers/scsi/smartpqi/smartpqi_sis.h b/drivers/scsi/smartpqi/smartpqi_sis.h index bd92ff49f385..5f3575261a8e 100644 --- a/drivers/scsi/smartpqi/smartpqi_sis.h +++ b/drivers/scsi/smartpqi/smartpqi_sis.h @@ -12,6 +12,7 @@ #if !defined(_SMARTPQI_SIS_H) #define _SMARTPQI_SIS_H +void sis_verify_structures(void); int sis_wait_for_ctrl_ready(struct pqi_ctrl_info *ctrl_info); int sis_wait_for_ctrl_ready_resume(struct pqi_ctrl_info *ctrl_info); bool sis_is_firmware_running(struct pqi_ctrl_info *ctrl_info); From patchwork Tue Feb 1 21:49:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D47E9C433F5 for ; Tue, 1 Feb 2022 21:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235681AbiBAVtM (ORCPT ); Tue, 1 Feb 2022 16:49:12 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:38057 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235861AbiBAVtJ (ORCPT ); Tue, 1 Feb 2022 16:49:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752150; x=1675288150; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D55vFEb7A8d2RxkfexGl1WSonCqbu4+XImcJ91asw9w=; b=l3AiXahygd1V7qk1MGoI2msbwZUI52uKJ0qR8vuqq8jA6nt7Tc7mIgUY RPfZkGxN2GE8GxpNck1VTSlFr8B8gzQQjSzUPMZ7N2i7EpDHc8Z5pEcxj 8wP2FSooubmaRUGEP3TmwWSOlwcvHCB2OSEKjkavuCuTjodZecdtpDumS 3w1d1TTIQdnoJdAw0C4c33klaMIPUQZymIZZJ1q1GqlfW5eNNQH4NRRB2 bcfU2qHhsPnVSvQUAIiyZMTE9H0j34lc8KEvaS4zutbMTql/yUhBEWzXF IsiVI15/LsqE5+UdsqwgeGbT4nur2itbd5FNB1kSBq8rSYl6Joc57mzBo A==; IronPort-SDR: g1uR+kUglifg5ZP7rFaOpB0MBkvytqrTlXkVajm+Iu7rJun6ylzL1PIshXDCxVTL/4zyK73Nek UtSTKSO2Nw6k3RgrphLVgBwm486o8OLI5ici4zv6tDjD0YvrTa9wySGu3fLGUfRi7QpnWDg9RA aqHP70iaBjJQZrUiTaz5lEuT6vaGE/Sj4vLDErxOQ5QJ87GuaFMubMkOzhft8DGZDw0eqa6YSI Etza+MVGMiAwy235zuPZ16m9AIk3YoogJFJ48mKAP6Fof/5+RwsfnENWK9OHbiGBcQNFHAddG4 AF/4pxYXjOMQNINWJQPXLYLm X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="147312742" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:49:09 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:49:08 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:49:08 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id 9A0DF70236E; Tue, 1 Feb 2022 15:49:08 -0600 (CST) Subject: [PATCH 16/18] smartpqi: fix hibernate and suspend From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:49:08 -0600 Message-ID: <164375214859.440833.14683009064111314948.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Kevin Barnett Restructure the hibernate/suspend code to allow work-arounds for the controller boot differences. Newer controllers have subtle differences in the way that they bootup. Reviewed-by: Mike McGowen Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 116 +++++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 29cef682bde9..3c3749fcb78c 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -8955,15 +8955,16 @@ static inline enum bmic_flush_cache_shutdown_event pqi_get_flush_cache_shutdown_ { if (pci_dev->subsystem_vendor == PCI_VENDOR_ID_ADAPTEC2 && pci_dev->subsystem_device == 0x1304) return RESTART; + return SUSPEND; } -static __maybe_unused int pqi_suspend(struct pci_dev *pci_dev, pm_message_t state) +static int pqi_suspend_or_freeze(struct device *dev, bool suspend) { + struct pci_dev *pci_dev; struct pqi_ctrl_info *ctrl_info; - enum bmic_flush_cache_shutdown_event shutdown_event; - shutdown_event = pqi_get_flush_cache_shutdown_event(pci_dev); + pci_dev = to_pci_dev(dev); ctrl_info = pci_get_drvdata(pci_dev); pqi_wait_until_ofa_finished(ctrl_info); @@ -8973,16 +8974,17 @@ static __maybe_unused int pqi_suspend(struct pci_dev *pci_dev, pm_message_t stat pqi_ctrl_block_device_reset(ctrl_info); pqi_ctrl_block_requests(ctrl_info); pqi_ctrl_wait_until_quiesced(ctrl_info); - pqi_flush_cache(ctrl_info, shutdown_event); - pqi_stop_heartbeat_timer(ctrl_info); - pqi_crash_if_pending_command(ctrl_info); + if (suspend) { + enum bmic_flush_cache_shutdown_event shutdown_event; - if (state.event == PM_EVENT_FREEZE) - return 0; + shutdown_event = pqi_get_flush_cache_shutdown_event(pci_dev); + pqi_flush_cache(ctrl_info, shutdown_event); + } - pci_save_state(pci_dev); - pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); + pqi_stop_heartbeat_timer(ctrl_info); + pqi_crash_if_pending_command(ctrl_info); + pqi_free_irqs(ctrl_info); ctrl_info->controller_online = false; ctrl_info->pqi_mode_enabled = false; @@ -8990,44 +8992,87 @@ static __maybe_unused int pqi_suspend(struct pci_dev *pci_dev, pm_message_t stat return 0; } -static __maybe_unused int pqi_resume(struct pci_dev *pci_dev) +static __maybe_unused int pqi_suspend(struct device *dev) +{ + return pqi_suspend_or_freeze(dev, true); +} + +static int pqi_resume_or_restore(struct device *dev) { int rc; + struct pci_dev *pci_dev; struct pqi_ctrl_info *ctrl_info; + pci_dev = to_pci_dev(dev); ctrl_info = pci_get_drvdata(pci_dev); - if (pci_dev->current_state != PCI_D0) { - ctrl_info->max_hw_queue_index = 0; - pqi_free_interrupts(ctrl_info); - pqi_change_irq_mode(ctrl_info, IRQ_MODE_INTX); - rc = request_irq(pci_irq_vector(pci_dev, 0), pqi_irq_handler, - IRQF_SHARED, DRIVER_NAME_SHORT, - &ctrl_info->queue_groups[0]); - if (rc) { - dev_err(&ctrl_info->pci_dev->dev, - "irq %u init failed with error %d\n", - pci_dev->irq, rc); - return rc; - } - pqi_ctrl_unblock_device_reset(ctrl_info); - pqi_ctrl_unblock_requests(ctrl_info); - pqi_scsi_unblock_requests(ctrl_info); - pqi_ctrl_unblock_scan(ctrl_info); - return 0; - } - - pci_set_power_state(pci_dev, PCI_D0); - pci_restore_state(pci_dev); + rc = pqi_request_irqs(ctrl_info); + if (rc) + return rc; pqi_ctrl_unblock_device_reset(ctrl_info); pqi_ctrl_unblock_requests(ctrl_info); pqi_scsi_unblock_requests(ctrl_info); pqi_ctrl_unblock_scan(ctrl_info); + ssleep(PQI_POST_RESET_DELAY_SECS); + return pqi_ctrl_init_resume(ctrl_info); } +static int pqi_freeze(struct device *dev) +{ + return pqi_suspend_or_freeze(dev, false); +} + +static int pqi_thaw(struct device *dev) +{ + int rc; + struct pci_dev *pci_dev; + struct pqi_ctrl_info *ctrl_info; + + pci_dev = to_pci_dev(dev); + ctrl_info = pci_get_drvdata(pci_dev); + + rc = pqi_request_irqs(ctrl_info); + if (rc) + return rc; + + ctrl_info->controller_online = true; + ctrl_info->pqi_mode_enabled = true; + + pqi_ctrl_unblock_device_reset(ctrl_info); + pqi_ctrl_unblock_requests(ctrl_info); + pqi_scsi_unblock_requests(ctrl_info); + pqi_ctrl_unblock_scan(ctrl_info); + + return 0; +} + +static int pqi_poweroff(struct device *dev) +{ + struct pci_dev *pci_dev; + struct pqi_ctrl_info *ctrl_info; + enum bmic_flush_cache_shutdown_event shutdown_event; + + pci_dev = to_pci_dev(dev); + ctrl_info = pci_get_drvdata(pci_dev); + + shutdown_event = pqi_get_flush_cache_shutdown_event(pci_dev); + pqi_flush_cache(ctrl_info, shutdown_event); + + return 0; +} + +static const struct dev_pm_ops pqi_pm_ops = { + .suspend = pqi_suspend, + .resume = pqi_resume_or_restore, + .freeze = pqi_freeze, + .thaw = pqi_thaw, + .poweroff = pqi_poweroff, + .restore = pqi_resume_or_restore, +}; + /* Define the PCI IDs for the controllers that we support. */ static const struct pci_device_id pqi_pci_id_table[] = { { @@ -9694,8 +9739,9 @@ static struct pci_driver pqi_pci_driver = { .remove = pqi_pci_remove, .shutdown = pqi_shutdown, #if defined(CONFIG_PM) - .suspend = pqi_suspend, - .resume = pqi_resume, + .driver = { + .pm = &pqi_pm_ops + }, #endif }; From patchwork Tue Feb 1 21:49:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9E11C433EF for ; Tue, 1 Feb 2022 21:49:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235804AbiBAVtP (ORCPT ); Tue, 1 Feb 2022 16:49:15 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:19460 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235633AbiBAVtO (ORCPT ); Tue, 1 Feb 2022 16:49:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752154; x=1675288154; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wAsYC5QOH2kOeg0M1oYXITgCcIFF0gm0jvXfnkEhXbE=; b=czjry+bQq4ZUCgttSetAp5YkOtZwopuNdgNPKiJKmGi+qs+luzo48Jy6 OMXgdvCaOp0S72Q0EAnQn1fl17pYr5gln9bZfto+goGvS2aX2U3078HAi P0/qlAg/RF7UnEhQQVneKD0S15SY3InvS94hA60PkvvUiK42OYDp3H9Dk ILYh5lw+bqg2VBHHqvWsS/3MTfOEDFQIihrcT7UnXxN0Xrdgss6O2zf+k ukZvXaWKIlAdgcNrB2lz9R2Zgv2Gap6Z0si3FG664HAWFSLp3SWQ1jeId 7caCcFFmPle4AJfmc52ffJsuEar/iwqzyHLcTQvkJetkiRp228GC2ZoF3 g==; IronPort-SDR: j65+Q+sbeywziUFDCAT7y1VZX0zGp9smm9s6M6JhzxJ/Su5LjXiYYMrlJjx4TmePERNEP5jW9N qN1rhaJfdm/4iECTDFyHkCYb2w7Oi+P2paxiI95DZSirMgmTvP2yRMhYIcMx6yRuBN0So5JDnE 2GiRFw12uyfAokCsJ92cftqqe4+3cJxNQxNCPpG5y6oA14lqzcvGGH0GJwNWq+GSgP1Ll82hiR 7EctZG7EiQ05nzIEpULpJW4GEy/Lypc5IXQRa+WXmajeu4oPHe+2vx+80vQl/vPDRs1zekv/0C 4KdFzm/KflUp23NCv8QmcCrj X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="84365841" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:49:14 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:49:13 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:49:13 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id A3F7570236E; Tue, 1 Feb 2022 15:49:13 -0600 (CST) Subject: [PATCH 17/18] smartpqi: fix lsscsi-t SAS addresses From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:49:13 -0600 Message-ID: <164375215363.440833.7298523719813806902.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Kevin Barnett Correct lsscsi -t output for newer controllers that support 16-byte WWID in the SAS address field. lsscsi -t was displaying all zeros for SAS addresses. When we added support to smartpqi for 16-byte WWIDs in the RPL data for newer controllers, we were copying the wrong part of the 16-byte WWID to the SAS address field. Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Mike McGowen Signed-off-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 3c3749fcb78c..be4e91aaaa52 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -1182,8 +1182,8 @@ static inline int pqi_report_phys_luns(struct pqi_ctrl_info *ctrl_info, void **b for (i = 0; i < num_physicals; i++) { memcpy(&rpl_16byte_wwid_list->lun_entries[i].lunid, &rpl_8byte_wwid_list->lun_entries[i].lunid, sizeof(rpl_8byte_wwid_list->lun_entries[i].lunid)); - memset(&rpl_16byte_wwid_list->lun_entries[i].wwid, 0, 8); - memcpy(&rpl_16byte_wwid_list->lun_entries[i].wwid[8], &rpl_8byte_wwid_list->lun_entries[i].wwid, sizeof(rpl_8byte_wwid_list->lun_entries[i].wwid)); + memcpy(&rpl_16byte_wwid_list->lun_entries[i].wwid[0], &rpl_8byte_wwid_list->lun_entries[i].wwid, sizeof(rpl_8byte_wwid_list->lun_entries[i].wwid)); + memset(&rpl_16byte_wwid_list->lun_entries[i].wwid[8], 0, 8); rpl_16byte_wwid_list->lun_entries[i].device_type = rpl_8byte_wwid_list->lun_entries[i].device_type; rpl_16byte_wwid_list->lun_entries[i].device_flags = rpl_8byte_wwid_list->lun_entries[i].device_flags; rpl_16byte_wwid_list->lun_entries[i].lun_count = rpl_8byte_wwid_list->lun_entries[i].lun_count; @@ -2472,7 +2472,7 @@ static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info) sizeof(device->volume_id)); } - device->sas_address = get_unaligned_be64(&device->wwid[8]); + device->sas_address = get_unaligned_be64(&device->wwid[0]); new_device_list[num_valid_devices++] = device; } From patchwork Tue Feb 1 21:49:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 539526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60E5EC433F5 for ; Tue, 1 Feb 2022 21:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235914AbiBAVtT (ORCPT ); Tue, 1 Feb 2022 16:49:19 -0500 Received: from esa.microchip.iphmx.com ([68.232.153.233]:52981 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235633AbiBAVtT (ORCPT ); Tue, 1 Feb 2022 16:49:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643752159; x=1675288159; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+KGe2ZJDWmjUSPvLX4NHi36PRKop/Mn9ZXqm7qBQDN4=; b=sE9A/i2euLS4zpGxSaz682soFUE+oDyXKZaAdZPg4c0o0KF+gGtuMisV spAvvmHwqsdYPMWn5rizNe7gtU2HPFoeeMtRik/DLnPTwfSirFXr7YiR3 c69ZUlQKk7MmBYgJwl6ZlNhnr7WuHQppYYoJx5TBZ210kmroqP67sm3Hs 4Gcvn5P8XYjNvAVEKy7p0C1Gq51ThH4tpQLQs0rjUzMv+NNA9wRoXpf3l KZHOEtjmjLsbLcSZSpuktUyLERGIZaxbHqKGT8SKQ6+XitC9QrIMKe9Z3 P20JFt2qTf3mtJWRGo/J8WFfcHrpQuhz4By/ZfJnCkedcQK3Fja8vmaMJ A==; IronPort-SDR: 2MFOorarGqA0vwvpKqi1ONeeeGEQXt3P0CxEK/uvo1WgIJiWrcd6f9G42/MnpY7MVOTz39/3ue fhdU2hi9J+cGTHY/AWksQE2irQje2idfyqvTOBp/GJukqzZJbn+jwTyFDq0z8P9ZF8WnHRhCEr 8qT6D+LG0YBn9Tq/xJnDLfJj+CVFMmTqXKucTYfRu3uo1VPKZegjUXwJq0RMGXMCzABns6G4H/ xpP02xWVQRz8IW0geIS1QaN82Rb3Cai4ZMfvTpfnbQzHMpGA8oZKqVDEus/UtHvNapG1hQPO6/ fD0Ff5FbqDIIItuh59H3QKeg X-IronPort-AV: E=Sophos;i="5.88,335,1635231600"; d="scan'208";a="151639164" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Feb 2022 14:49:19 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 1 Feb 2022 14:49:18 -0700 Received: from brunhilda.pdev.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 1 Feb 2022 14:49:18 -0700 Received: from brunhilda.pdev.net (localhost [127.0.0.1]) by brunhilda.pdev.net (Postfix) with ESMTP id AE8CB70236E; Tue, 1 Feb 2022 15:49:18 -0600 (CST) Subject: [PATCH 18/18] smartpqi: update version to 2.1.14-035 From: Don Brace To: , , , , , , , , , , , CC: Date: Tue, 1 Feb 2022 15:49:18 -0600 Message-ID: <164375215867.440833.17567317655622946368.stgit@brunhilda.pdev.net> In-Reply-To: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> References: <164375113574.440833.13174600317115819605.stgit@brunhilda.pdev.net> User-Agent: StGit/1.4.dev36+g39bf3b02665a MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Reviewed-by: Kevin Barnett Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Gerry Morong Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index be4e91aaaa52..61366642ea95 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -33,11 +33,11 @@ #define BUILD_TIMESTAMP #endif -#define DRIVER_VERSION "2.1.12-055" +#define DRIVER_VERSION "2.1.14-035" #define DRIVER_MAJOR 2 #define DRIVER_MINOR 1 -#define DRIVER_RELEASE 12 -#define DRIVER_REVISION 55 +#define DRIVER_RELEASE 14 +#define DRIVER_REVISION 35 #define DRIVER_NAME "Microchip SmartPQI Driver (v" \ DRIVER_VERSION BUILD_TIMESTAMP ")"