]> www.infradead.org Git - users/hch/misc.git/commitdiff
PCI: Set up bridge resources earlier
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 24 Sep 2025 13:42:27 +0000 (16:42 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 25 Sep 2025 21:15:22 +0000 (16:15 -0500)
Bridge windows are read twice from PCI Config Space, the first time from
pci_read_bridge_windows(), which does not set up the device's resources.
This causes problems down the road as child resources of the bridge cannot
check whether they reside within the bridge window or not.

Set up the bridge windows already in pci_read_bridge_windows().

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250924134228.1663-2-ilpo.jarvinen@linux.intel.com
drivers/pci/probe.c

index eaeb66bec433b0d0dc7935d0df372119ac7c76ad..86a83ab043d293d0eae1bf391350c6ae2733679b 100644 (file)
@@ -537,10 +537,14 @@ static void pci_read_bridge_windows(struct pci_dev *bridge)
        }
        if (io) {
                bridge->io_window = 1;
-               pci_read_bridge_io(bridge, &res, true);
+               pci_read_bridge_io(bridge,
+                                  pci_resource_n(bridge, PCI_BRIDGE_IO_WINDOW),
+                                  true);
        }
 
-       pci_read_bridge_mmio(bridge, &res, true);
+       pci_read_bridge_mmio(bridge,
+                            pci_resource_n(bridge, PCI_BRIDGE_MEM_WINDOW),
+                            true);
 
        /*
         * DECchip 21050 pass 2 errata: the bridge may miss an address
@@ -578,7 +582,10 @@ static void pci_read_bridge_windows(struct pci_dev *bridge)
                        bridge->pref_64_window = 1;
        }
 
-       pci_read_bridge_mmio_pref(bridge, &res, true);
+       pci_read_bridge_mmio_pref(bridge,
+                                 pci_resource_n(bridge,
+                                                PCI_BRIDGE_PREF_MEM_WINDOW),
+                                 true);
 }
 
 void pci_read_bridge_bases(struct pci_bus *child)