Skip to content

Commit 469276c

Browse files
ij-intelbjorn-helgaas
authored andcommitted
PCI: Revert early bridge resource set up
The commit a43ac32 ("PCI: Set up bridge resources earlier") moved bridge window resources set up earlier than before. The change was necessary to support another change that got pulled on the last minute due to breaking s390 and other systems. The presence of valid bridge window resources earlier than before allows pci_assign_unassigned_root_bus_resources() call from pci_host_probe() assign the bridge windows. Some host bridges, however, have to wait first for the link up event before they can enumerate successfully (see e.g. qcom_pcie_global_irq_thread()) and thus the bus has not been enumerated yet while calling pci_host_probe(). Calling pci_assign_unassigned_root_bus_resources() without results from enumeration can result in sizing bridge windows with too small sizes which cannot be later corrected after the enumeration has completed because bridge windows have become pinned in place by the other resources. Interestingly, it seems pci_read_bridge_bases() is not called at all in the problematic case and the bridge window resource type setup is done by pci_bridge_check_ranges() and sizing by the usual resource fitting logic. The root problem behind all this looks pretty generic. If resource fitting is called too early, the hotplug reservation and old size lower bounding cause the bridge windows to be assigned without children but with non-zero size, which leads to these pinning problems. As such, this can likely be solved on the general level but the solution does not look trivial. As the commit a43ac32 ("PCI: Set up bridge resources earlier") was prequisite for other change that did not end up into kernel yet, revert it to resolve the resource assignment failures and give time to code and test a generic solution. Fixes: a43ac32 ("PCI: Set up bridge resources earlier") Reported-by: Val Packett <val@packett.cool> Link: https://lore.kernel.org/r/017ff8df-511c-4da8-b3cf-edf2cb7f1a67@packett.cool Reported-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/df266709-a9b3-4fd8-af3a-c22eb3c9523a@roeck-us.net Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20251014163602.17138-1-ilpo.jarvinen@linux.intel.com
1 parent d6fc451 commit 469276c

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/pci/probe.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -538,14 +538,10 @@ static void pci_read_bridge_windows(struct pci_dev *bridge)
538538
}
539539
if (io) {
540540
bridge->io_window = 1;
541-
pci_read_bridge_io(bridge,
542-
pci_resource_n(bridge, PCI_BRIDGE_IO_WINDOW),
543-
true);
541+
pci_read_bridge_io(bridge, &res, true);
544542
}
545543

546-
pci_read_bridge_mmio(bridge,
547-
pci_resource_n(bridge, PCI_BRIDGE_MEM_WINDOW),
548-
true);
544+
pci_read_bridge_mmio(bridge, &res, true);
549545

550546
/*
551547
* DECchip 21050 pass 2 errata: the bridge may miss an address
@@ -583,10 +579,7 @@ static void pci_read_bridge_windows(struct pci_dev *bridge)
583579
bridge->pref_64_window = 1;
584580
}
585581

586-
pci_read_bridge_mmio_pref(bridge,
587-
pci_resource_n(bridge,
588-
PCI_BRIDGE_PREF_MEM_WINDOW),
589-
true);
582+
pci_read_bridge_mmio_pref(bridge, &res, true);
590583
}
591584

592585
void pci_read_bridge_bases(struct pci_bus *child)

0 commit comments

Comments
 (0)