diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2013-06-20 01:20:52 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-06-20 03:05:35 -0400 |
commit | 317f06de78152e0eb0aab5881d69e4c5cdf9f1fe (patch) | |
tree | 7e3253345db6e8bab2089eee8cd268ac0c90ac9b /arch | |
parent | a84f273c30500c0d5816e07232e3326a61956016 (diff) |
powerpc/eeh: Move common part to kernel directory
The patch moves the common part of EEH core into arch/powerpc/kernel
directory so that we needn't PPC_PSERIES while compiling POWERNV
platform:
* Move the EEH common part into arch/powerpc/kernel
* Move the functions for PCI hotplug from pSeries platform to
arch/powerpc/kernel/pci-hotplug.c
* Move CONFIG_EEH from arch/powerpc/platforms/pseries/Kconfig to
arch/powerpc/platforms/Kconfig
* Adjust makefile accordingly
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/Makefile | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh.c (renamed from arch/powerpc/platforms/pseries/eeh.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_cache.c (renamed from arch/powerpc/platforms/pseries/eeh_cache.c) | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_dev.c (renamed from arch/powerpc/platforms/pseries/eeh_dev.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_driver.c (renamed from arch/powerpc/platforms/pseries/eeh_driver.c) | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_event.c (renamed from arch/powerpc/platforms/pseries/eeh_event.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_pe.c (renamed from arch/powerpc/platforms/pseries/eeh_pe.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_sysfs.c (renamed from arch/powerpc/platforms/pseries/eeh_sysfs.c) | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-hotplug.c | 111 | ||||
-rw-r--r-- | arch/powerpc/platforms/Kconfig | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/Kconfig | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/Makefile | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/pci_dlpar.c | 85 |
13 files changed, 120 insertions, 97 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index f960a7944553..a8619bfe879e 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -58,6 +58,8 @@ obj-$(CONFIG_RTAS_PROC) += rtas-proc.o | |||
58 | obj-$(CONFIG_LPARCFG) += lparcfg.o | 58 | obj-$(CONFIG_LPARCFG) += lparcfg.o |
59 | obj-$(CONFIG_IBMVIO) += vio.o | 59 | obj-$(CONFIG_IBMVIO) += vio.o |
60 | obj-$(CONFIG_IBMEBUS) += ibmebus.o | 60 | obj-$(CONFIG_IBMEBUS) += ibmebus.o |
61 | obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \ | ||
62 | eeh_driver.o eeh_event.o eeh_sysfs.o | ||
61 | obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o | 63 | obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o |
62 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o | 64 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o |
63 | obj-$(CONFIG_FA_DUMP) += fadump.o | 65 | obj-$(CONFIG_FA_DUMP) += fadump.o |
@@ -100,7 +102,7 @@ obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o | |||
100 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 102 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
101 | obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o | 103 | obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o |
102 | 104 | ||
103 | pci64-$(CONFIG_PPC64) += pci_dn.o isa-bridge.o | 105 | pci64-$(CONFIG_PPC64) += pci_dn.o pci-hotplug.o isa-bridge.o |
104 | obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \ | 106 | obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \ |
105 | pci-common.o pci_of_scan.o | 107 | pci-common.o pci_of_scan.o |
106 | obj-$(CONFIG_PCI_MSI) += msi.o | 108 | obj-$(CONFIG_PCI_MSI) += msi.o |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/kernel/eeh.c index 8a8345193083..8a8345193083 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c index 5a4c87903057..1d5d9a6ba740 100644 --- a/arch/powerpc/platforms/pseries/eeh_cache.c +++ b/arch/powerpc/kernel/eeh_cache.c | |||
@@ -316,4 +316,3 @@ void __init eeh_addr_cache_build(void) | |||
316 | eeh_addr_cache_print(&pci_io_addr_cache_root); | 316 | eeh_addr_cache_print(&pci_io_addr_cache_root); |
317 | #endif | 317 | #endif |
318 | } | 318 | } |
319 | |||
diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/kernel/eeh_dev.c index 1efa28f5fc54..1efa28f5fc54 100644 --- a/arch/powerpc/platforms/pseries/eeh_dev.c +++ b/arch/powerpc/kernel/eeh_dev.c | |||
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 0acc5a2bdfc7..fb927af9a9ef 100644 --- a/arch/powerpc/platforms/pseries/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c | |||
@@ -549,4 +549,3 @@ perm_error: | |||
549 | if (frozen_bus) | 549 | if (frozen_bus) |
550 | pcibios_remove_pci_devices(frozen_bus); | 550 | pcibios_remove_pci_devices(frozen_bus); |
551 | } | 551 | } |
552 | |||
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/kernel/eeh_event.c index 185bedd926df..185bedd926df 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/kernel/eeh_event.c | |||
diff --git a/arch/powerpc/platforms/pseries/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 9d4a9e8562b2..9d4a9e8562b2 100644 --- a/arch/powerpc/platforms/pseries/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c | |||
diff --git a/arch/powerpc/platforms/pseries/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index d37708360f2e..e7ae3484918c 100644 --- a/arch/powerpc/platforms/pseries/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c | |||
@@ -72,4 +72,3 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev) | |||
72 | device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); | 72 | device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); |
73 | device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); | 73 | device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); |
74 | } | 74 | } |
75 | |||
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c new file mode 100644 index 000000000000..3f608800c06b --- /dev/null +++ b/arch/powerpc/kernel/pci-hotplug.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * Derived from "arch/powerpc/platforms/pseries/pci_dlpar.c" | ||
3 | * | ||
4 | * Copyright (C) 2003 Linda Xie <lxie@us.ibm.com> | ||
5 | * Copyright (C) 2005 International Business Machines | ||
6 | * | ||
7 | * Updates, 2005, John Rose <johnrose@austin.ibm.com> | ||
8 | * Updates, 2005, Linas Vepstas <linas@austin.ibm.com> | ||
9 | * Updates, 2013, Gavin Shan <shangw@linux.vnet.ibm.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #include <linux/pci.h> | ||
18 | #include <linux/export.h> | ||
19 | #include <asm/pci-bridge.h> | ||
20 | #include <asm/ppc-pci.h> | ||
21 | #include <asm/firmware.h> | ||
22 | #include <asm/eeh.h> | ||
23 | |||
24 | /** | ||
25 | * __pcibios_remove_pci_devices - remove all devices under this bus | ||
26 | * @bus: the indicated PCI bus | ||
27 | * @purge_pe: destroy the PE on removal of PCI devices | ||
28 | * | ||
29 | * Remove all of the PCI devices under this bus both from the | ||
30 | * linux pci device tree, and from the powerpc EEH address cache. | ||
31 | * By default, the corresponding PE will be destroied during the | ||
32 | * normal PCI hotplug path. For PCI hotplug during EEH recovery, | ||
33 | * the corresponding PE won't be destroied and deallocated. | ||
34 | */ | ||
35 | void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe) | ||
36 | { | ||
37 | struct pci_dev *dev, *tmp; | ||
38 | struct pci_bus *child_bus; | ||
39 | |||
40 | /* First go down child busses */ | ||
41 | list_for_each_entry(child_bus, &bus->children, node) | ||
42 | __pcibios_remove_pci_devices(child_bus, purge_pe); | ||
43 | |||
44 | pr_debug("PCI: Removing devices on bus %04x:%02x\n", | ||
45 | pci_domain_nr(bus), bus->number); | ||
46 | list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { | ||
47 | pr_debug(" * Removing %s...\n", pci_name(dev)); | ||
48 | eeh_remove_bus_device(dev, purge_pe); | ||
49 | pci_stop_and_remove_bus_device(dev); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | /** | ||
54 | * pcibios_remove_pci_devices - remove all devices under this bus | ||
55 | * @bus: the indicated PCI bus | ||
56 | * | ||
57 | * Remove all of the PCI devices under this bus both from the | ||
58 | * linux pci device tree, and from the powerpc EEH address cache. | ||
59 | */ | ||
60 | void pcibios_remove_pci_devices(struct pci_bus *bus) | ||
61 | { | ||
62 | __pcibios_remove_pci_devices(bus, 1); | ||
63 | } | ||
64 | EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); | ||
65 | |||
66 | /** | ||
67 | * pcibios_add_pci_devices - adds new pci devices to bus | ||
68 | * @bus: the indicated PCI bus | ||
69 | * | ||
70 | * This routine will find and fixup new pci devices under | ||
71 | * the indicated bus. This routine presumes that there | ||
72 | * might already be some devices under this bridge, so | ||
73 | * it carefully tries to add only new devices. (And that | ||
74 | * is how this routine differs from other, similar pcibios | ||
75 | * routines.) | ||
76 | */ | ||
77 | void pcibios_add_pci_devices(struct pci_bus * bus) | ||
78 | { | ||
79 | int slotno, num, mode, pass, max; | ||
80 | struct pci_dev *dev; | ||
81 | struct device_node *dn = pci_bus_to_OF_node(bus); | ||
82 | |||
83 | eeh_add_device_tree_early(dn); | ||
84 | |||
85 | mode = PCI_PROBE_NORMAL; | ||
86 | if (ppc_md.pci_probe_mode) | ||
87 | mode = ppc_md.pci_probe_mode(bus); | ||
88 | |||
89 | if (mode == PCI_PROBE_DEVTREE) { | ||
90 | /* use ofdt-based probe */ | ||
91 | of_rescan_bus(dn, bus); | ||
92 | } else if (mode == PCI_PROBE_NORMAL) { | ||
93 | /* use legacy probe */ | ||
94 | slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); | ||
95 | num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); | ||
96 | if (!num) | ||
97 | return; | ||
98 | pcibios_setup_bus_devices(bus); | ||
99 | max = bus->busn_res.start; | ||
100 | for (pass = 0; pass < 2; pass++) { | ||
101 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
102 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | ||
103 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | ||
104 | max = pci_scan_bridge(bus, dev, | ||
105 | max, pass); | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | pcibios_finish_adding_to_bus(bus); | ||
110 | } | ||
111 | EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); | ||
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index b62aab3e22ec..bed8c607588c 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig | |||
@@ -164,6 +164,11 @@ config IBMEBUS | |||
164 | help | 164 | help |
165 | Bus device driver for GX bus based adapters. | 165 | Bus device driver for GX bus based adapters. |
166 | 166 | ||
167 | config EEH | ||
168 | bool | ||
169 | depends on (PPC_POWERNV || PPC_PSERIES) && PCI | ||
170 | default y | ||
171 | |||
167 | config PPC_MPC106 | 172 | config PPC_MPC106 |
168 | bool | 173 | bool |
169 | default n | 174 | default n |
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 4459eff7a75a..1bd3399146ed 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig | |||
@@ -33,11 +33,6 @@ config PPC_SPLPAR | |||
33 | processors, that is, which share physical processors between | 33 | processors, that is, which share physical processors between |
34 | two or more partitions. | 34 | two or more partitions. |
35 | 35 | ||
36 | config EEH | ||
37 | bool | ||
38 | depends on PPC_PSERIES && PCI | ||
39 | default y | ||
40 | |||
41 | config PSERIES_MSI | 36 | config PSERIES_MSI |
42 | bool | 37 | bool |
43 | depends on PCI_MSI && EEH | 38 | depends on PCI_MSI && EEH |
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 53866e537a92..8ae010381316 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
@@ -6,9 +6,7 @@ obj-y := lpar.o hvCall.o nvram.o reconfig.o \ | |||
6 | firmware.o power.o dlpar.o mobility.o | 6 | firmware.o power.o dlpar.o mobility.o |
7 | obj-$(CONFIG_SMP) += smp.o | 7 | obj-$(CONFIG_SMP) += smp.o |
8 | obj-$(CONFIG_SCANLOG) += scanlog.o | 8 | obj-$(CONFIG_SCANLOG) += scanlog.o |
9 | obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \ | 9 | obj-$(CONFIG_EEH) += eeh_pseries.o |
10 | eeh_driver.o eeh_event.o eeh_sysfs.o \ | ||
11 | eeh_pseries.o | ||
12 | obj-$(CONFIG_KEXEC) += kexec.o | 10 | obj-$(CONFIG_KEXEC) += kexec.o |
13 | obj-$(CONFIG_PCI) += pci.o pci_dlpar.o | 11 | obj-$(CONFIG_PCI) += pci.o pci_dlpar.o |
14 | obj-$(CONFIG_PSERIES_MSI) += msi.o | 12 | obj-$(CONFIG_PSERIES_MSI) += msi.o |
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index c91b22be9288..efe61374f6ea 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c | |||
@@ -64,91 +64,6 @@ pcibios_find_pci_bus(struct device_node *dn) | |||
64 | } | 64 | } |
65 | EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); | 65 | EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); |
66 | 66 | ||
67 | /** | ||
68 | * __pcibios_remove_pci_devices - remove all devices under this bus | ||
69 | * @bus: the indicated PCI bus | ||
70 | * @purge_pe: destroy the PE on removal of PCI devices | ||
71 | * | ||
72 | * Remove all of the PCI devices under this bus both from the | ||
73 | * linux pci device tree, and from the powerpc EEH address cache. | ||
74 | * By default, the corresponding PE will be destroied during the | ||
75 | * normal PCI hotplug path. For PCI hotplug during EEH recovery, | ||
76 | * the corresponding PE won't be destroied and deallocated. | ||
77 | */ | ||
78 | void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe) | ||
79 | { | ||
80 | struct pci_dev *dev, *tmp; | ||
81 | struct pci_bus *child_bus; | ||
82 | |||
83 | /* First go down child busses */ | ||
84 | list_for_each_entry(child_bus, &bus->children, node) | ||
85 | __pcibios_remove_pci_devices(child_bus, purge_pe); | ||
86 | |||
87 | pr_debug("PCI: Removing devices on bus %04x:%02x\n", | ||
88 | pci_domain_nr(bus), bus->number); | ||
89 | list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { | ||
90 | pr_debug(" * Removing %s...\n", pci_name(dev)); | ||
91 | eeh_remove_bus_device(dev, purge_pe); | ||
92 | pci_stop_and_remove_bus_device(dev); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * pcibios_remove_pci_devices - remove all devices under this bus | ||
98 | * | ||
99 | * Remove all of the PCI devices under this bus both from the | ||
100 | * linux pci device tree, and from the powerpc EEH address cache. | ||
101 | */ | ||
102 | void pcibios_remove_pci_devices(struct pci_bus *bus) | ||
103 | { | ||
104 | __pcibios_remove_pci_devices(bus, 1); | ||
105 | } | ||
106 | EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); | ||
107 | |||
108 | /** | ||
109 | * pcibios_add_pci_devices - adds new pci devices to bus | ||
110 | * | ||
111 | * This routine will find and fixup new pci devices under | ||
112 | * the indicated bus. This routine presumes that there | ||
113 | * might already be some devices under this bridge, so | ||
114 | * it carefully tries to add only new devices. (And that | ||
115 | * is how this routine differs from other, similar pcibios | ||
116 | * routines.) | ||
117 | */ | ||
118 | void pcibios_add_pci_devices(struct pci_bus * bus) | ||
119 | { | ||
120 | int slotno, num, mode, pass, max; | ||
121 | struct pci_dev *dev; | ||
122 | struct device_node *dn = pci_bus_to_OF_node(bus); | ||
123 | |||
124 | eeh_add_device_tree_early(dn); | ||
125 | |||
126 | mode = PCI_PROBE_NORMAL; | ||
127 | if (ppc_md.pci_probe_mode) | ||
128 | mode = ppc_md.pci_probe_mode(bus); | ||
129 | |||
130 | if (mode == PCI_PROBE_DEVTREE) { | ||
131 | /* use ofdt-based probe */ | ||
132 | of_rescan_bus(dn, bus); | ||
133 | } else if (mode == PCI_PROBE_NORMAL) { | ||
134 | /* use legacy probe */ | ||
135 | slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); | ||
136 | num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); | ||
137 | if (!num) | ||
138 | return; | ||
139 | pcibios_setup_bus_devices(bus); | ||
140 | max = bus->busn_res.start; | ||
141 | for (pass=0; pass < 2; pass++) | ||
142 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
143 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | ||
144 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | ||
145 | max = pci_scan_bridge(bus, dev, max, pass); | ||
146 | } | ||
147 | } | ||
148 | pcibios_finish_adding_to_bus(bus); | ||
149 | } | ||
150 | EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); | ||
151 | |||
152 | struct pci_controller *init_phb_dynamic(struct device_node *dn) | 67 | struct pci_controller *init_phb_dynamic(struct device_node *dn) |
153 | { | 68 | { |
154 | struct pci_controller *phb; | 69 | struct pci_controller *phb; |