Commit ad54567a authored by Lyude Paul's avatar Lyude Paul Committed by Bjorn Helgaas

PCI: Reset both NVIDIA GPU and HDA in ThinkPad P50 workaround

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 b516ea58 ("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 e0547c81]
Fixes: b516ea58 ("PCI: Enable NVIDIA HDA controllers")
Fixes: e0547c81 ("PCI: Reset Lenovo ThinkPad P50 nvgpu at boot if necessary")
Link: https://lore.kernel.org/r/20190801220117.14952-1-lyude@redhat.comSigned-off-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarBen Skeggs <bskeggs@redhat.com>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Daniel Drake <drake@endlessm.com>
Cc: Aaron Plattner <aplattner@nvidia.com>
Cc: Peter Wu <peter@lekensteyn.nl>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Maik Freudenberg <hhfeuer@gmx.de>
parent 5f9e832c
...@@ -5256,7 +5256,7 @@ static void quirk_reset_lenovo_thinkpad_p50_nvgpu(struct pci_dev *pdev) ...@@ -5256,7 +5256,7 @@ static void quirk_reset_lenovo_thinkpad_p50_nvgpu(struct pci_dev *pdev)
*/ */
if (ioread32(map + 0x2240c) & 0x2) { if (ioread32(map + 0x2240c) & 0x2) {
pci_info(pdev, FW_BUG "GPU left initialized by EFI, resetting\n"); 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) if (ret < 0)
pci_err(pdev, "Failed to reset GPU: %d\n", ret); pci_err(pdev, "Failed to reset GPU: %d\n", ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment