linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: [PATCH 0/3] PCI: Notify PCI drivers about powerdown during suspend
Date: Fri, 13 May 2022 16:30:24 +0530	[thread overview]
Message-ID: <20220513110027.31015-1-manivannan.sadhasivam@linaro.org> (raw)

Hi,

This series adds support for notifying the PCI drivers like NVMe about the
transition of PCI devices into powerdown mode during system suspend.

Background
----------

On Qcom SC7280 based Chrome platforms, the OS will turn off the power to all
PCIe devices during system suspend for aggressive powersaving. Currently, there
is no way for the PCI device drivers to learn about this situation. Some of the
drivers assume that the power will be retained and some others assume that the
power may be taken down.

We faced the issue with NVMe PCI driver, where the driver expects the NVMe
device to be in APST (Autonomous Power State Transition) state for power saving
during system suspend. So when the power goes down, the NVMe driver fails to
bringup the device during resume.

Previous work
-------------

We tried to fix this issue in a couple of ways:

1. The NVMe PCI driver checks for the existence of "StorageD3Enable" ACPI
property in the suspend path. If the property is found, the driver assumes that
the device may go to poweroff state and shutdowns the device accordingly.

As like the ACPI based systems, we also tried to get the support in place for
DT based systems. But that didn't get accepted:
https://lore.kernel.org/all/Yl+6V3pWuyRYuVV8@infradead.org/T/

2. Keith Busch proposed a module params based approach. The parameter when set,
will allow the driver to support APST during suspend. Absence of that parameter
will let the driver shutdown the device.

This also did not get accepted:
https://lore.kernel.org/linux-nvme/20220201165006.3074615-1-kbusch@kernel.org/

Proposal
--------

Christoph suggested to add a notification in the PCI/PM core to let the NVMe
driver know that the device will go into powerdown state during suspend.
https://lore.kernel.org/all/Yg0wklcJ3ed76Jbk@infradead.org/ 

Hence in this series, a "suspend_poweroff" flag is introduced in the host bridge
struct. When this flag is set by the PCI RC drivers, the PCI device driver like
NVMe can shutdown the device during suspend.

In the coming days, the usage of this flag could be extended to other PCI
drivers as well.

Testing
-------

This series has been tested on SC7280 IDP board connected to a NVMe PCI device.

Thanks,
Mani

Manivannan Sadhasivam (3):
  PCI: Add a flag to notify PCI drivers about powerdown during suspend
  PCI: dwc: qcom: Set suspend_poweroff flag for SC7280
  nvme-pci: Make use of "suspend_poweroff" flag during system suspend

 drivers/nvme/host/pci.c                | 3 ++-
 drivers/pci/controller/dwc/pcie-qcom.c | 6 ++++++
 include/linux/pci.h                    | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

-- 
2.25.1


             reply	other threads:[~2022-05-13 11:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 11:00 Manivannan Sadhasivam [this message]
2022-05-13 11:00 ` [PATCH 1/3] PCI: Add a flag to notify PCI drivers about powerdown during suspend Manivannan Sadhasivam
2022-05-16 20:18   ` Bjorn Helgaas
2022-05-17 15:09     ` Manivannan Sadhasivam
2022-05-17 17:24       ` Bjorn Helgaas
2022-05-18  3:59         ` Manivannan Sadhasivam
2022-05-26 20:48     ` Rob Herring
2022-05-13 11:00 ` [PATCH 2/3] PCI: dwc: qcom: Set suspend_poweroff flag for SC7280 Manivannan Sadhasivam
2022-05-16 20:19   ` Bjorn Helgaas
2022-05-17 15:11     ` Manivannan Sadhasivam
2022-05-17 17:18       ` Bjorn Helgaas
2022-05-18  3:52         ` Manivannan Sadhasivam
2022-05-18 16:50           ` Bjorn Helgaas
2022-05-18  8:43     ` Christoph Hellwig
2022-05-13 11:00 ` [PATCH 3/3] nvme-pci: Make use of "suspend_poweroff" flag during system suspend Manivannan Sadhasivam
2022-05-16  5:44 ` [PATCH 0/3] PCI: Notify PCI drivers about powerdown during suspend Christoph Hellwig
2022-05-16 20:15 ` Bjorn Helgaas

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=20220513110027.31015-1-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=lorenzo.pieralisi@arm.com \
    --cc=quic_krichai@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_vbadigan@quicinc.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).