From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: bhelgaas@google.com, lorenzo.pieralisi@arm.com,
kbusch@kernel.org, hch@lst.de
Cc: linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
svarbanov@mm-sol.com, bjorn.andersson@linaro.org, axboe@fb.com,
quic_vbadigan@quicinc.com, quic_krichai@quicinc.com,
quic_nitirawa@quicinc.com, vidyas@nvidia.com, sagi@grimberg.me,
linux-pm@vger.kernel.org, rafael@kernel.org,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: [PATCH v2 2/3] nvme-pci: Make use of "suspend_poweroff" flag during system suspend
Date: Wed, 18 May 2022 18:49:12 +0530 [thread overview]
Message-ID: <20220518131913.26974-3-manivannan.sadhasivam@linaro.org> (raw)
In-Reply-To: <20220518131913.26974-1-manivannan.sadhasivam@linaro.org>
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@lst.de>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.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
next prev parent reply other threads:[~2022-05-18 13:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 13:19 [PATCH v2 0/3] PCI: Notify PCI drivers about powerdown during suspend Manivannan Sadhasivam
2022-05-18 13:19 ` [PATCH v2 1/3] PCI: Add a flag to notify " Manivannan Sadhasivam
2022-05-18 13:19 ` Manivannan Sadhasivam [this message]
2022-05-18 13:19 ` [PATCH v2 3/3] PCI: qcom: Add system PM support Manivannan Sadhasivam
2022-05-18 13:23 ` Christoph Hellwig
2022-05-18 13:27 ` Manivannan Sadhasivam
2022-05-18 13:27 ` [PATCH v2 0/3] PCI: Notify PCI drivers about powerdown during suspend Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220518131913.26974-3-manivannan.sadhasivam@linaro.org \
--to=manivannan.sadhasivam@linaro.org \
--cc=axboe@fb.com \
--cc=bhelgaas@google.com \
--cc=bjorn.andersson@linaro.org \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=quic_krichai@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_vbadigan@quicinc.com \
--cc=rafael@kernel.org \
--cc=sagi@grimberg.me \
--cc=svarbanov@mm-sol.com \
--cc=vidyas@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.