aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 15:05:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 15:05:36 -0400
commitfdb2f9c2ebd4f07d7b11a3bc86d8c669eb841697 (patch)
treed85824518fc13a8c84b7399019fc11ad77aaa120 /arch/powerpc
parent81f56e5375e84689b891e0e6c5a02ec12a1f18d9 (diff)
parent78c8f84302ce007aedcfa11912fd4aacf22727ab (diff)
Merge tag 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI changes from Bjorn Helgaas: "Host bridge hotplug - Protect acpi_pci_drivers and acpi_pci_roots (Taku Izumi) - Clear host bridge resource info to avoid issue when releasing (Yinghai Lu) - Notify acpi_pci_drivers when hot-plugging host bridges (Jiang Liu) - Use standard list ops for acpi_pci_drivers (Jiang Liu) Device hotplug - Use pci_get_domain_bus_and_slot() to close hotplug races (Jiang Liu) - Remove fakephp driver (Bjorn Helgaas) - Fix VGA ref count in hotplug remove path (Yinghai Lu) - Allow acpiphp to handle PCIe ports without native hotplug (Jiang Liu) - Implement resume regardless of pciehp_force param (Oliver Neukum) - Make pci_fixup_irqs() work after init (Thierry Reding) Miscellaneous - Add pci_pcie_type(dev) and remove pci_dev.pcie_type (Yijing Wang) - Factor out PCI Express Capability accessors (Jiang Liu) - Add pcibios_window_alignment() so powerpc EEH can use generic resource assignment (Gavin Shan) - Make pci_error_handlers const (Stephen Hemminger) - Cleanup drivers/pci/remove.c (Bjorn Helgaas) - Improve Vendor-Specific Extended Capability support (Bjorn Helgaas) - Use standard list ops for bus->devices (Bjorn Helgaas) - Avoid kmalloc in pci_get_subsys() and pci_get_class() (Feng Tang) - Reassign invalid bus number ranges (Intel DP43BF workaround) (Yinghai Lu)" * tag 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (102 commits) PCI: acpiphp: Handle PCIe ports without native hotplug capability PCI/ACPI: Use acpi_driver_data() rather than searching acpi_pci_roots PCI/ACPI: Protect acpi_pci_roots list with mutex PCI/ACPI: Use acpi_pci_root info rather than looking it up again PCI/ACPI: Pass acpi_pci_root to acpi_pci_drivers' add/remove interface PCI/ACPI: Protect acpi_pci_drivers list with mutex PCI/ACPI: Notify acpi_pci_drivers when hot-plugging PCI root bridges PCI/ACPI: Use normal list for struct acpi_pci_driver PCI/ACPI: Use DEVICE_ACPI_HANDLE rather than searching acpi_pci_roots PCI: Fix default vga ref_count ia64/PCI: Clear host bridge aperture struct resource x86/PCI: Clear host bridge aperture struct resource PCI: Stop all children first, before removing all children Revert "PCI: Use hotplug-safe pci_get_domain_bus_and_slot()" PCI: Provide a default pcibios_update_irq() PCI: Discard __init annotations for pci_fixup_irqs() and related functions PCI: Use correct type when freeing bus resource list PCI: Check P2P bridge for invalid secondary/subordinate range PCI: Convert "new_id"/"remove_id" into generic pci_bus driver attributes xen-pcifront: Use hotplug-safe pci_get_domain_bus_and_slot() ...
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/machdep.h3
-rw-r--r--arch/powerpc/kernel/pci-common.c20
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c41
3 files changed, 63 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 42ce570812c..f7706d722b3 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -214,6 +214,9 @@ struct machdep_calls {
214 /* Called after scan and before resource survey */ 214 /* Called after scan and before resource survey */
215 void (*pcibios_fixup_phb)(struct pci_controller *hose); 215 void (*pcibios_fixup_phb)(struct pci_controller *hose);
216 216
217 /* Called during PCI resource reassignment */
218 resource_size_t (*pcibios_window_alignment)(struct pci_bus *, unsigned long type);
219
217 /* Called to shutdown machine specific hardware not already controlled 220 /* Called to shutdown machine specific hardware not already controlled
218 * by other drivers. 221 * by other drivers.
219 */ 222 */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2aa04f29e1d..43fea543d68 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -99,6 +99,26 @@ void pcibios_free_controller(struct pci_controller *phb)
99 kfree(phb); 99 kfree(phb);
100} 100}
101 101
102/*
103 * The function is used to return the minimal alignment
104 * for memory or I/O windows of the associated P2P bridge.
105 * By default, 4KiB alignment for I/O windows and 1MiB for
106 * memory windows.
107 */
108resource_size_t pcibios_window_alignment(struct pci_bus *bus,
109 unsigned long type)
110{
111 if (ppc_md.pcibios_window_alignment)
112 return ppc_md.pcibios_window_alignment(bus, type);
113
114 /*
115 * PCI core will figure out the default
116 * alignment: 4KiB for I/O and 1MiB for
117 * memory window.
118 */
119 return 1;
120}
121
102static resource_size_t pcibios_io_size(const struct pci_controller *hose) 122static resource_size_t pcibios_io_size(const struct pci_controller *hose)
103{ 123{
104#ifdef CONFIG_PPC64 124#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 9cda6a1ad0c..0e7eccc0f88 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -855,7 +855,7 @@ static void __devinit pnv_ioda_setup_PEs(struct pci_bus *bus)
855 if (pe == NULL) 855 if (pe == NULL)
856 continue; 856 continue;
857 /* Leaving the PCIe domain ... single PE# */ 857 /* Leaving the PCIe domain ... single PE# */
858 if (dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) 858 if (pci_pcie_type(dev) == PCI_EXP_TYPE_PCI_BRIDGE)
859 pnv_ioda_setup_bus_PE(dev, pe); 859 pnv_ioda_setup_bus_PE(dev, pe);
860 else if (dev->subordinate) 860 else if (dev->subordinate)
861 pnv_ioda_setup_PEs(dev->subordinate); 861 pnv_ioda_setup_PEs(dev->subordinate);
@@ -1139,6 +1139,44 @@ static void __devinit pnv_pci_ioda_fixup_phb(struct pci_controller *hose)
1139 } 1139 }
1140} 1140}
1141 1141
1142/*
1143 * Returns the alignment for I/O or memory windows for P2P
1144 * bridges. That actually depends on how PEs are segmented.
1145 * For now, we return I/O or M32 segment size for PE sensitive
1146 * P2P bridges. Otherwise, the default values (4KiB for I/O,
1147 * 1MiB for memory) will be returned.
1148 *
1149 * The current PCI bus might be put into one PE, which was
1150 * create against the parent PCI bridge. For that case, we
1151 * needn't enlarge the alignment so that we can save some
1152 * resources.
1153 */
1154static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
1155 unsigned long type)
1156{
1157 struct pci_dev *bridge;
1158 struct pci_controller *hose = pci_bus_to_host(bus);
1159 struct pnv_phb *phb = hose->private_data;
1160 int num_pci_bridges = 0;
1161
1162 bridge = bus->self;
1163 while (bridge) {
1164 if (pci_pcie_type(bridge) == PCI_EXP_TYPE_PCI_BRIDGE) {
1165 num_pci_bridges++;
1166 if (num_pci_bridges >= 2)
1167 return 1;
1168 }
1169
1170 bridge = bridge->bus->self;
1171 }
1172
1173 /* We need support prefetchable memory window later */
1174 if (type & IORESOURCE_MEM)
1175 return phb->ioda.m32_segsize;
1176
1177 return phb->ioda.io_segsize;
1178}
1179
1142/* Prevent enabling devices for which we couldn't properly 1180/* Prevent enabling devices for which we couldn't properly
1143 * assign a PE 1181 * assign a PE
1144 */ 1182 */
@@ -1306,6 +1344,7 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
1306 */ 1344 */
1307 ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb; 1345 ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb;
1308 ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook; 1346 ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook;
1347 ppc_md.pcibios_window_alignment = pnv_pci_window_alignment;
1309 pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC); 1348 pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC);
1310 1349
1311 /* Reset IODA tables to a clean state */ 1350 /* Reset IODA tables to a clean state */