summaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2018-01-31 10:10:30 -0600
committerBjorn Helgaas <helgaas@kernel.org>2018-01-31 10:10:30 -0600
commit5be31686cf4752443e669f48843eed036c69f999 (patch)
tree2b13b1c012f929de0a897f1088c8c330b7e786a4 /drivers/pci/probe.c
parent6b290397afb89ac23f29be30c6637756d256f959 (diff)
parent20c3ff6114b0c32beb85d476d7331ad9ab1942e2 (diff)
downloadlinux-0-day-5be31686cf4752443e669f48843eed036c69f999.tar.gz
linux-0-day-5be31686cf4752443e669f48843eed036c69f999.tar.xz
Merge branch 'pci/enumeration' into next
* pci/enumeration: RDMA/qedr: Use pci_enable_atomic_ops_to_root() PCI: Add pci_enable_atomic_ops_to_root() PCI: Make PCI_SCAN_ALL_PCIE_DEVS work for Root as well as Downstream Ports
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 3761b13035296..0704760368469 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2248,22 +2248,27 @@ static unsigned next_fn(struct pci_bus *bus, struct pci_dev *dev, unsigned fn)
static int only_one_child(struct pci_bus *bus)
{
- struct pci_dev *parent = bus->self;
+ struct pci_dev *bridge = bus->self;
- if (!parent || !pci_is_pcie(parent))
+ /*
+ * Systems with unusual topologies set PCI_SCAN_ALL_PCIE_DEVS so
+ * we scan for all possible devices, not just Device 0.
+ */
+ if (pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
return 0;
- if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
- return 1;
/*
- * PCIe downstream ports are bridges that normally lead to only a
- * device 0, but if PCI_SCAN_ALL_PCIE_DEVS is set, scan all
- * possible devices, not just device 0. See PCIe spec r3.0,
- * sec 7.3.1.
+ * A PCIe Downstream Port normally leads to a Link with only Device
+ * 0 on it (PCIe spec r3.1, sec 7.3.1). As an optimization, scan
+ * only for Device 0 in that situation.
+ *
+ * Checking has_secondary_link is a hack to identify Downstream
+ * Ports because sometimes Switches are configured such that the
+ * PCIe Port Type labels are backwards.
*/
- if (parent->has_secondary_link &&
- !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
+ if (bridge && pci_is_pcie(bridge) && bridge->has_secondary_link)
return 1;
+
return 0;
}