nvme-pci: Add sleep quirk for Kingston drives
authorGeorg Gottleuber <ggo@tuxedocomputers.com>
Wed, 20 Sep 2023 08:52:10 +0000 (10:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Dec 2023 17:39:17 +0000 (18:39 +0100)
commit 107b4e063d78c300b21e2d5291b1aa94c514ea5b upstream.

Some Kingston NV1 and A2000 are wasting a lot of power on specific TUXEDO
platforms in s2idle sleep if 'Simple Suspend' is used.

This patch applies a new quirk 'Force No Simple Suspend' to achieve a
low power sleep without 'Simple Suspend'.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Georg Gottleuber <ggo@tuxedocomputers.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c

index 69f9e69..118bf08 100644 (file)
@@ -154,6 +154,11 @@ enum nvme_quirks {
         * No temperature thresholds for channels other than 0 (Composite).
         */
        NVME_QUIRK_NO_SECONDARY_TEMP_THRESH     = (1 << 19),
+
+       /*
+        * Disables simple suspend/resume path.
+        */
+       NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND      = (1 << 20),
 };
 
 /*
index 886c3fc..3d01290 100644 (file)
@@ -3093,6 +3093,18 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
                if ((dmi_match(DMI_BOARD_VENDOR, "LENOVO")) &&
                     dmi_match(DMI_BOARD_NAME, "LNVNB161216"))
                        return NVME_QUIRK_SIMPLE_SUSPEND;
+       } else if (pdev->vendor == 0x2646 && (pdev->device == 0x2263 ||
+                  pdev->device == 0x500f)) {
+               /*
+                * Exclude some Kingston NV1 and A2000 devices from
+                * NVME_QUIRK_SIMPLE_SUSPEND. Do a full suspend to save a
+                * lot fo energy with s2idle sleep on some TUXEDO platforms.
+                */
+               if (dmi_match(DMI_BOARD_NAME, "NS5X_NS7XAU") ||
+                   dmi_match(DMI_BOARD_NAME, "NS5x_7xAU") ||
+                   dmi_match(DMI_BOARD_NAME, "NS5x_7xPU") ||
+                   dmi_match(DMI_BOARD_NAME, "PH4PRX1_PH6PRX1"))
+                       return NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND;
        }
 
        return 0;
@@ -3133,7 +3145,9 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev,
        dev->dev = get_device(&pdev->dev);
 
        quirks |= check_vendor_combination_bug(pdev);
-       if (!noacpi && acpi_storage_d3(&pdev->dev)) {
+       if (!noacpi &&
+           !(quirks & NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND) &&
+           acpi_storage_d3(&pdev->dev)) {
                /*
                 * Some systems use a bios work around to ask for D3 on
                 * platforms that support kernel managed suspend.