Skip to content

Commit c56d455

Browse files
l1kgregkh
authored andcommitted
PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI
commit c6e3313 upstream. Recent laptops with dual AMD GPUs fail to suspend the discrete GPU, thus causing lockups on system sleep and high power consumption at runtime. The discrete GPU would normally be suspended to D3cold by turning off ACPI _PR3 Power Resources of the Root Port above the GPU. However on affected systems, the Root Port is hotplug-capable and pci_bridge_d3_possible() only allows hotplug ports to go to D3 if they belong to a Thunderbolt device or if the Root Port possesses a "HotPlugSupportInD3" ACPI property. Neither is the case on affected laptops. The reason for whitelisting only specific, known to work hotplug ports for D3 is that there have been reports of SkyLake Xeon-SP systems raising Hardware Error NMIs upon suspending their hotplug ports: https://lore.kernel.org/linux-pci/20170503180426.GA4058@otc-nc-03/ But if a hotplug port is power manageable by ACPI (as can be detected through presence of Power Resources and corresponding _PS0 and _PS3 methods) then it ought to be safe to suspend it to D3. To this end, amend acpi_pci_bridge_d3() to whitelist such ports for D3. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1222 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1252 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1304 Reported-and-tested-by: Arthur Borsboom <arthurborsboom@gmail.com> Reported-and-tested-by: matoro <matoro@airmail.cc> Reported-by: Aaron Zakhrov <aaron.zakhrov@gmail.com> Reported-by: Michal Rostecki <mrostecki@suse.com> Reported-by: Shai Coleman <git@shaicoleman.com> Signed-off-by: Lukas Wunner <lukas@wunner.de> Acked-by: Alex Deucher <alexander.deucher@amd.com> Cc: 5.4+ <stable@vger.kernel.org> # 5.4+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 62bf715 commit c56d455

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/pci/pci-acpi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,16 @@ static bool acpi_pci_bridge_d3(struct pci_dev *dev)
944944
if (!dev->is_hotplug_bridge)
945945
return false;
946946

947+
/* Assume D3 support if the bridge is power-manageable by ACPI. */
948+
adev = ACPI_COMPANION(&dev->dev);
949+
if (!adev && !pci_dev_is_added(dev)) {
950+
adev = acpi_pci_find_companion(&dev->dev);
951+
ACPI_COMPANION_SET(&dev->dev, adev);
952+
}
953+
954+
if (adev && acpi_device_power_manageable(adev))
955+
return true;
956+
947957
/*
948958
* Look for a special _DSD property for the root port and if it
949959
* is set we know the hierarchy behind it supports D3 just fine.

0 commit comments

Comments
 (0)