mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
Merge branch 'for-linus'
* for-linus: PCI/bwctrl: Enable only if more than one speed is supported PCI: Honor Max Link Speed when determining supported speeds
This commit is contained in:
commit
5f7267109a
@ -6257,12 +6257,14 @@ u8 pcie_get_supported_speeds(struct pci_dev *dev)
|
||||
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP2, &lnkcap2);
|
||||
speeds = lnkcap2 & PCI_EXP_LNKCAP2_SLS;
|
||||
|
||||
/* Ignore speeds higher than Max Link Speed */
|
||||
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
|
||||
speeds &= GENMASK(lnkcap & PCI_EXP_LNKCAP_SLS, 0);
|
||||
|
||||
/* PCIe r3.0-compliant */
|
||||
if (speeds)
|
||||
return speeds;
|
||||
|
||||
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
|
||||
|
||||
/* Synthesize from the Max Link Speed field */
|
||||
if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_5_0GB)
|
||||
speeds = PCI_EXP_LNKCAP2_SLS_5_0GB | PCI_EXP_LNKCAP2_SLS_2_5GB;
|
||||
|
@ -265,12 +265,14 @@ static int get_port_device_capability(struct pci_dev *dev)
|
||||
(pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
|
||||
services |= PCIE_PORT_SERVICE_DPC;
|
||||
|
||||
/* Enable bandwidth control if more than one speed is supported. */
|
||||
if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
|
||||
pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) {
|
||||
u32 linkcap;
|
||||
|
||||
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &linkcap);
|
||||
if (linkcap & PCI_EXP_LNKCAP_LBNC)
|
||||
if (linkcap & PCI_EXP_LNKCAP_LBNC &&
|
||||
hweight8(dev->supported_speeds) > 1)
|
||||
services |= PCIE_PORT_SERVICE_BWCTRL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user