Skip to content

Commit 3ebfe46

Browse files
Yinghai Lubjorn-helgaas
authored andcommitted
powerpc/PCI: Clip bridge windows to fit in upstream windows
Every PCI-PCI bridge window should fit inside an upstream bridge window because orphaned address space is unreachable from the primary side of the upstream bridge. If we inherit invalid bridge windows that overlap an upstream window from firmware, clip them to fit and update the bridge accordingly. [bhelgaas: changelog] Link: https://bugzilla.kernel.org/show_bug.cgi?id=85491 Reported-by: Marek Kordik <[email protected]> Fixes: 5b28541 ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources") Signed-off-by: Yinghai Lu <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> CC: Benjamin Herrenschmidt <[email protected]> CC: Paul Mackerras <[email protected]> CC: Michael Ellerman <[email protected]> CC: Gavin Shan <[email protected]> CC: Anton Blanchard <[email protected]> CC: Sebastian Ott <[email protected]> CC: Wei Yang <[email protected]> CC: Andrew Murray <[email protected]> CC: [email protected]
1 parent 2e5e804 commit 3ebfe46

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/powerpc/kernel/pci-common.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
11841184
pr, (pr && pr->name) ? pr->name : "nil");
11851185

11861186
if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1187+
struct pci_dev *dev = bus->self;
1188+
11871189
if (request_resource(pr, res) == 0)
11881190
continue;
11891191
/*
@@ -1193,6 +1195,11 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
11931195
*/
11941196
if (reparent_resources(pr, res) == 0)
11951197
continue;
1198+
1199+
if (dev && i < PCI_BRIDGE_RESOURCE_NUM &&
1200+
pci_claim_bridge_resource(dev,
1201+
i + PCI_BRIDGE_RESOURCES) == 0)
1202+
continue;
11961203
}
11971204
pr_warning("PCI: Cannot allocate resource region "
11981205
"%d of PCI bridge %d, will remap\n", i, bus->number);
@@ -1401,7 +1408,10 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
14011408
(unsigned long long)r->end,
14021409
(unsigned int)r->flags);
14031410

1404-
pci_claim_resource(dev, i);
1411+
if (pci_claim_resource(dev, i) == 0)
1412+
continue;
1413+
1414+
pci_claim_bridge_resource(dev, i);
14051415
}
14061416
}
14071417

0 commit comments

Comments
 (0)