All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: simple suspend quirk for vmd devices
@ 2022-02-10 15:22 Keith Busch
  2022-02-10 18:22 ` Christoph Hellwig
  2022-02-16  8:43 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Keith Busch @ 2022-02-10 15:22 UTC (permalink / raw)
  To: linux-nvme; +Cc: hch, Keith Busch, Rafael J. Wysocki

Bug reports from users tell us platfroms with vmd enabled regressed
power when using nvme power management on s2idle. We can't get the
StorageD3Enable property on such devices so the driver used the wrong
suspend method. Add a simple suspend quirk for the domain since that is
the safest option.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215467
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 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 6a99ed680915..6fa66d5d924e 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3094,6 +3094,12 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		dev_info(&pdev->dev,
 			 "platform quirk: setting simple suspend\n");
 		quirks |= NVME_QUIRK_SIMPLE_SUSPEND;
+	} else if (pci_domain_nr(pdev->bus) > 0xffff) {
+		/*
+		 * ACPI device properties are not reliable within VMD domains,
+		 * so assume the worst.
+		 */
+		quirks |= NVME_QUIRK_SIMPLE_SUSPEND;
 	}
 
 	/*
-- 
2.25.4



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

* Re: [PATCH] nvme-pci: simple suspend quirk for vmd devices
  2022-02-10 15:22 [PATCH] nvme-pci: simple suspend quirk for vmd devices Keith Busch
@ 2022-02-10 18:22 ` Christoph Hellwig
  2022-02-16  8:43 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2022-02-10 18:22 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-nvme, hch, Rafael J. Wysocki

On Thu, Feb 10, 2022 at 07:22:33AM -0800, Keith Busch wrote:
> +	} else if (pci_domain_nr(pdev->bus) > 0xffff) {
> +		/*
> +		 * ACPI device properties are not reliable within VMD domains,
> +		 * so assume the worst.
> +		 */
> +		quirks |= NVME_QUIRK_SIMPLE_SUSPEND;

We'll need to communicate that from th vmd layer instead of hacking
a check like this into NVMe..


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

* Re: [PATCH] nvme-pci: simple suspend quirk for vmd devices
  2022-02-10 15:22 [PATCH] nvme-pci: simple suspend quirk for vmd devices Keith Busch
  2022-02-10 18:22 ` Christoph Hellwig
@ 2022-02-16  8:43 ` Christoph Hellwig
  2022-02-16 12:45   ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-02-16  8:43 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-nvme, hch, Rafael J. Wysocki

On Thu, Feb 10, 2022 at 07:22:33AM -0800, Keith Busch wrote:
> Bug reports from users tell us platfroms with vmd enabled regressed
> power when using nvme power management on s2idle. We can't get the
> StorageD3Enable property on such devices so the driver used the wrong
> suspend method. Add a simple suspend quirk for the domain since that is
> the safest option.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=215467
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>

Rafael, can you try this on the affected platform?
(not for merge as-is)

diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 9e1e6b8d88763..49f4e54da919d 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -723,4 +723,5 @@ struct pci_dev *pci_real_dma_dev(struct pci_dev *dev)
 
 	return dev;
 }
+EXPORT_SYMBOL_GPL(pci_real_dma_dev);
 #endif
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 6a99ed6809158..6edc8c514cbc8 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3086,7 +3086,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	quirks |= check_vendor_combination_bug(pdev);
 
-	if (!noacpi && acpi_storage_d3(&pdev->dev)) {
+	if (!noacpi && acpi_storage_d3(&pci_real_dma_dev(pdev)->dev)) {
 		/*
 		 * Some systems use a bios work around to ask for D3 on
 		 * platforms that support kernel managed suspend.


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

* Re: [PATCH] nvme-pci: simple suspend quirk for vmd devices
  2022-02-16  8:43 ` Christoph Hellwig
@ 2022-02-16 12:45   ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-02-16 12:45 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Keith Busch, linux-nvme, Rafael J. Wysocki, m.heingbecker

On Wed, Feb 16, 2022 at 9:43 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Thu, Feb 10, 2022 at 07:22:33AM -0800, Keith Busch wrote:
> > Bug reports from users tell us platfroms with vmd enabled regressed
> > power when using nvme power management on s2idle. We can't get the
> > StorageD3Enable property on such devices so the driver used the wrong
> > suspend method. Add a simple suspend quirk for the domain since that is
> > the safest option.
> >
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=215467
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
>
> Rafael, can you try this on the affected platform?
> (not for merge as-is)

I can't really do that myself (no access to the system in question),
but I've just asked the original reporter (CCed) to do it.

>
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index 9e1e6b8d88763..49f4e54da919d 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -723,4 +723,5 @@ struct pci_dev *pci_real_dma_dev(struct pci_dev *dev)
>
>         return dev;
>  }
> +EXPORT_SYMBOL_GPL(pci_real_dma_dev);
>  #endif
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 6a99ed6809158..6edc8c514cbc8 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -3086,7 +3086,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>
>         quirks |= check_vendor_combination_bug(pdev);
>
> -       if (!noacpi && acpi_storage_d3(&pdev->dev)) {
> +       if (!noacpi && acpi_storage_d3(&pci_real_dma_dev(pdev)->dev)) {
>                 /*
>                  * Some systems use a bios work around to ask for D3 on
>                  * platforms that support kernel managed suspend.


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

end of thread, other threads:[~2022-02-16 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 15:22 [PATCH] nvme-pci: simple suspend quirk for vmd devices Keith Busch
2022-02-10 18:22 ` Christoph Hellwig
2022-02-16  8:43 ` Christoph Hellwig
2022-02-16 12:45   ` Rafael J. Wysocki

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.