• Bjorn Helgaas's avatar
    PCI: Enumerate switches below PCI-to-PCIe bridges · 51ebfc92
    Bjorn Helgaas authored
    A PCI-to-PCIe bridge (a "reverse bridge") has a PCI or PCI-X primary
    interface and a PCI Express secondary interface.  The PCIe interface is a
    Downstream Port that originates a Link.  See the "PCI Express to PCI/PCI-X
    Bridge Specification", rev 1.0, sections 1.2 and A.6.
    
    The bug report below involves a PCI-to-PCIe bridge and a PCIe switch below
    the bridge:
    
      00:1e.0 Intel 82801 PCI Bridge to [bus 01-0a]
      01:00.0 Pericom PI7C9X111SL PCIe-to-PCI Reversible Bridge to [bus 02-0a]
      02:00.0 Pericom Device 8608 [PCIe Upstream Port] to [bus 03-0a]
      03:01.0 Pericom Device 8608 [PCIe Downstream Port] to [bus 0a]
    
    01:00.0 is configured as a PCI-to-PCIe bridge (despite the name printed by
    lspci).  As we traverse a PCIe hierarchy, device connections alternate
    between PCIe Links and internal Switch logic.  Previously we did not
    recognize that 01:00.0 had a secondary link, so we thought the 02:00.0
    Upstream Port *did* have a secondary link.  In fact, it's the other way
    around: 01:00.0 has a secondary link, and 02:00.0 has internal Switch logic
    on its secondary side.
    
    When we thought 02:00.0 had a secondary link, the pci_scan_slot() ->
    only_one_child() path assumed 02:00.0 could have only one child, so 03:00.0
    was the only possible downstream device.  But 03:00.0 doesn't exist, so we
    didn't look for any other devices on bus 03.
    
    Booting with "pci=pcie_scan_all" is a workaround, but we don't want users
    to have to do that.
    
    Recognize that PCI-to-PCIe bridges originate links on their secondary
    interfaces.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=189361
    Fixes: d0751b98 ("PCI: Add dev->has_secondary_link to track downstream PCIe links")
    Tested-by: default avatarBlake Moore <blake.moore@men.de>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    CC: stable@vger.kernel.org	# v4.2+
    51ebfc92
probe.c 64.7 KB