All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: fix incorrect value returned from pcie_get_speed_cap
@ 2018-10-30 16:36 ` Mikulas Patocka
  0 siblings, 0 replies; 24+ messages in thread
From: Mikulas Patocka @ 2018-10-30 16:36 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci-u79uwXL29TY76Z2rM5mHXA, Tal Gilboa
  Cc: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Tariq Toukan

The macros PCI_EXP_LNKCAP_SLS_*GB are values, not bit masks. We must mask
the register and compare it against them.

This patch fixes errors "amdgpu: [powerplay] failed to send message 261
ret is 0" errors when PCIe-v3 card is plugged into PCIe-v1 slot, because
the slot is being incorrectly reported as PCIe-v3 capable.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 6cf57be0f78e ("PCI: Add pcie_get_speed_cap() to find max supported link speed")
Cc: stable@vger.kernel.org	# v4.17+

---
 drivers/pci/pci.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-4.19/drivers/pci/pci.c
===================================================================
--- linux-4.19.orig/drivers/pci/pci.c	2018-10-30 16:58:58.000000000 +0100
+++ linux-4.19/drivers/pci/pci.c	2018-10-30 16:58:58.000000000 +0100
@@ -5492,13 +5492,13 @@ enum pci_bus_speed pcie_get_speed_cap(st
 
 	pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
 	if (lnkcap) {
-		if (lnkcap & PCI_EXP_LNKCAP_SLS_16_0GB)
+		if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_16_0GB)
 			return PCIE_SPEED_16_0GT;
-		else if (lnkcap & PCI_EXP_LNKCAP_SLS_8_0GB)
+		else if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_8_0GB)
 			return PCIE_SPEED_8_0GT;
-		else if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB)
+		else if ((lnkcap & PCI_EXP_LNKCAP_SLS) ==PCI_EXP_LNKCAP_SLS_5_0GB)
 			return PCIE_SPEED_5_0GT;
-		else if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
+		else if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_2_5GB)
 			return PCIE_SPEED_2_5GT;
 	}
 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2018-11-27 20:40 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-30 16:36 [PATCH] pci: fix incorrect value returned from pcie_get_speed_cap Mikulas Patocka
2018-10-30 16:36 ` Mikulas Patocka
     [not found] ` <alpine.LRH.2.02.1810301232310.23106-Hpncn10jQN4oNljnaZt3ZvA+iT7yCHsGwRM8/txMwJMAicBL8TP8PQ@public.gmane.org>
2018-10-30 18:00   ` Alex Deucher
2018-10-30 18:00     ` Alex Deucher
2018-11-14 15:44     ` Alex Deucher
2018-11-14 15:44       ` Alex Deucher
     [not found]       ` <CADnq5_OwyRVcwDVqD73q-Lr_WXCsgaVqCzS_9YZ=7-itZiAoag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-11-19 19:14         ` Alex Deucher
2018-11-19 19:14           ` Alex Deucher
2018-11-20  0:47   ` Bjorn Helgaas
2018-11-20  0:47     ` Bjorn Helgaas
     [not found]     ` <20181120004704.GA191199-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2018-11-20 14:17       ` Alex Deucher
2018-11-20 14:17         ` Alex Deucher
     [not found]         ` <CADnq5_OjN8jaxr9SsSgLxeUvOcZoxY401pg732QoXxJjtUiCuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-11-20 15:13           ` Bjorn Helgaas
2018-11-20 15:13             ` Bjorn Helgaas
     [not found]             ` <20181120151303.GB191199-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2018-11-20 16:29               ` Alex Deucher
2018-11-20 16:29                 ` Alex Deucher
2018-11-26 22:40       ` Bjorn Helgaas
2018-11-26 22:40         ` Bjorn Helgaas
     [not found]         ` <20181126224051.GB212532-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2018-11-27 16:49           ` Mikulas Patocka
2018-11-27 16:49             ` Mikulas Patocka
     [not found]             ` <alpine.LRH.2.02.1811271144420.27588-Hpncn10jQN4oNljnaZt3ZvA+iT7yCHsGwRM8/txMwJMAicBL8TP8PQ@public.gmane.org>
2018-11-27 20:40               ` Bjorn Helgaas
2018-11-27 20:40                 ` Bjorn Helgaas
2018-11-26 22:33   ` Bjorn Helgaas
2018-11-26 22:33     ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.