]> Gentwo Git Trees - linux/.git/commitdiff
PCI: Try BAR resize even when no window was released
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 13 Nov 2025 16:26:21 +0000 (18:26 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 14 Nov 2025 18:33:05 +0000 (12:33 -0600)
Usually, resizing BARs requires releasing bridge windows in order to
resize it to fit a larger BAR into the window. This is not always the
case, however, FW could have made the window large enough to accommodate
larger BAR as is, or the user might prefer to shrink a BAR to make more
space for another Resizable BAR.

Thus, replace the check that requires that at least one bridge window
was released with a check that simply ensures bridge is not NULL.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Alex Bennée <alex.bennee@linaro.org> # AVA, AMD GPU
Link: https://patch.msgid.link/20251113162628.5946-5-ilpo.jarvinen@linux.intel.com
drivers/pci/setup-bus.c

index d58f025aeaffcf0a698d139bef2712d2fde090f2..1a3d545638540c1c1db8589af1507b43e39b1305 100644 (file)
@@ -2424,7 +2424,7 @@ int pbus_reassign_bridge_resources(struct pci_bus *bus, struct resource *res)
 {
        unsigned long type = res->flags;
        struct pci_dev_resource *dev_res;
-       struct pci_dev *bridge;
+       struct pci_dev *bridge = NULL;
        LIST_HEAD(saved);
        LIST_HEAD(added);
        LIST_HEAD(failed);
@@ -2459,10 +2459,8 @@ int pbus_reassign_bridge_resources(struct pci_bus *bus, struct resource *res)
                bus = bus->parent;
        }
 
-       if (list_empty(&saved)) {
-               up_read(&pci_bus_sem);
+       if (!bridge)
                return -ENOENT;
-       }
 
        __pci_bus_size_bridges(bridge->subordinate, &added);
        __pci_bridge_assign_resources(bridge, &added, &failed);