From fcd287b1ced8c09dca250d4f7815c05195c1bd60 Mon Sep 17 00:00:00 2001 From: Lukas Wunner Date: Fri, 9 Mar 2018 13:53:25 +0100 Subject: [PATCH 2/3] PCI: Apply quirks on runtime resume despite being unbound The integrated HDA controller on Nvidia GPUs is hidden by some laptop BIOSes on resume unless an external display is attached, rendering the HDA controller invisible and preventing its use if a display is attached later. We avoid that by exposing it from a quirk, but that quirk is currently not applied to unbound GPUs. This leads to failure in the following scenario: * The HDA controller is bound and in runtime suspend. The GPU is not bound and the user manually allows runtime PM on it via sysfs. => As a result, the root port above the GPU runtime suspends and cuts power to the GPU. * The user loads the driver module for the GPU. => The GPU is runtime resumed and bound to the driver. On runtime resume, the BIOS reinstates power to the GPU, detects that no HDMI/DP display is attached and hides the HDA controller. The HDA controller thus becomes inaccessible to its driver. The quirk to expose it is not applied because the GPU was not yet bound on runtime resume. Fix by applying quirks of type "resume_early" on runtime resume even if the device is not bound. Cc: Bjorn Helgaas Cc: Rafael J. Wysocki Signed-off-by: Lukas Wunner --- drivers/pci/pci-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 79afafbfd0b8..4fab6c832d77 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1271,6 +1271,7 @@ static int pci_pm_runtime_resume(struct device *dev) * D3cold when the bridge above it runtime suspended. */ pci_restore_standard_config(pci_dev); + pci_fixup_device(pci_fixup_resume_early, pci_dev); if (!pci_dev->driver) return 0; @@ -1278,7 +1279,6 @@ static int pci_pm_runtime_resume(struct device *dev) if (!pm || !pm->runtime_resume) return -ENOSYS; - pci_fixup_device(pci_fixup_resume_early, pci_dev); pci_enable_wake(pci_dev, PCI_D0, false); pci_fixup_device(pci_fixup_resume, pci_dev); -- 2.16.2