Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: fix power state when port pm is unavailable

When PCIe port PM is not enabled (system BIOS is pre-2015 or the
pcie_port_pm=off parameter is set), legacy ATPX PM should still be
marked as supported. Otherwise the GPU can fail to power on after
runtime suspend. This affected a Dell Inspiron 5548.

Ideally the BIOS date in the PCI core is lowered to 2013 (the first year
where hybrid graphics platforms using power resources was introduced),
but that seems more risky at this point and would not solve the
pcie_port_pm=off issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505
Reported-and-tested-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: <stable@vger.kernel.org> # 4.8+
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Peter Wu and committed by
Alex Deucher
1db4496f da7800a8

+8 -1
+8 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
··· 34 34 35 35 static struct amdgpu_atpx_priv { 36 36 bool atpx_detected; 37 + bool bridge_pm_usable; 37 38 /* handle for device - and atpx */ 38 39 acpi_handle dhandle; 39 40 acpi_handle other_handle; ··· 206 205 atpx->is_hybrid = false; 207 206 if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { 208 207 printk("ATPX Hybrid Graphics\n"); 209 - atpx->functions.power_cntl = false; 208 + /* 209 + * Disable legacy PM methods only when pcie port PM is usable, 210 + * otherwise the device might fail to power off or power on. 211 + */ 212 + atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable; 210 213 atpx->is_hybrid = true; 211 214 } 212 215 ··· 485 480 */ 486 481 static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) 487 482 { 483 + struct pci_dev *parent_pdev = pci_upstream_bridge(pdev); 488 484 acpi_handle dhandle, atpx_handle; 489 485 acpi_status status; 490 486 ··· 500 494 } 501 495 amdgpu_atpx_priv.dhandle = dhandle; 502 496 amdgpu_atpx_priv.atpx.handle = atpx_handle; 497 + amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3; 503 498 return true; 504 499 } 505 500