Skip to contentSkip to conversation

drm/nouveau/acpi: use DSM if bridge does not support D3cold

PATCH In review Peter Wu 2 participants 2 messages Aug 25, 2016 – Aug 30, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Peter Wu

author
#0 lore raw

PATCH 1/1 drm/nouveau/acpi: use DSM if bridge does not support D3cold

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 <[email protected]>

---
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(+)
drivers/gpu/drm/nouveau/nouveau_acpi.c +11 -0
index f2ad17a..dc57b62 100644
@@ -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;
Signature · 6 lines
2.9.3

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20160825230054.8649-1-peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 11 lines · Peter Wu

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 <[email protected]>

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau