lkml.org 
[lkml]   [2021]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] nvme-pci: Avoid to go into d3cold if device can't use npss.
Date
During suspend, if the device can't use npss, driver would put
controller to shutdown simply and let host to control power management.
After resume, host can't change power state of the closed controller
from D3cold to D0.
For these devices, just avoid to go deeper than d3hot.

Tested-by: Henrik Juul Hansen <hjhansen2020@gmail.com>
Signed-off-by: Koba Ko <koba.ko@canonical.com>
---
drivers/nvme/host/pci.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index a29b170701fc..caaf52051689 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -26,6 +26,7 @@
#include <linux/io-64-nonatomic-hi-lo.h>
#include <linux/sed-opal.h>
#include <linux/pci-p2pdma.h>
+#include <linux/pm_runtime.h>

#include "trace.h"
#include "nvme.h"
@@ -2958,6 +2959,15 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)

dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));

+ if (pm_suspend_via_firmware() || !dev->ctrl.npss ||
+ !pcie_aspm_enabled(pdev) ||
+ dev->nr_host_mem_descs ||
+ (dev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) {
+ pdev->d3cold_allowed = false;
+ pci_d3cold_disable(pdev);
+ pm_runtime_resume(&pdev->dev);
+ }
+
nvme_reset_ctrl(&dev->ctrl);
async_schedule(nvme_async_probe, dev);

--
2.25.1
\
 
 \ /
  Last update: 2021-05-20 05:34    [W:0.069 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site