nvme-pci: use host managed power state for suspend
authorKeith Busch <keith.busch@intel.com>
Thu, 23 May 2019 15:27:35 +0000 (09:27 -0600)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 Jun 2019 09:08:38 +0000 (11:08 +0200)
commitd916b1be94b6dc8d293abed2451f3062f6af7551
treef2ea8685335294c5ea3e0e6053da188ece846117
parent7a1f46e3f75cff5042dfa1bb80c9929a0e412abc
nvme-pci: use host managed power state for suspend

The nvme pci driver prepares its devices for power loss during suspend
by shutting down the controllers. The power setting is deferred to
pci driver's power management before the platform removes power. The
suspend-to-idle mode, however, does not remove power.

NVMe devices that implement host managed power settings can achieve
lower power and better transition latencies than using generic PCI power
settings. Try to use this feature if the platform is not involved with
the suspend. If successful, restore the previous power state on resume.

Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Mario Limonciello <mario.limonciello@dell.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
[hch: fixed the compilation for the !CONFIG_PM_SLEEP case]
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c