diff options
author | Jeremy Cline <jcline@redhat.com> | 2018-11-30 10:22:38 -0500 |
---|---|---|
committer | Jeremy Cline <jcline@redhat.com> | 2018-11-30 10:22:38 -0500 |
commit | e2b69afd46f1d4b32c6684b5b4d8c7e780b0372b (patch) | |
tree | bc9992093f6f49b069a1cbb96627879c85954070 | |
parent | 3fa56323c0aa8498f85cdef00f6909ffd0879d4a (diff) | |
download | kernel-e2b69afd46f1d4b32c6684b5b4d8c7e780b0372b.tar.gz kernel-e2b69afd46f1d4b32c6684b5b4d8c7e780b0372b.tar.xz kernel-e2b69afd46f1d4b32c6684b5b4d8c7e780b0372b.zip |
Fix slowdowns and crashes for AMD GPUs in pre-PCIe-v3 slots
-rw-r--r-- | PCI-Fix-incorrect-value-returned-from-pcie_get_speed.patch | 81 | ||||
-rw-r--r-- | kernel.spec | 5 |
2 files changed, 86 insertions, 0 deletions
diff --git a/PCI-Fix-incorrect-value-returned-from-pcie_get_speed.patch b/PCI-Fix-incorrect-value-returned-from-pcie_get_speed.patch new file mode 100644 index 000000000..6735da020 --- /dev/null +++ b/PCI-Fix-incorrect-value-returned-from-pcie_get_speed.patch @@ -0,0 +1,81 @@ +From b8f56153d6d66e01e52f9f703ab0c6f8c8637354 Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka <mpatocka@redhat.com> +Date: Thu, 29 Nov 2018 17:24:17 -0600 +Subject: [PATCH] PCI: Fix incorrect value returned from pcie_get_speed_cap() + +The macros PCI_EXP_LNKCAP_SLS_*GB are values, not bit masks. We must mask +the register and compare it against them. + +This fixes errors like this: + + amdgpu: [powerplay] failed to send message 261 ret is 0 + +when a PCIe-v3 card is plugged into a PCIe-v1 slot, because the slot is +being incorrectly reported as PCIe-v3 capable. + +6cf57be0f78e, which appeared in v4.17, added pcie_get_speed_cap() with the +incorrect test of PCI_EXP_LNKCAP_SLS as a bitmask. 5d9a63304032, which +appeared in v4.19, changed amdgpu to use pcie_get_speed_cap(), so the +amdgpu bug reports below are regressions in v4.19. + +Fixes: 6cf57be0f78e ("PCI: Add pcie_get_speed_cap() to find max supported link speed") +Fixes: 5d9a63304032 ("drm/amdgpu: use pcie functions for link width and speed") +Link: https://bugs.freedesktop.org/show_bug.cgi?id=108704 +Link: https://bugs.freedesktop.org/show_bug.cgi?id=108778 +Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> +[bhelgaas: update comment, remove use of PCI_EXP_LNKCAP_SLS_8_0GB and +PCI_EXP_LNKCAP_SLS_16_0GB since those should be covered by PCI_EXP_LNKCAP2, +remove test of PCI_EXP_LNKCAP for zero, since that register is required] +Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> +Acked-by: Alex Deucher <alexander.deucher@amd.com> +Cc: stable@vger.kernel.org # v4.17+ +Signed-off-by: Jeremy Cline <jcline@redhat.com> +--- + drivers/pci/pci.c | 24 +++++++++++------------- + 1 file changed, 11 insertions(+), 13 deletions(-) + +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c +index d068f11d08a7..c9d8e3c837de 100644 +--- a/drivers/pci/pci.c ++++ b/drivers/pci/pci.c +@@ -5556,9 +5556,13 @@ enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev) + u32 lnkcap2, lnkcap; + + /* +- * PCIe r4.0 sec 7.5.3.18 recommends using the Supported Link +- * Speeds Vector in Link Capabilities 2 when supported, falling +- * back to Max Link Speed in Link Capabilities otherwise. ++ * Link Capabilities 2 was added in PCIe r3.0, sec 7.8.18. The ++ * implementation note there recommends using the Supported Link ++ * Speeds Vector in Link Capabilities 2 when supported. ++ * ++ * Without Link Capabilities 2, i.e., prior to PCIe r3.0, software ++ * should use the Supported Link Speeds field in Link Capabilities, ++ * where only 2.5 GT/s and 5.0 GT/s speeds were defined. + */ + pcie_capability_read_dword(dev, PCI_EXP_LNKCAP2, &lnkcap2); + if (lnkcap2) { /* PCIe r3.0-compliant */ +@@ -5574,16 +5578,10 @@ enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev) + } + + pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap); +- if (lnkcap) { +- if (lnkcap & PCI_EXP_LNKCAP_SLS_16_0GB) +- return PCIE_SPEED_16_0GT; +- else if (lnkcap & PCI_EXP_LNKCAP_SLS_8_0GB) +- return PCIE_SPEED_8_0GT; +- else if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB) +- return PCIE_SPEED_5_0GT; +- else if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB) +- return PCIE_SPEED_2_5GT; +- } ++ if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_5_0GB) ++ return PCIE_SPEED_5_0GT; ++ else if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_2_5GB) ++ return PCIE_SPEED_2_5GT; + + return PCI_SPEED_UNKNOWN; + } +-- +2.19.2 + diff --git a/kernel.spec b/kernel.spec index 661641eda..3c58c9178 100644 --- a/kernel.spec +++ b/kernel.spec @@ -641,6 +641,10 @@ Patch513: CVE-2018-19407.patch # rhbz 1650984, in linux-next and Cc'd for stable Patch514: net-phy-add-workaround-for-issue-where-PHY-driver-do.patch +# In the PCI tree and Cc'd for stable, fixes an issue with amdgpu +# https://patchwork.freedesktop.org/patch/259364/ +Patch515: PCI-Fix-incorrect-value-returned-from-pcie_get_speed.patch + # END OF PATCH DEFINITIONS %endif @@ -1904,6 +1908,7 @@ fi %changelog * Thu Nov 29 2018 Jeremy Cline <jeremy@jcline.org> - Fix a problem with some rtl8168 chips (rhbz 1650984) +- Fix slowdowns and crashes for AMD GPUs in pre-PCIe-v3 slots * Tue Nov 27 2018 Jeremy Cline <jcline@redhat.com> - 4.19.5-300 - Linux v4.19.5 |