aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2012-06-03 18:15:25 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-09-06 20:45:30 -0400
commitcf1a4cf8754afb248e498815c7957aeb4faca79f (patch)
tree1d6aefff7b785d3dc2c3acd40eba9e9d57de9293 /arch/powerpc
parentfff34b3412b9401a76ba9d021db1bd91cb0e02b6 (diff)
powerpc/pci: Save P2P bridge resource if possible
When PCI probe flag PCI_REASSIGN_ALL_RSRC has been passed into PCI core, it's hoped that all resources to be reassigned by PCI core. As to particular P2P (PCI-to-PCI) bridge, the size of the corresponding BAR (I/O, MMIO, prefetchable MMIO) is calculated by the resources required by the PCI devices behind the P2P bridge. That means that the information like start/end address retrieved from the hardware registers of the P2P bridge is meainingless in the case. However, we still count that in and the BARs might have been configured by firmware with non-zero size. That leads to space waste. The patch explicitly sets the size of P2P bridge BARs to zero in case that resource reassignment is expected with PCI probe flag PCI_REASSIGN_ALL_RSRC. In the result, it will save overall resource required by the system without waste. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/pci-common.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2aa04f29e1de..4cb714792bea 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -960,13 +960,14 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
960 if (i >= 3 && bus->self->transparent) 960 if (i >= 3 && bus->self->transparent)
961 continue; 961 continue;
962 962
963 /* If we are going to re-assign everything, mark the resource 963 /* If we're going to reassign everything, we can
964 * as unset and move it down to 0 964 * shrink the P2P resource to have size as being
965 * of 0 in order to save space.
965 */ 966 */
966 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) { 967 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) {
967 res->flags |= IORESOURCE_UNSET; 968 res->flags |= IORESOURCE_UNSET;
968 res->end -= res->start;
969 res->start = 0; 969 res->start = 0;
970 res->end = -1;
970 continue; 971 continue;
971 } 972 }
972 973
@@ -1228,7 +1229,14 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1228 pr_warning("PCI: Cannot allocate resource region " 1229 pr_warning("PCI: Cannot allocate resource region "
1229 "%d of PCI bridge %d, will remap\n", i, bus->number); 1230 "%d of PCI bridge %d, will remap\n", i, bus->number);
1230 clear_resource: 1231 clear_resource:
1231 res->start = res->end = 0; 1232 /* The resource might be figured out when doing
1233 * reassignment based on the resources required
1234 * by the downstream PCI devices. Here we set
1235 * the size of the resource to be 0 in order to
1236 * save more space.
1237 */
1238 res->start = 0;
1239 res->end = -1;
1232 res->flags = 0; 1240 res->flags = 0;
1233 } 1241 }
1234 1242