Skip to content

Commit 4141096

Browse files
committed
Merge tag 'pci-v6.1-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull pci fix from Bjorn Helgaas: "Revert the attempt to distribute spare resources to unconfigured hotplug bridges at boot time. This fixed some dock hot-add scenarios, but Jonathan Cameron reported that it broke a topology with a multi-function device where one function was a Switch Upstream Port and the other was an Endpoint" * tag 'pci-v6.1-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: Revert "PCI: Distribute available resources for root buses, too"
2 parents 19d17ab + 5632e2b commit 4141096

File tree

1 file changed

+1
-61
lines changed

1 file changed

+1
-61
lines changed

drivers/pci/setup-bus.c

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,10 +1768,7 @@ static void adjust_bridge_window(struct pci_dev *bridge, struct resource *res,
17681768
}
17691769

17701770
res->end = res->start + new_size - 1;
1771-
1772-
/* If the resource is part of the add_list remove it now */
1773-
if (add_list)
1774-
remove_from_list(add_list, res);
1771+
remove_from_list(add_list, res);
17751772
}
17761773

17771774
static void pci_bus_distribute_available_resources(struct pci_bus *bus,
@@ -1926,8 +1923,6 @@ static void pci_bridge_distribute_available_resources(struct pci_dev *bridge,
19261923
if (!bridge->is_hotplug_bridge)
19271924
return;
19281925

1929-
pci_dbg(bridge, "distributing available resources\n");
1930-
19311926
/* Take the initial extra resources from the hotplug port */
19321927
available_io = bridge->resource[PCI_BRIDGE_IO_WINDOW];
19331928
available_mmio = bridge->resource[PCI_BRIDGE_MEM_WINDOW];
@@ -1939,59 +1934,6 @@ static void pci_bridge_distribute_available_resources(struct pci_dev *bridge,
19391934
available_mmio_pref);
19401935
}
19411936

1942-
static bool pci_bridge_resources_not_assigned(struct pci_dev *dev)
1943-
{
1944-
const struct resource *r;
1945-
1946-
/*
1947-
* Check the child device's resources and if they are not yet
1948-
* assigned it means we are configuring them (not the boot
1949-
* firmware) so we should be able to extend the upstream
1950-
* bridge's (that's the hotplug downstream PCIe port) resources
1951-
* in the same way we do with the normal hotplug case.
1952-
*/
1953-
r = &dev->resource[PCI_BRIDGE_IO_WINDOW];
1954-
if (!r->flags || !(r->flags & IORESOURCE_STARTALIGN))
1955-
return false;
1956-
r = &dev->resource[PCI_BRIDGE_MEM_WINDOW];
1957-
if (!r->flags || !(r->flags & IORESOURCE_STARTALIGN))
1958-
return false;
1959-
r = &dev->resource[PCI_BRIDGE_PREF_MEM_WINDOW];
1960-
if (!r->flags || !(r->flags & IORESOURCE_STARTALIGN))
1961-
return false;
1962-
1963-
return true;
1964-
}
1965-
1966-
static void pci_root_bus_distribute_available_resources(struct pci_bus *bus,
1967-
struct list_head *add_list)
1968-
{
1969-
struct pci_dev *dev, *bridge = bus->self;
1970-
1971-
for_each_pci_bridge(dev, bus) {
1972-
struct pci_bus *b;
1973-
1974-
b = dev->subordinate;
1975-
if (!b)
1976-
continue;
1977-
1978-
/*
1979-
* Need to check "bridge" here too because it is NULL
1980-
* in case of root bus.
1981-
*/
1982-
if (bridge && pci_bridge_resources_not_assigned(dev)) {
1983-
pci_bridge_distribute_available_resources(bridge, add_list);
1984-
/*
1985-
* There is only PCIe upstream port on the bus
1986-
* so we don't need to go futher.
1987-
*/
1988-
return;
1989-
}
1990-
1991-
pci_root_bus_distribute_available_resources(b, add_list);
1992-
}
1993-
}
1994-
19951937
/*
19961938
* First try will not touch PCI bridge res.
19971939
* Second and later try will clear small leaf bridge res.
@@ -2031,8 +1973,6 @@ void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus)
20311973
*/
20321974
__pci_bus_size_bridges(bus, add_list);
20331975

2034-
pci_root_bus_distribute_available_resources(bus, add_list);
2035-
20361976
/* Depth last, allocate resources and update the hardware. */
20371977
__pci_bus_assign_resources(bus, add_list, &fail_head);
20381978
if (add_list)

0 commit comments

Comments
 (0)