[PATCH] Revert "nvme-pci: use simple suspend when a HMB is enabled"

From: Kai-Heng Feng
Date: Fri Jun 25 2021 - 01:30:03 EST


This reverts commit b97120b15ebd3de51325084136d3b9c3cce656d6.

There are at least two issues introduced by that commit.
Config space becomes inaccessible after s2idle:
[ 827.776792] nvme 0000:58:00.0: can't change power state from D3cold to D0 (config space inaccessible)
The NVMe in question is recovered correctly but PCIe ASPM setting is lost as result.

The second one is more severe, the NVMe becomes unreliable and cause the
rootfs unreadable after s2idle.

Since reset DMA is not possible on suspend/resume, revert the commit to
solve the regression.

Cc: Koba Ko <koba.ko@xxxxxxxxxxxxx>
BugLink: https://bugs.launchpad.net/bugs/1912057
BugLink: https://bugs.launchpad.net/bugs/1927866
Fixes: b97120b15ebd ("nvme-pci: use simple suspend when a HMB is enabled")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
---
drivers/nvme/host/pci.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index a29b170701fc6..72d2121f82068 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3079,15 +3079,9 @@ static int nvme_suspend(struct device *dev)
* the PCI bus layer to put it into D3 in order to take the PCIe link
* 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 a host memory buffer is enabled, shut down the device as the NVMe
- * specification allows the device to access the host memory buffer in
- * host DRAM from all power states, but hosts will fail access to DRAM
- * during S3.
*/
if (pm_suspend_via_firmware() || !ctrl->npss ||
!pcie_aspm_enabled(pdev) ||
- ndev->nr_host_mem_descs ||
(ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND))
return nvme_disable_prepare_reset(ndev, true);

--
2.31.1