All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: use simple suspend when a HMB is enabled
@ 2020-06-09 16:10 Christoph Hellwig
  2020-06-09 16:29 ` Keith Busch
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2020-06-09 16:10 UTC (permalink / raw)
  To: kbusch, sagi; +Cc: linux-nvme

While the NVMe specification allows the device to access the host memory
buffer in host DRAM from all power states, hosts will fail access to
DRAM during S3 and similar power states.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/pci.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index d690d5593a8095..e2bacd369a88a0 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2950,9 +2950,15 @@ static int nvme_suspend(struct device *dev)
 	 * 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 a host memory buffer is enabled, shut down the device as the NVMe
+	 * specification allows the device to access the host memory buffer in
+	 * host DRAM from all power states, but hosts will fail access to DRAM
+	 * during S3.
 	 */
 	if (pm_suspend_via_firmware() || !ctrl->npss ||
 	    !pcie_aspm_enabled(pdev) ||
+	    ndev->nr_host_mem_descs ||
 	    (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND))
 		return nvme_disable_prepare_reset(ndev, true);
 
-- 
2.26.2


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: use simple suspend when a HMB is enabled
  2020-06-09 16:10 [PATCH] nvme-pci: use simple suspend when a HMB is enabled Christoph Hellwig
@ 2020-06-09 16:29 ` Keith Busch
  2020-06-09 16:30   ` Keith Busch
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Keith Busch @ 2020-06-09 16:29 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: sagi, linux-nvme

On Tue, Jun 09, 2020 at 06:10:53PM +0200, Christoph Hellwig wrote:
> While the NVMe specification allows the device to access the host memory
> buffer in host DRAM from all power states, hosts will fail access to
> DRAM during S3 and similar power states.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good. Stable ought to pick this up too.

>  drivers/nvme/host/pci.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index d690d5593a8095..e2bacd369a88a0 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2950,9 +2950,15 @@ static int nvme_suspend(struct device *dev)
>  	 * 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 a host memory buffer is enabled, shut down the device as the NVMe
> +	 * specification allows the device to access the host memory buffer in
> +	 * host DRAM from all power states, but hosts will fail access to DRAM
> +	 * during S3.
>  	 */
>  	if (pm_suspend_via_firmware() || !ctrl->npss ||
>  	    !pcie_aspm_enabled(pdev) ||
> +	    ndev->nr_host_mem_descs ||
>  	    (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND))
>  		return nvme_disable_prepare_reset(ndev, true);
>  
> -- 

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: use simple suspend when a HMB is enabled
  2020-06-09 16:29 ` Keith Busch
@ 2020-06-09 16:30   ` Keith Busch
  2020-06-09 17:28   ` Sagi Grimberg
  2020-06-10  6:53   ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2020-06-09 16:30 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: sagi, linux-nvme

On Wed, Jun 10, 2020 at 01:29:53AM +0900, Keith Busch wrote:
> On Tue, Jun 09, 2020 at 06:10:53PM +0200, Christoph Hellwig wrote:
> > While the NVMe specification allows the device to access the host memory
> > buffer in host DRAM from all power states, hosts will fail access to
> > DRAM during S3 and similar power states.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Looks good. Stable ought to pick this up too.

Reviewed-by: Keith Busch <kbusch@kernel.org>

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: use simple suspend when a HMB is enabled
  2020-06-09 16:29 ` Keith Busch
  2020-06-09 16:30   ` Keith Busch
@ 2020-06-09 17:28   ` Sagi Grimberg
  2020-06-10  6:53   ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2020-06-09 17:28 UTC (permalink / raw)
  To: Keith Busch, Christoph Hellwig; +Cc: linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: use simple suspend when a HMB is enabled
  2020-06-09 16:29 ` Keith Busch
  2020-06-09 16:30   ` Keith Busch
  2020-06-09 17:28   ` Sagi Grimberg
@ 2020-06-10  6:53   ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-06-10  6:53 UTC (permalink / raw)
  To: Keith Busch; +Cc: Christoph Hellwig, linux-nvme, sagi

On Wed, Jun 10, 2020 at 01:29:53AM +0900, Keith Busch wrote:
> On Tue, Jun 09, 2020 at 06:10:53PM +0200, Christoph Hellwig wrote:
> > While the NVMe specification allows the device to access the host memory
> > buffer in host DRAM from all power states, hosts will fail access to
> > DRAM during S3 and similar power states.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Looks good. Stable ought to pick this up too.

I've added a:

Fixes: d916b1be94b6 ("nvme-pci: use host managed power state for suspend")

and added it to nvme-5.8.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-10  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-09 16:10 [PATCH] nvme-pci: use simple suspend when a HMB is enabled Christoph Hellwig
2020-06-09 16:29 ` Keith Busch
2020-06-09 16:30   ` Keith Busch
2020-06-09 17:28   ` Sagi Grimberg
2020-06-10  6:53   ` Christoph Hellwig

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.