[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220518131913.26974-3-manivannan.sadhasivam@linaro.org>
Date: Wed, 18 May 2022 18:49:12 +0530
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: bhelgaas@...gle.com, lorenzo.pieralisi@....com, kbusch@...nel.org,
hch@....de
Cc: linux-nvme@...ts.infradead.org, linux-pci@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
svarbanov@...sol.com, bjorn.andersson@...aro.org, axboe@...com,
quic_vbadigan@...cinc.com, quic_krichai@...cinc.com,
quic_nitirawa@...cinc.com, vidyas@...dia.com, sagi@...mberg.me,
linux-pm@...r.kernel.org, rafael@...nel.org,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Subject: [PATCH v2 2/3] nvme-pci: Make use of "suspend_poweroff" flag during system suspend
On some platforms like Chromebooks based on Qcom SC7280, the power to the
PCI devices will be taken off during system suspend. For these platforms,
the PCI RC will set the "system_poweroff" flag to notify the PCI device
drivers of the poweroff scenario.
Hence, make use of the flag in the system suspend path and if set, properly
shutdown the device.
Acked-by: Christoph Hellwig <hch@....de>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
---
Changes in v2:
* Added Ack from Christoph
* Reworded the commit message to include SC7280
drivers/nvme/host/pci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index d817ca17463e..381bf0c7cf8d 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3238,6 +3238,7 @@ static int nvme_suspend(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct nvme_dev *ndev = pci_get_drvdata(pdev);
+ struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus);
struct nvme_ctrl *ctrl = &ndev->ctrl;
int ret = -EBUSY;
@@ -3257,7 +3258,7 @@ static int nvme_suspend(struct device *dev)
* state (which may not be possible if the link is up).
*/
if (pm_suspend_via_firmware() || !ctrl->npss ||
- !pcie_aspm_enabled(pdev) ||
+ !pcie_aspm_enabled(pdev) || bridge->suspend_poweroff ||
(ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND))
return nvme_disable_prepare_reset(ndev, true);
--
2.25.1
Powered by blists - more mailing lists