]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nvme-pci: Use pci_suspend_retains_context() during suspend
authorManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Tue, 19 May 2026 08:11:23 +0000 (13:41 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 23 May 2026 11:54:25 +0000 (06:54 -0500)
pci_suspend_retains_context() lets PCI client drivers know if the platform
can retain the device context during suspend. This is decided based on
several factors like:

  - Firmware involvement at the end of suspend

  - Any platform limitation in waking from low power state (e.g., L1SS)

This API may be extended in the future to cover other platform specific
issues impacting the device low power mode during system suspend.

Use this API instead of checks like pm_suspend_via_firmware(). When
pci_suspend_retains_context() returns false, assume the platform cannot
retain the context and shutdown the controller. If it returns true, assume
that the context will be retained and keep the device in low power mode.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260519-l1ss-fix-v2-4-b2c3a4bdeb15@oss.qualcomm.com
drivers/nvme/host/pci.c

index db5fc9bf662723c806e304f5be4e4180c28740c6..a6664983ce5da0b5c7ee3ad680cb5eba7e7db7f9 100644 (file)
@@ -3915,6 +3915,7 @@ static int nvme_suspend(struct device *dev)
         * use host managed nvme power settings for lowest idle power if
         * possible. This should have quicker resume latency than a full device
         * shutdown.  But if the firmware is involved after the suspend or the
+        * platform has any limitation in waking from low power states or the
         * device does not support any non-default power states, shut down the
         * device fully.
         *
@@ -3923,7 +3924,7 @@ static int nvme_suspend(struct device *dev)
         * down, so as to allow the platform to achieve its minimum low-power
         * state (which may not be possible if the link is up).
         */
-       if (pm_suspend_via_firmware() || !ctrl->npss ||
+       if (!pci_suspend_retains_context(pdev) || !ctrl->npss ||
            !pcie_aspm_enabled(pdev) ||
            (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND))
                return nvme_disable_prepare_reset(ndev, true);