blob: c69f498251453e6afa43c4fa55ba96a04d93ecf3 [file] [log] [blame]
From 105a722e6b6077ef3b9839fcb825674f8d387a2d Mon Sep 17 00:00:00 2001
From: Lyude Paul <>
Date: Thu, 1 Aug 2019 18:01:17 -0400
Subject: [PATCH] PCI: Reset both NVIDIA GPU and HDA in ThinkPad P50 workaround
commit ad54567ad5d8e938ee6cf02e4f3867f18835ae6e upstream.
quirk_reset_lenovo_thinkpad_50_nvgpu() resets NVIDIA GPUs to work around
an apparent BIOS defect. It previously used pci_reset_function(), and
the available method was a bus reset, which was fine because there was
only one function on the bus. After b516ea586d71 ("PCI: Enable NVIDIA
HDA controllers"), there are now two functions (the HDA controller and
the GPU itself) on the bus, so the reset fails.
Use pci_reset_bus() explicitly instead of pci_reset_function() since it's
OK to reset both devices.
[bhelgaas: commit log, add e0547c81bfcf]
Fixes: b516ea586d71 ("PCI: Enable NVIDIA HDA controllers")
Fixes: e0547c81bfcf ("PCI: Reset Lenovo ThinkPad P50 nvgpu at boot if necessary")
Signed-off-by: Lyude Paul <>
Signed-off-by: Bjorn Helgaas <>
Acked-by: Ben Skeggs <>
Cc: Lukas Wunner <>
Cc: Daniel Drake <>
Cc: Aaron Plattner <>
Cc: Peter Wu <>
Cc: Ilia Mirkin <>
Cc: Karol Herbst <>
Cc: Maik Freudenberg <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 87771dfca09a..61777723c227 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5367,7 +5367,7 @@ static void quirk_reset_lenovo_thinkpad_p50_nvgpu(struct pci_dev *pdev)
if (ioread32(map + 0x2240c) & 0x2) {
pci_info(pdev, FW_BUG "GPU left initialized by EFI, resetting\n");
- ret = pci_reset_function(pdev);
+ ret = pci_reset_bus(pdev);
if (ret < 0)
pci_err(pdev, "Failed to reset GPU: %d\n", ret);