From: Bjorn Helgaas <helgaas@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: Frank Li <Frank.li@nxp.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
imx@lists.linux.dev, bhelgaas@google.com,
devicetree@vger.kernel.org, gustavo.pimentel@synopsys.com,
kw@linux.com, leoyang.li@nxp.com,
linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
lorenzo.pieralisi@arm.com, minghuan.lian@nxp.com,
mingkai.hu@nxp.com, robh+dt@kernel.org, roy.zang@nxp.com,
shawnguo@kernel.org, zhiqiang.hou@nxp.com
Subject: Re: [PATCH v3 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions
Date: Thu, 20 Jul 2023 13:35:12 -0500 [thread overview]
Message-ID: <20230720183512.GA539111@bhelgaas> (raw)
In-Reply-To: <20230720162758.GD48270@thinkpad>
On Thu, Jul 20, 2023 at 09:57:58PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Jul 20, 2023 at 11:20:27AM -0500, Bjorn Helgaas wrote:
> > On Thu, Jul 20, 2023 at 09:37:38PM +0530, Manivannan Sadhasivam wrote:
> > ...
> > > To be precise, NVMe driver will shutdown the device if there is
> > > no ASPM support and keep it in low power mode otherwise (there
> > > are other cases as well but we do not need to worry).
> > >
> > > But here you are not checking for ASPM state in the suspend
> > > path, and just forcing the link to be in L2/L3 (thereby D3Cold)
> > > even though NVMe driver may expect it to be in low power state
> > > like ASPM/APST.
> > >
> > > So you should only put the link to L2/L3 if there is no ASPM
> > > support. Otherwise, you'll ending up with bug reports when users
> > > connect NVMe to it.
> >
> > Can you point me to the NVMe code that shuts down the device if
> > there's no ASPM support? That sounds interesting and of interest
> > to other drivers that want to do suspend.
>
> drivers/nvme/host/pci.c #3185
>
> Note that, with ACPI based systems and for a few SSDs the behavior
> may change (check NVME_QUIRK_SIMPLE_SUSPEND flag).
For posterity, since the filename and line number may change:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/nvme/host/pci.c?id=v6.4#n3185
static int nvme_suspend(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct nvme_dev *ndev = pci_get_drvdata(pdev);
struct nvme_ctrl *ctrl = &ndev->ctrl;
int ret = -EBUSY;
ndev->last_ps = U32_MAX;
/*
* The platform does not remove power for a kernel managed suspend so
* use host managed nvme power settings for lowest idle power if
* possible. This should have quicker resume latency than a full device
* shutdown. But if the firmware is involved after the suspend or the
* device does not support any non-default power states, shut down the
* device fully.
*
* If ASPM is not enabled for the device, shut down the device and allow
* 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 (pm_suspend_via_firmware() || !ctrl->npss ||
!pcie_aspm_enabled(pdev) ||
(ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND))
return nvme_disable_prepare_reset(ndev, true);
nvme_start_freeze(ctrl);
nvme_wait_freeze(ctrl);
nvme_sync_queues(ctrl);
...
Added by 4eaefe8c621c ("nvme-pci: Allow PCI bus-level PM to be used if
ASPM is disabled"): https://git.kernel.org/linus/4eaefe8c621c
next prev parent reply other threads:[~2023-07-20 18:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 16:41 [PATCH v3 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions Frank Li
2023-04-19 16:41 ` [PATCH v3 2/2] PCI: layerscape: Add power management support for ls1028a Frank Li
2023-05-12 14:47 ` [PATCH v3 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions Frank Li
2023-06-12 16:16 ` Frank Li
2023-07-17 14:05 ` Frank Li
2023-07-17 16:45 ` Manivannan Sadhasivam
2023-07-17 18:36 ` Frank Li
2023-07-18 10:04 ` Manivannan Sadhasivam
2023-07-19 19:16 ` Frank Li
2023-07-20 14:20 ` Manivannan Sadhasivam
2023-07-20 14:25 ` Manivannan Sadhasivam
2023-07-20 14:37 ` Frank Li
2023-07-20 16:07 ` Manivannan Sadhasivam
2023-07-20 16:20 ` Bjorn Helgaas
2023-07-20 16:27 ` Manivannan Sadhasivam
2023-07-20 18:35 ` Bjorn Helgaas [this message]
2023-07-20 16:26 ` Frank Li
2023-07-20 16:43 ` Manivannan Sadhasivam
2023-07-20 16:59 ` Frank Li
2023-07-21 2:09 ` Shawn Lin
2023-07-21 14:10 ` Frank Li
2023-07-21 16:07 ` Manivannan Sadhasivam
2023-07-21 16:21 ` Frank Li
2023-07-21 14:54 ` Manivannan Sadhasivam
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=20230720183512.GA539111@bhelgaas \
--to=helgaas@kernel.org \
--cc=Frank.li@nxp.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=gustavo.pimentel@synopsys.com \
--cc=imx@lists.linux.dev \
--cc=kw@linux.com \
--cc=leoyang.li@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=minghuan.lian@nxp.com \
--cc=mingkai.hu@nxp.com \
--cc=robh+dt@kernel.org \
--cc=roy.zang@nxp.com \
--cc=shawnguo@kernel.org \
--cc=zhiqiang.hou@nxp.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).