orgads / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
589f80
centosplus patch (bug#12277)
589f80
589f80
Ref: https://patchwork.kernel.org/patch/9397341/
589f80
589f80
--- a/drivers/pci/probe.c	2016-10-19 07:16:25.000000000 -0700
589f80
+++ b/drivers/pci/probe.c	2016-11-28 09:30:30.621332097 -0800
589f80
@@ -1426,6 +1426,16 @@ static void program_hpp_type1(struct pci
589f80
 		dev_warn(&dev->dev, "PCI-X settings not supported\n");
589f80
 }
589f80
 
589f80
+static bool pcie_get_upstream_rcb(struct pci_dev *dev)
589f80
+{
589f80
+	struct pci_dev *bridge = pci_upstream_bridge(dev);
589f80
+	u16 lnkctl;
589f80
+
589f80
+	pcie_capability_read_word(bridge, PCI_EXP_LNKCTL, &lnkctl);
589f80
+
589f80
+	return lnkctl & PCI_EXP_LNKCTL_RCB;
589f80
+}
589f80
+
589f80
 static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
589f80
 {
589f80
 	int pos;
589f80
@@ -1455,9 +1465,21 @@ static void program_hpp_type2(struct pci
589f80
 			~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or);
589f80
 
589f80
 	/* Initialize Link Control Register */
589f80
-	if (pcie_cap_has_lnkctl(dev))
589f80
+	if (pcie_cap_has_lnkctl(dev)) {
589f80
+		bool us_rcb;
589f80
+		u16 clear;
589f80
+		u16 set;
589f80
+
589f80
+		us_rcb = pcie_get_upstream_rcb(dev);
589f80
+
589f80
+		clear = ~hpp->pci_exp_lnkctl_and;
589f80
+		set = hpp->pci_exp_lnkctl_or;
589f80
+		if (!us_rcb)
589f80
+			set &= ~PCI_EXP_LNKCTL_RCB;
589f80
+
589f80
 		pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
589f80
-			~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or);
589f80
+						  clear, set);
589f80
+	}
589f80
 
589f80
 	/* Find Advanced Error Reporting Enhanced Capability */
589f80
 	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);