PCI: Use pci_reset_bus() in quirk_reset_lenovo_thinkpad_50_nvgpu()
PATCH 1/1 PCI: Use pci_reset_bus() in quirk_reset_lenovo_thinkpad_50_nvgpu()
Since quirk_nvidia_hda() was added there's now two nvidia device functions on any laptops with nvidia GPUs: the HDA controller, and the GPU itself. Unfortunately this has the sideaffect of breaking quirk_reset_lenovo_thinkpad_50_nvgpu() since pci_reset_function() was using pci_parent_bus_reset() to reset the GPU's respective PCI bus, and pci_parent_bus_reset() does not work on busses which have more then a single device function present.
So, fix this by simply calling pci_reset_bus() instead which properly resets the GPU bus and all device functions under it, including both the GPU and the HDA controller.
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/quirks.c +1 -1
@@ -5256,7 +5256,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); }
Signature · 1 line
2.21.0
Quoted 13 lines · Lyude Paul
Since
quirk_nvidia_hda()was added there's now two nvidia device functions on any laptops with nvidia GPUs: the HDA controller, and the GPU itself. Unfortunately this has the sideaffect of breakingquirk_reset_lenovo_thinkpad_50_nvgpu()sincepci_reset_function()was usingpci_parent_bus_reset()to reset the GPU's respective PCI bus, andpci_parent_bus_reset()does not work on busses which have more then a single device function present.So, fix this by simply calling
pci_reset_bus()instead which properly resets the GPU bus and all device functions under it, including both the GPU and the HDA controller.
Quoted 11 lines
Fixes b516ea586d71 ("PCI: Enable NVIDIA HDA controllers")Cc Lukas Wunner <[email protected]>Cc Daniel Drake <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Aaron Plattner <[email protected]>Cc Peter Wu <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Karol Herbst <[email protected]>Cc Maik Freudenberg <[email protected]>Signed-off-by Lyude Paul <[email protected]>
Quoted 20 lines
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/quirks.c +1
-2@@ -5256,7 +5256,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); } --2.21.0
Quoted 4 lines
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Bjorn, is there any update on getting this accepted?
Quoted 42 lines · Lyude Paul
Since
quirk_nvidia_hda()was added there's now two nvidia device functions on any laptops with nvidia GPUs: the HDA controller, and the GPU itself. Unfortunately this has the sideaffect of breakingquirk_reset_lenovo_thinkpad_50_nvgpu()sincepci_reset_function()was usingpci_parent_bus_reset()to reset the GPU's respective PCI bus, andpci_parent_bus_reset()does not work on busses which have more then a single device function present.So, fix this by simply calling
pci_reset_bus()instead which properly resets the GPU bus and all device functions under it, including both the GPU and the HDA controller.Fixes b516ea586d71 ("PCI: Enable NVIDIA HDA controllers")Cc Lukas Wunner <[email protected]>Cc Daniel Drake <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Aaron Plattner <[email protected]>Cc Peter Wu <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Karol Herbst <[email protected]>Cc Maik Freudenberg <[email protected]>Signed-off-by Lyude Paul <[email protected]>--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/quirks.c +1
-1@@ -5256,7 +5256,7 @@ static void quirk_reset_lenovo_thinkpad_p50_nvgpu(structpci_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 )drivers/pci/quirks.c +0
-0pci_err (pdev,"Failed to reset GPU: %d\n" , ret); }
Quoted 12 lines · Lyude Paul
Since
quirk_nvidia_hda()was added there's now two nvidia device functions on any laptops with nvidia GPUs: the HDA controller, and the GPU itself. Unfortunately this has the sideaffect of breakingquirk_reset_lenovo_thinkpad_50_nvgpu()sincepci_reset_function()was usingpci_parent_bus_reset()to reset the GPU's respective PCI bus, andpci_parent_bus_reset()does not work on busses which have more then a single device function present.So, fix this by simply calling
pci_reset_bus()instead which properly resets the GPU bus and all device functions under it, including both the GPU and the HDA controller.
Quoted 11 lines
Fixes b516ea586d71 ("PCI: Enable NVIDIA HDA controllers")Cc Lukas Wunner <[email protected]>Cc Daniel Drake <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Aaron Plattner <[email protected]>Cc Peter Wu <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Karol Herbst <[email protected]>Cc Maik Freudenberg <[email protected]>Signed-off-by Lyude Paul <[email protected]>
We merged b516ea586d71 for v5.3, so I applied this with Ben's ack to for-linus for v5.3, thanks!
Quoted 20 lines
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/quirks.c +1
-1@@ -5256,7 +5256,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); }Signature · 1 line
2.21.0