Enabling d3 support on hotplug bridges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Recent AMD laptops which have iGPU + dGPU have been non-functional on
Linux.  The issue is that the laptops rely on ACPI to control the dGPU
power and that is not happening because the bridges are hotplug
capable, and the current pci code does not allow runtime pm on hotplug
capable bridges.  This worked on previous laptops presumably because
the bridges did not support hotplug or they hit one of the allowed
cases.  The driver enables runtime power management, but since the
dGPU does not actually get powered down via the platform ACPI
controls, no power is saved, and things fall apart on resume leading
to an unusable GPU or a system hang.  To work around this users can
currently disable runtime pm in the GPU driver or specify
pcie_port_pm=force to force d3 on bridges.  I'm not sure what the best
solution for this is.  I'd rather not have to add device IDs to a
whitelist every time we release a new platform.  Suggestions?  What
about something like the attached patch work?

Alex
From 3a08cb6ac38c47b921b8b6f31b03fcd8f13c4018 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@xxxxxxx>
Date: Mon, 21 Sep 2020 18:07:27 -0400
Subject: [PATCH] pci: allow d3 on hotplug bridges after 2018

Newer AMD laptops have hotplug capabe bridges with dGPUs behind them.
If d3 is disabled on the bridge, the dGPU is never powered down even
though the dGPU driver may think it is because power is handled by
the pci core.  Things fall apart when the driver attempts to resume
a dGPU that was not properly powered down which leads to hangs.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1252
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1222
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1304
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a458c46d7e39..12927d5df4b9 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2856,7 +2856,7 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge)
 		 * by vendors for runtime D3 at least until 2018 because there
 		 * was no OS support.
 		 */
-		if (bridge->is_hotplug_bridge)
+		if (bridge->is_hotplug_bridge && (dmi_get_bios_year() <= 2018))
 			return false;
 
 		if (dmi_check_system(bridge_d3_blacklist))
-- 
2.25.4


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux