]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Revert "PCI: dwc: Don't wait for link up if driver can detect Link Up event"
authorNiklas Cassel <cassel@kernel.org>
Mon, 22 Dec 2025 06:42:13 +0000 (07:42 +0100)
committerManivannan Sadhasivam <mani@kernel.org>
Mon, 22 Dec 2025 17:01:31 +0000 (22:31 +0530)
This reverts commit 8d3bf19f1b585a3cc0027f508b64c33484db8d0d.

While this fake hotplugging was a nice idea, it has shown that this feature
does not handle PCIe switches correctly:
pci_bus 0004:43: busn_res: can not insert [bus 43-41] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci_bus 0004:43: busn_res: [bus 43-41] end is updated to 43
pci_bus 0004:43: busn_res: can not insert [bus 43] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci 0004:42:00.0: devices behind bridge are unusable because [bus 43] cannot be assigned for them
pci_bus 0004:44: busn_res: can not insert [bus 44-41] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci_bus 0004:44: busn_res: [bus 44-41] end is updated to 44
pci_bus 0004:44: busn_res: can not insert [bus 44] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci 0004:42:02.0: devices behind bridge are unusable because [bus 44] cannot be assigned for them
pci_bus 0004:45: busn_res: can not insert [bus 45-41] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci_bus 0004:45: busn_res: [bus 45-41] end is updated to 45
pci_bus 0004:45: busn_res: can not insert [bus 45] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci 0004:42:06.0: devices behind bridge are unusable because [bus 45] cannot be assigned for them
pci_bus 0004:46: busn_res: can not insert [bus 46-41] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci_bus 0004:46: busn_res: [bus 46-41] end is updated to 46
pci_bus 0004:46: busn_res: can not insert [bus 46] under [bus 42-41] (conflicts with (null) [bus 42-41])
pci 0004:42:0e.0: devices behind bridge are unusable because [bus 46] cannot be assigned for them
pci_bus 0004:42: busn_res: [bus 42-41] end is updated to 46
pci_bus 0004:42: busn_res: can not insert [bus 42-46] under [bus 41] (conflicts with (null) [bus 41])
pci 0004:41:00.0: devices behind bridge are unusable because [bus 42-46] cannot be assigned for them
pcieport 0004:40:00.0: bridge has subordinate 41 but max busn 46

During the initial scan, PCI core doesn't see the switch and since the Root
Port is not hot plug capable, the secondary bus number gets assigned as the
subordinate bus number. This means, the PCI core assumes that only one bus
will appear behind the Root Port since the Root Port is not hot plug
capable.

This works perfectly fine for PCIe endpoints connected to the Root Port,
since they don't extend the bus. However, if a PCIe switch is connected,
then there is a problem when the downstream busses starts showing up and
the PCI core doesn't extend the subordinate bus number and bridge resources
after initial scan during boot.

So revert the change that skipped dw_pcie_wait_for_link() if the Link up
IRQ was used by a vendor glue driver.

Suggested-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20251222064207.3246632-14-cassel@kernel.org
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/dwc/pcie-designware.h

index 8c41b90a1db1e3b92947238683714ab0b666efab..06c02fcc76c89483da6e7fa886b788f2f04c817d 100644 (file)
@@ -665,14 +665,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
                        goto err_remove_edma;
        }
 
-       /*
-        * Note: Skip the link up delay only when a Link Up IRQ is present.
-        * If there is no Link Up IRQ, we should not bypass the delay
-        * because that would require users to manually rescan for devices.
-        */
-       if (!pp->use_linkup_irq)
-               /* Ignore errors, the link may come up later */
-               dw_pcie_wait_for_link(pci);
+       /* Ignore errors, the link may come up later */
+       dw_pcie_wait_for_link(pci);
 
        ret = pci_host_probe(bridge);
        if (ret)
index fc9cf8ce86290c42ef480582754b9483c5cd5268..a3a3f6e89a812346cf1b628845886e25fdef4ccd 100644 (file)
@@ -438,7 +438,6 @@ struct dw_pcie_rp {
        bool                    use_atu_msg;
        int                     msg_atu_index;
        struct resource         *msg_res;
-       bool                    use_linkup_irq;
        struct pci_eq_presets   presets;
        struct pci_config_window *cfg;
        bool                    ecam_enabled;