All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/acpi: use DSM if bridge does not support D3cold
@ 2016-08-25 23:00 Peter Wu
       [not found] ` <20160825230054.8649-1-peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Wu @ 2016-08-25 23:00 UTC (permalink / raw)
  To: Dave Airlie, Ben Skeggs
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Mika Westerberg,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Even if PR3 support is available on the bridge, it will not be used if
the PCI layer considers it unavailable (i.e. on all laptops from 2013
and 2014). Ensure that this condition is checked to allow a fallback to
the Optimus DSM for device poweroff.

Initially I wanted to call pci_d3cold_enable before checking bridge_d3
(in case the user changed d3cold_allowed), but that is such an unlikely
case and likely fragile anyway. The current patch is suggested by Mika
in http://www.spinics.net/lists/linux-pci/msg52599.html

Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
---
Hi,

This idea is floating since July, but was blocked by the PCI D3cold patches.
Since these got into -rc1, here is the promised follow-up patch for v4.8.

Without this patch, some laptops from 2013 and 2014 will regress in v4.8 and
suck more power.

Kind regards,
Peter
---
 drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index f2ad17a..dc57b62 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -225,6 +225,17 @@ static bool nouveau_pr3_present(struct pci_dev *pdev)
 	if (!parent_pdev)
 		return false;
 
+	if (!parent_pdev->bridge_d3) {
+		/*
+		 * Parent PCI bridge is currently not power managed.
+		 * Since userspace can change these afterwards to be on
+		 * the safe side we stick with _DSM and prevent usage of
+		 * _PR3 from the bridge.
+		 */
+		pci_d3cold_disable(pdev);
+		return false;
+	}
+
 	parent_adev = ACPI_COMPANION(&parent_pdev->dev);
 	if (!parent_adev)
 		return false;
-- 
2.9.3

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

* Re: [PATCH] drm/nouveau/acpi: use DSM if bridge does not support D3cold
       [not found] ` <20160825230054.8649-1-peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org>
@ 2016-08-30 11:01   ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2016-08-30 11:01 UTC (permalink / raw)
  To: Peter Wu
  Cc: Dave Airlie, Ben Skeggs,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Fri, Aug 26, 2016 at 01:00:54AM +0200, Peter Wu wrote:
> Even if PR3 support is available on the bridge, it will not be used if
> the PCI layer considers it unavailable (i.e. on all laptops from 2013
> and 2014). Ensure that this condition is checked to allow a fallback to
> the Optimus DSM for device poweroff.
> 
> Initially I wanted to call pci_d3cold_enable before checking bridge_d3
> (in case the user changed d3cold_allowed), but that is such an unlikely
> case and likely fragile anyway. The current patch is suggested by Mika
> in http://www.spinics.net/lists/linux-pci/msg52599.html
> 
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

end of thread, other threads:[~2016-08-30 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25 23:00 [PATCH] drm/nouveau/acpi: use DSM if bridge does not support D3cold Peter Wu
     [not found] ` <20160825230054.8649-1-peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org>
2016-08-30 11:01   ` Mika Westerberg

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.