From: Koba Ko <koba.ko@canonical.com> To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Henrik Juul Hansen <hjhansen2020@gmail.com> Subject: [PATCH] nvme-pci: Avoid to go into d3cold if device can't use npss. Date: Thu, 20 May 2021 11:33:15 +0800 [thread overview] Message-ID: <20210520033315.490584-1-koba.ko@canonical.com> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: Koba Ko <koba.ko@canonical.com> To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Henrik Juul Hansen <hjhansen2020@gmail.com> Subject: [PATCH] nvme-pci: Avoid to go into d3cold if device can't use npss. Date: Thu, 20 May 2021 11:33:15 +0800 [thread overview] Message-ID: <20210520033315.490584-1-koba.ko@canonical.com> (raw) 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 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme
next reply other threads:[~2021-05-20 3:33 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-20 3:33 Koba Ko [this message] 2021-05-20 3:33 ` [PATCH] nvme-pci: Avoid to go into d3cold if device can't use npss Koba Ko 2021-05-25 7:44 ` Christoph Hellwig 2021-05-25 7:44 ` Christoph Hellwig 2021-05-25 16:49 ` Kai-Heng Feng 2021-05-25 16:49 ` Kai-Heng Feng 2021-05-25 20:14 ` Bjorn Helgaas 2021-05-25 20:14 ` Bjorn Helgaas 2021-05-26 2:02 ` Koba Ko 2021-05-26 2:02 ` Koba Ko 2021-05-26 2:49 ` Keith Busch 2021-05-26 2:49 ` Keith Busch 2021-05-26 12:11 ` Kai-Heng Feng 2021-05-26 12:11 ` Kai-Heng Feng 2021-05-26 12:59 ` Christoph Hellwig 2021-05-26 12:59 ` Christoph Hellwig 2021-05-26 14:21 ` Kai-Heng Feng 2021-05-26 14:21 ` Kai-Heng Feng 2021-05-26 14:28 ` Christoph Hellwig 2021-05-26 14:28 ` Christoph Hellwig 2021-05-26 14:47 ` Kai-Heng Feng 2021-05-26 14:47 ` Kai-Heng Feng 2021-05-26 15:06 ` Bjorn Helgaas 2021-05-26 15:06 ` Bjorn Helgaas 2021-05-26 16:24 ` Kai-Heng Feng 2021-05-26 16:24 ` Kai-Heng Feng 2021-05-27 11:40 ` Christoph Hellwig 2021-05-27 11:40 ` Christoph Hellwig 2021-05-27 12:08 ` Kai-Heng Feng 2021-05-27 12:08 ` Kai-Heng Feng
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=20210520033315.490584-1-koba.ko@canonical.com \ --to=koba.ko@canonical.com \ --cc=axboe@fb.com \ --cc=hch@lst.de \ --cc=hjhansen2020@gmail.com \ --cc=kbusch@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=sagi@grimberg.me \ /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: linkBe 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.