aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/44x/Kconfig1
-rw-r--r--arch/powerpc/platforms/44x/ppc476.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c9
-rw-r--r--arch/powerpc/platforms/52xx/efika.c3
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c8
-rw-r--r--arch/powerpc/platforms/85xx/corenet_generic.c2
-rw-r--r--arch/powerpc/platforms/85xx/sgy_cts1000.c4
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig4
-rw-r--r--arch/powerpc/platforms/cell/beat_htab.c4
-rw-r--r--arch/powerpc/platforms/cell/celleb_pci.c6
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_epci.c1
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_pciex.c1
-rw-r--r--arch/powerpc/platforms/cell/celleb_setup.c4
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c6
-rw-r--r--arch/powerpc/platforms/cell/qpace_setup.c2
-rw-r--r--arch/powerpc/platforms/cell/setup.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c5
-rw-r--r--arch/powerpc/platforms/cell/spufs/fault.c2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/gamecube.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/linkstation.c4
-rw-r--r--arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c6
-rw-r--r--arch/powerpc/platforms/embedded6xx/wii.c3
-rw-r--r--arch/powerpc/platforms/maple/pci.c1
-rw-r--r--arch/powerpc/platforms/maple/setup.c4
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c6
-rw-r--r--arch/powerpc/platforms/powermac/pci.c1
-rw-r--r--arch/powerpc/platforms/powermac/setup.c3
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c16
-rw-r--r--arch/powerpc/platforms/powernv/opal-async.c3
-rw-r--r--arch/powerpc/platforms/powernv/opal-rtc.c65
-rw-r--r--arch/powerpc/platforms/powernv/opal-tracepoints.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S6
-rw-r--r--arch/powerpc/platforms/powernv/opal.c21
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c217
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c44
-rw-r--r--arch/powerpc/platforms/powernv/pci.c1
-rw-r--r--arch/powerpc/platforms/powernv/pci.h2
-rw-r--r--arch/powerpc/platforms/powernv/setup.c6
-rw-r--r--arch/powerpc/platforms/powernv/smp.c23
-rw-r--r--arch/powerpc/platforms/ps3/htab.c2
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c2
-rw-r--r--arch/powerpc/platforms/ps3/setup.c9
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c21
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S4
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c4
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c11
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c10
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/ras.c4
-rw-r--r--arch/powerpc/platforms/pseries/setup.c65
53 files changed, 367 insertions, 279 deletions
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 82f2da28cd27..d2ac1c116454 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -220,7 +220,6 @@ config AKEBONO
220 select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD 220 select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
221 select MMC_SDHCI 221 select MMC_SDHCI
222 select MMC_SDHCI_PLTFM 222 select MMC_SDHCI_PLTFM
223 select MMC_SDHCI_OF_476GTR
224 select ATA 223 select ATA
225 select SATA_AHCI_PLATFORM 224 select SATA_AHCI_PLATFORM
226 help 225 help
diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c
index 58db9d083969..c11ce6516c8f 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -94,7 +94,7 @@ static int avr_probe(struct i2c_client *client,
94{ 94{
95 avr_i2c_client = client; 95 avr_i2c_client = client;
96 ppc_md.restart = avr_reset_system; 96 ppc_md.restart = avr_reset_system;
97 ppc_md.power_off = avr_power_off_system; 97 pm_power_off = avr_power_off_system;
98 return 0; 98 return 0;
99} 99}
100 100
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index e996e007bc44..711f3d352af7 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -18,7 +18,7 @@
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/fsl-diu-fb.h> 20#include <linux/fsl-diu-fb.h>
21#include <linux/bootmem.h> 21#include <linux/memblock.h>
22#include <sysdev/fsl_soc.h> 22#include <sysdev/fsl_soc.h>
23 23
24#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
@@ -297,14 +297,13 @@ static void __init mpc512x_setup_diu(void)
297 * and so negatively affect boot time. Instead we reserve the 297 * and so negatively affect boot time. Instead we reserve the
298 * already configured frame buffer area so that it won't be 298 * already configured frame buffer area so that it won't be
299 * destroyed. The starting address of the area to reserve and 299 * destroyed. The starting address of the area to reserve and
300 * also it's length is passed to reserve_bootmem(). It will be 300 * also it's length is passed to memblock_reserve(). It will be
301 * freed later on first open of fbdev, when splash image is not 301 * freed later on first open of fbdev, when splash image is not
302 * needed any more. 302 * needed any more.
303 */ 303 */
304 if (diu_shared_fb.in_use) { 304 if (diu_shared_fb.in_use) {
305 ret = reserve_bootmem(diu_shared_fb.fb_phys, 305 ret = memblock_reserve(diu_shared_fb.fb_phys,
306 diu_shared_fb.fb_len, 306 diu_shared_fb.fb_len);
307 BOOTMEM_EXCLUSIVE);
308 if (ret) { 307 if (ret) {
309 pr_err("%s: reserve bootmem failed\n", __func__); 308 pr_err("%s: reserve bootmem failed\n", __func__);
310 diu_shared_fb.in_use = false; 309 diu_shared_fb.in_use = false;
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 3feffde9128d..6af651e69129 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -212,6 +212,8 @@ static int __init efika_probe(void)
212 DMA_MODE_READ = 0x44; 212 DMA_MODE_READ = 0x44;
213 DMA_MODE_WRITE = 0x48; 213 DMA_MODE_WRITE = 0x48;
214 214
215 pm_power_off = rtas_power_off;
216
215 return 1; 217 return 1;
216} 218}
217 219
@@ -225,7 +227,6 @@ define_machine(efika)
225 .init_IRQ = mpc52xx_init_irq, 227 .init_IRQ = mpc52xx_init_irq,
226 .get_irq = mpc52xx_get_irq, 228 .get_irq = mpc52xx_get_irq,
227 .restart = rtas_restart, 229 .restart = rtas_restart,
228 .power_off = rtas_power_off,
229 .halt = rtas_halt, 230 .halt = rtas_halt,
230 .set_rtc_time = rtas_set_rtc_time, 231 .set_rtc_time = rtas_set_rtc_time,
231 .get_rtc_time = rtas_get_rtc_time, 232 .get_rtc_time = rtas_get_rtc_time,
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index 463fa91ee5b6..15e8021ddef9 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -167,10 +167,10 @@ static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)
167 if (ret) 167 if (ret)
168 goto err; 168 goto err;
169 169
170 /* XXX: this is potentially racy, but there is no lock for ppc_md */ 170 /* XXX: this is potentially racy, but there is no lock for pm_power_off */
171 if (!ppc_md.power_off) { 171 if (!pm_power_off) {
172 glob_mcu = mcu; 172 glob_mcu = mcu;
173 ppc_md.power_off = mcu_power_off; 173 pm_power_off = mcu_power_off;
174 dev_info(&client->dev, "will provide power-off service\n"); 174 dev_info(&client->dev, "will provide power-off service\n");
175 } 175 }
176 176
@@ -197,7 +197,7 @@ static int mcu_remove(struct i2c_client *client)
197 device_remove_file(&client->dev, &dev_attr_status); 197 device_remove_file(&client->dev, &dev_attr_status);
198 198
199 if (glob_mcu == mcu) { 199 if (glob_mcu == mcu) {
200 ppc_md.power_off = NULL; 200 pm_power_off = NULL;
201 glob_mcu = NULL; 201 glob_mcu = NULL;
202 } 202 }
203 203
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index e56b89a792ed..1f309ccb096e 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -170,7 +170,7 @@ static int __init corenet_generic_probe(void)
170 170
171 ppc_md.get_irq = ehv_pic_get_irq; 171 ppc_md.get_irq = ehv_pic_get_irq;
172 ppc_md.restart = fsl_hv_restart; 172 ppc_md.restart = fsl_hv_restart;
173 ppc_md.power_off = fsl_hv_halt; 173 pm_power_off = fsl_hv_halt;
174 ppc_md.halt = fsl_hv_halt; 174 ppc_md.halt = fsl_hv_halt;
175#ifdef CONFIG_SMP 175#ifdef CONFIG_SMP
176 /* 176 /*
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index 8162b0412117..e149c9ec26ae 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -120,7 +120,7 @@ static int gpio_halt_probe(struct platform_device *pdev)
120 120
121 /* Register our halt function */ 121 /* Register our halt function */
122 ppc_md.halt = gpio_halt_cb; 122 ppc_md.halt = gpio_halt_cb;
123 ppc_md.power_off = gpio_halt_cb; 123 pm_power_off = gpio_halt_cb;
124 124
125 printk(KERN_INFO "gpio-halt: registered GPIO %d (%d trigger, %d" 125 printk(KERN_INFO "gpio-halt: registered GPIO %d (%d trigger, %d"
126 " irq).\n", gpio, trigger, irq); 126 " irq).\n", gpio, trigger, irq);
@@ -137,7 +137,7 @@ static int gpio_halt_remove(struct platform_device *pdev)
137 free_irq(irq, halt_node); 137 free_irq(irq, halt_node);
138 138
139 ppc_md.halt = NULL; 139 ppc_md.halt = NULL;
140 ppc_md.power_off = NULL; 140 pm_power_off = NULL;
141 141
142 gpio_free(gpio); 142 gpio_free(gpio);
143 143
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index bd6f1a1cf922..157250426b56 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -1,6 +1,3 @@
1config FADS
2 bool
3
4config CPM1 1config CPM1
5 bool 2 bool
6 select CPM 3 select CPM
@@ -13,7 +10,6 @@ choice
13 10
14config MPC8XXFADS 11config MPC8XXFADS
15 bool "FADS" 12 bool "FADS"
16 select FADS
17 13
18config MPC86XADS 14config MPC86XADS
19 bool "MPC86XADS" 15 bool "MPC86XADS"
diff --git a/arch/powerpc/platforms/cell/beat_htab.c b/arch/powerpc/platforms/cell/beat_htab.c
index d4d245c0d787..bee9232fe619 100644
--- a/arch/powerpc/platforms/cell/beat_htab.c
+++ b/arch/powerpc/platforms/cell/beat_htab.c
@@ -186,7 +186,7 @@ static long beat_lpar_hpte_updatepp(unsigned long slot,
186 unsigned long newpp, 186 unsigned long newpp,
187 unsigned long vpn, 187 unsigned long vpn,
188 int psize, int apsize, 188 int psize, int apsize,
189 int ssize, int local) 189 int ssize, unsigned long flags)
190{ 190{
191 unsigned long lpar_rc; 191 unsigned long lpar_rc;
192 u64 dummy0, dummy1; 192 u64 dummy0, dummy1;
@@ -369,7 +369,7 @@ static long beat_lpar_hpte_updatepp_v3(unsigned long slot,
369 unsigned long newpp, 369 unsigned long newpp,
370 unsigned long vpn, 370 unsigned long vpn,
371 int psize, int apsize, 371 int psize, int apsize,
372 int ssize, int local) 372 int ssize, unsigned long flags)
373{ 373{
374 unsigned long lpar_rc; 374 unsigned long lpar_rc;
375 unsigned long want_v; 375 unsigned long want_v;
diff --git a/arch/powerpc/platforms/cell/celleb_pci.c b/arch/powerpc/platforms/cell/celleb_pci.c
index 2b98a36ef8fb..3ce70ded2d6a 100644
--- a/arch/powerpc/platforms/cell/celleb_pci.c
+++ b/arch/powerpc/platforms/cell/celleb_pci.c
@@ -29,7 +29,7 @@
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/bootmem.h> 32#include <linux/memblock.h>
33#include <linux/pci_regs.h> 33#include <linux/pci_regs.h>
34#include <linux/of.h> 34#include <linux/of.h>
35#include <linux/of_device.h> 35#include <linux/of_device.h>
@@ -401,11 +401,11 @@ error:
401 } else { 401 } else {
402 if (config && *config) { 402 if (config && *config) {
403 size = 256; 403 size = 256;
404 free_bootmem(__pa(*config), size); 404 memblock_free(__pa(*config), size);
405 } 405 }
406 if (res && *res) { 406 if (res && *res) {
407 size = sizeof(struct celleb_pci_resource); 407 size = sizeof(struct celleb_pci_resource);
408 free_bootmem(__pa(*res), size); 408 memblock_free(__pa(*res), size);
409 } 409 }
410 } 410 }
411 411
diff --git a/arch/powerpc/platforms/cell/celleb_scc_epci.c b/arch/powerpc/platforms/cell/celleb_scc_epci.c
index 844c0facb4f7..9438bbed402f 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_epci.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_epci.c
@@ -25,7 +25,6 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/pci_regs.h> 27#include <linux/pci_regs.h>
28#include <linux/bootmem.h>
29 28
30#include <asm/io.h> 29#include <asm/io.h>
31#include <asm/irq.h> 30#include <asm/irq.h>
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
index 4278acfa2ede..f22387598040 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
@@ -25,7 +25,6 @@
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/bootmem.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
31 30
diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
index 34e8ce2976aa..90be8ec51686 100644
--- a/arch/powerpc/platforms/cell/celleb_setup.c
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -142,6 +142,7 @@ static int __init celleb_probe_beat(void)
142 powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS 142 powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS
143 | FW_FEATURE_BEAT | FW_FEATURE_LPAR; 143 | FW_FEATURE_BEAT | FW_FEATURE_LPAR;
144 hpte_init_beat_v3(); 144 hpte_init_beat_v3();
145 pm_power_off = beat_power_off;
145 146
146 return 1; 147 return 1;
147} 148}
@@ -190,6 +191,7 @@ static int __init celleb_probe_native(void)
190 191
191 powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS; 192 powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS;
192 hpte_init_native(); 193 hpte_init_native();
194 pm_power_off = rtas_power_off;
193 195
194 return 1; 196 return 1;
195} 197}
@@ -204,7 +206,6 @@ define_machine(celleb_beat) {
204 .setup_arch = celleb_setup_arch_beat, 206 .setup_arch = celleb_setup_arch_beat,
205 .show_cpuinfo = celleb_show_cpuinfo, 207 .show_cpuinfo = celleb_show_cpuinfo,
206 .restart = beat_restart, 208 .restart = beat_restart,
207 .power_off = beat_power_off,
208 .halt = beat_halt, 209 .halt = beat_halt,
209 .get_rtc_time = beat_get_rtc_time, 210 .get_rtc_time = beat_get_rtc_time,
210 .set_rtc_time = beat_set_rtc_time, 211 .set_rtc_time = beat_set_rtc_time,
@@ -230,7 +231,6 @@ define_machine(celleb_native) {
230 .setup_arch = celleb_setup_arch_native, 231 .setup_arch = celleb_setup_arch_native,
231 .show_cpuinfo = celleb_show_cpuinfo, 232 .show_cpuinfo = celleb_show_cpuinfo,
232 .restart = rtas_restart, 233 .restart = rtas_restart,
233 .power_off = rtas_power_off,
234 .halt = rtas_halt, 234 .halt = rtas_halt,
235 .get_boot_time = rtas_get_boot_time, 235 .get_boot_time = rtas_get_boot_time,
236 .get_rtc_time = rtas_get_rtc_time, 236 .get_rtc_time = rtas_get_rtc_time,
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 8a106b4172e0..4c11421847be 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -82,7 +82,7 @@ static void iic_unmask(struct irq_data *d)
82 82
83static void iic_eoi(struct irq_data *d) 83static void iic_eoi(struct irq_data *d)
84{ 84{
85 struct iic *iic = &__get_cpu_var(cpu_iic); 85 struct iic *iic = this_cpu_ptr(&cpu_iic);
86 out_be64(&iic->regs->prio, iic->eoi_stack[--iic->eoi_ptr]); 86 out_be64(&iic->regs->prio, iic->eoi_stack[--iic->eoi_ptr]);
87 BUG_ON(iic->eoi_ptr < 0); 87 BUG_ON(iic->eoi_ptr < 0);
88} 88}
@@ -148,7 +148,7 @@ static unsigned int iic_get_irq(void)
148 struct iic *iic; 148 struct iic *iic;
149 unsigned int virq; 149 unsigned int virq;
150 150
151 iic = &__get_cpu_var(cpu_iic); 151 iic = this_cpu_ptr(&cpu_iic);
152 *(unsigned long *) &pending = 152 *(unsigned long *) &pending =
153 in_be64((u64 __iomem *) &iic->regs->pending_destr); 153 in_be64((u64 __iomem *) &iic->regs->pending_destr);
154 if (!(pending.flags & CBE_IIC_IRQ_VALID)) 154 if (!(pending.flags & CBE_IIC_IRQ_VALID))
@@ -163,7 +163,7 @@ static unsigned int iic_get_irq(void)
163 163
164void iic_setup_cpu(void) 164void iic_setup_cpu(void)
165{ 165{
166 out_be64(&__get_cpu_var(cpu_iic).regs->prio, 0xff); 166 out_be64(this_cpu_ptr(&cpu_iic.regs->prio), 0xff);
167} 167}
168 168
169u8 iic_get_target_id(int cpu) 169u8 iic_get_target_id(int cpu)
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c
index 6e3409d590ac..d328140dc6f5 100644
--- a/arch/powerpc/platforms/cell/qpace_setup.c
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -127,6 +127,7 @@ static int __init qpace_probe(void)
127 return 0; 127 return 0;
128 128
129 hpte_init_native(); 129 hpte_init_native();
130 pm_power_off = rtas_power_off;
130 131
131 return 1; 132 return 1;
132} 133}
@@ -137,7 +138,6 @@ define_machine(qpace) {
137 .setup_arch = qpace_setup_arch, 138 .setup_arch = qpace_setup_arch,
138 .show_cpuinfo = qpace_show_cpuinfo, 139 .show_cpuinfo = qpace_show_cpuinfo,
139 .restart = rtas_restart, 140 .restart = rtas_restart,
140 .power_off = rtas_power_off,
141 .halt = rtas_halt, 141 .halt = rtas_halt,
142 .get_boot_time = rtas_get_boot_time, 142 .get_boot_time = rtas_get_boot_time,
143 .get_rtc_time = rtas_get_rtc_time, 143 .get_rtc_time = rtas_get_rtc_time,
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 6ae25fb62015..d62aa982d530 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -259,6 +259,7 @@ static int __init cell_probe(void)
259 return 0; 259 return 0;
260 260
261 hpte_init_native(); 261 hpte_init_native();
262 pm_power_off = rtas_power_off;
262 263
263 return 1; 264 return 1;
264} 265}
@@ -269,7 +270,6 @@ define_machine(cell) {
269 .setup_arch = cell_setup_arch, 270 .setup_arch = cell_setup_arch,
270 .show_cpuinfo = cell_show_cpuinfo, 271 .show_cpuinfo = cell_show_cpuinfo,
271 .restart = rtas_restart, 272 .restart = rtas_restart,
272 .power_off = rtas_power_off,
273 .halt = rtas_halt, 273 .halt = rtas_halt,
274 .get_boot_time = rtas_get_boot_time, 274 .get_boot_time = rtas_get_boot_time,
275 .get_rtc_time = rtas_get_rtc_time, 275 .get_rtc_time = rtas_get_rtc_time,
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index ffcbd242e669..f7af74f83693 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -181,7 +181,8 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
181 return 0; 181 return 0;
182} 182}
183 183
184extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX 184extern int hash_page(unsigned long ea, unsigned long access,
185 unsigned long trap, unsigned long dsisr); //XXX
185static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr) 186static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
186{ 187{
187 int ret; 188 int ret;
@@ -196,7 +197,7 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
196 (REGION_ID(ea) != USER_REGION_ID)) { 197 (REGION_ID(ea) != USER_REGION_ID)) {
197 198
198 spin_unlock(&spu->register_lock); 199 spin_unlock(&spu->register_lock);
199 ret = hash_page(ea, _PAGE_PRESENT, 0x300); 200 ret = hash_page(ea, _PAGE_PRESENT, 0x300, dsisr);
200 spin_lock(&spu->register_lock); 201 spin_lock(&spu->register_lock);
201 202
202 if (!ret) { 203 if (!ret) {
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
index e45894a08118..d98f845ac777 100644
--- a/arch/powerpc/platforms/cell/spufs/fault.c
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -144,7 +144,7 @@ int spufs_handle_class1(struct spu_context *ctx)
144 access = (_PAGE_PRESENT | _PAGE_USER); 144 access = (_PAGE_PRESENT | _PAGE_USER);
145 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; 145 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL;
146 local_irq_save(flags); 146 local_irq_save(flags);
147 ret = hash_page(ea, access, 0x300); 147 ret = hash_page(ea, access, 0x300, dsisr);
148 local_irq_restore(flags); 148 local_irq_restore(flags);
149 149
150 /* hashing failed, so try the actual fault handler */ 150 /* hashing failed, so try the actual fault handler */
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 5b77b1919fd2..860a59eb8ea2 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -585,6 +585,8 @@ static int __init chrp_probe(void)
585 DMA_MODE_READ = 0x44; 585 DMA_MODE_READ = 0x44;
586 DMA_MODE_WRITE = 0x48; 586 DMA_MODE_WRITE = 0x48;
587 587
588 pm_power_off = rtas_power_off;
589
588 return 1; 590 return 1;
589} 591}
590 592
@@ -597,7 +599,6 @@ define_machine(chrp) {
597 .show_cpuinfo = chrp_show_cpuinfo, 599 .show_cpuinfo = chrp_show_cpuinfo,
598 .init_IRQ = chrp_init_IRQ, 600 .init_IRQ = chrp_init_IRQ,
599 .restart = rtas_restart, 601 .restart = rtas_restart,
600 .power_off = rtas_power_off,
601 .halt = rtas_halt, 602 .halt = rtas_halt,
602 .time_init = chrp_time_init, 603 .time_init = chrp_time_init,
603 .set_rtc_time = chrp_set_rtc_time, 604 .set_rtc_time = chrp_set_rtc_time,
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c
index bd4ba5d7d568..fe0ed6ee285e 100644
--- a/arch/powerpc/platforms/embedded6xx/gamecube.c
+++ b/arch/powerpc/platforms/embedded6xx/gamecube.c
@@ -67,6 +67,8 @@ static int __init gamecube_probe(void)
67 if (!of_flat_dt_is_compatible(dt_root, "nintendo,gamecube")) 67 if (!of_flat_dt_is_compatible(dt_root, "nintendo,gamecube"))
68 return 0; 68 return 0;
69 69
70 pm_power_off = gamecube_power_off;
71
70 return 1; 72 return 1;
71} 73}
72 74
@@ -80,7 +82,6 @@ define_machine(gamecube) {
80 .probe = gamecube_probe, 82 .probe = gamecube_probe,
81 .init_early = gamecube_init_early, 83 .init_early = gamecube_init_early,
82 .restart = gamecube_restart, 84 .restart = gamecube_restart,
83 .power_off = gamecube_power_off,
84 .halt = gamecube_halt, 85 .halt = gamecube_halt,
85 .init_IRQ = flipper_pic_probe, 86 .init_IRQ = flipper_pic_probe,
86 .get_irq = flipper_pic_get_irq, 87 .get_irq = flipper_pic_get_irq,
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 168e1d80b2e5..540eeb58d3f0 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -147,6 +147,9 @@ static int __init linkstation_probe(void)
147 147
148 if (!of_flat_dt_is_compatible(root, "linkstation")) 148 if (!of_flat_dt_is_compatible(root, "linkstation"))
149 return 0; 149 return 0;
150
151 pm_power_off = linkstation_power_off;
152
150 return 1; 153 return 1;
151} 154}
152 155
@@ -158,7 +161,6 @@ define_machine(linkstation){
158 .show_cpuinfo = linkstation_show_cpuinfo, 161 .show_cpuinfo = linkstation_show_cpuinfo,
159 .get_irq = mpic_get_irq, 162 .get_irq = mpic_get_irq,
160 .restart = linkstation_restart, 163 .restart = linkstation_restart,
161 .power_off = linkstation_power_off,
162 .halt = linkstation_halt, 164 .halt = linkstation_halt,
163 .calibrate_decr = generic_calibrate_decr, 165 .calibrate_decr = generic_calibrate_decr,
164}; 166};
diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
index 20a8ed91962e..7feb325b636b 100644
--- a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
+++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
@@ -247,7 +247,7 @@ void __init ug_udbg_init(void)
247 np = of_find_compatible_node(NULL, NULL, "nintendo,flipper-exi"); 247 np = of_find_compatible_node(NULL, NULL, "nintendo,flipper-exi");
248 if (!np) { 248 if (!np) {
249 udbg_printf("%s: EXI node not found\n", __func__); 249 udbg_printf("%s: EXI node not found\n", __func__);
250 goto done; 250 goto out;
251 } 251 }
252 252
253 exi_io_base = ug_udbg_setup_exi_io_base(np); 253 exi_io_base = ug_udbg_setup_exi_io_base(np);
@@ -267,8 +267,8 @@ void __init ug_udbg_init(void)
267 } 267 }
268 268
269done: 269done:
270 if (np) 270 of_node_put(np);
271 of_node_put(np); 271out:
272 return; 272 return;
273} 273}
274 274
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 388e29bab8f6..352592d3e44e 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -211,6 +211,8 @@ static int __init wii_probe(void)
211 if (!of_flat_dt_is_compatible(dt_root, "nintendo,wii")) 211 if (!of_flat_dt_is_compatible(dt_root, "nintendo,wii"))
212 return 0; 212 return 0;
213 213
214 pm_power_off = wii_power_off;
215
214 return 1; 216 return 1;
215} 217}
216 218
@@ -226,7 +228,6 @@ define_machine(wii) {
226 .init_early = wii_init_early, 228 .init_early = wii_init_early,
227 .setup_arch = wii_setup_arch, 229 .setup_arch = wii_setup_arch,
228 .restart = wii_restart, 230 .restart = wii_restart,
229 .power_off = wii_power_off,
230 .halt = wii_halt, 231 .halt = wii_halt,
231 .init_IRQ = wii_pic_probe, 232 .init_IRQ = wii_pic_probe,
232 .get_irq = flipper_pic_get_irq, 233 .get_irq = flipper_pic_get_irq,
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index f7136aae8bbf..d3a13067ec42 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -15,7 +15,6 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/bootmem.h>
19#include <linux/irq.h> 18#include <linux/irq.h>
20 19
21#include <asm/sections.h> 20#include <asm/sections.h>
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index cb1b0b35a0c6..56b85cd61aaf 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -169,7 +169,7 @@ static void __init maple_use_rtas_reboot_and_halt_if_present(void)
169 if (rtas_service_present("system-reboot") && 169 if (rtas_service_present("system-reboot") &&
170 rtas_service_present("power-off")) { 170 rtas_service_present("power-off")) {
171 ppc_md.restart = rtas_restart; 171 ppc_md.restart = rtas_restart;
172 ppc_md.power_off = rtas_power_off; 172 pm_power_off = rtas_power_off;
173 ppc_md.halt = rtas_halt; 173 ppc_md.halt = rtas_halt;
174 } 174 }
175} 175}
@@ -312,6 +312,7 @@ static int __init maple_probe(void)
312 alloc_dart_table(); 312 alloc_dart_table();
313 313
314 hpte_init_native(); 314 hpte_init_native();
315 pm_power_off = maple_power_off;
315 316
316 return 1; 317 return 1;
317} 318}
@@ -325,7 +326,6 @@ define_machine(maple) {
325 .pci_irq_fixup = maple_pci_irq_fixup, 326 .pci_irq_fixup = maple_pci_irq_fixup,
326 .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, 327 .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
327 .restart = maple_restart, 328 .restart = maple_restart,
328 .power_off = maple_power_off,
329 .halt = maple_halt, 329 .halt = maple_halt,
330 .get_boot_time = maple_get_boot_time, 330 .get_boot_time = maple_get_boot_time,
331 .set_rtc_time = maple_set_rtc_time, 331 .set_rtc_time = maple_set_rtc_time,
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 014d06e6d46b..60b03a1703d1 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -513,11 +513,7 @@ static int __init core99_nvram_setup(struct device_node *dp, unsigned long addr)
513 printk(KERN_ERR "nvram: no address\n"); 513 printk(KERN_ERR "nvram: no address\n");
514 return -EINVAL; 514 return -EINVAL;
515 } 515 }
516 nvram_image = alloc_bootmem(NVRAM_SIZE); 516 nvram_image = memblock_virt_alloc(NVRAM_SIZE, 0);
517 if (nvram_image == NULL) {
518 printk(KERN_ERR "nvram: can't allocate ram image\n");
519 return -ENOMEM;
520 }
521 nvram_data = ioremap(addr, NVRAM_SIZE*2); 517 nvram_data = ioremap(addr, NVRAM_SIZE*2);
522 nvram_naddrs = 1; /* Make sure we get the correct case */ 518 nvram_naddrs = 1; /* Make sure we get the correct case */
523 519
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 7e868ccf3b0d..04702db35d45 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -15,7 +15,6 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/bootmem.h>
19#include <linux/irq.h> 18#include <linux/irq.h>
20#include <linux/of_pci.h> 19#include <linux/of_pci.h>
21 20
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index b127a29ac526..713d36d45d1d 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -632,6 +632,8 @@ static int __init pmac_probe(void)
632 smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL); 632 smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
633#endif /* CONFIG_PMAC_SMU */ 633#endif /* CONFIG_PMAC_SMU */
634 634
635 pm_power_off = pmac_power_off;
636
635 return 1; 637 return 1;
636} 638}
637 639
@@ -663,7 +665,6 @@ define_machine(powermac) {
663 .get_irq = NULL, /* changed later */ 665 .get_irq = NULL, /* changed later */
664 .pci_irq_fixup = pmac_pci_irq_fixup, 666 .pci_irq_fixup = pmac_pci_irq_fixup,
665 .restart = pmac_restart, 667 .restart = pmac_restart,
666 .power_off = pmac_power_off,
667 .halt = pmac_halt, 668 .halt = pmac_halt,
668 .time_init = pmac_time_init, 669 .time_init = pmac_time_init,
669 .get_boot_time = pmac_get_boot_time, 670 .get_boot_time = pmac_get_boot_time,
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index eba9cb10619c..2809c9895288 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -11,7 +11,6 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#include <linux/bootmem.h>
15#include <linux/debugfs.h> 14#include <linux/debugfs.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/io.h> 16#include <linux/io.h>
@@ -354,6 +353,9 @@ static int ioda_eeh_get_phb_state(struct eeh_pe *pe)
354 } else if (!(pe->state & EEH_PE_ISOLATED)) { 353 } else if (!(pe->state & EEH_PE_ISOLATED)) {
355 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 354 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
356 ioda_eeh_phb_diag(pe); 355 ioda_eeh_phb_diag(pe);
356
357 if (eeh_has_flag(EEH_EARLY_DUMP_LOG))
358 pnv_pci_dump_phb_diag_data(pe->phb, pe->data);
357 } 359 }
358 360
359 return result; 361 return result;
@@ -373,7 +375,7 @@ static int ioda_eeh_get_pe_state(struct eeh_pe *pe)
373 * moving forward, we have to return operational 375 * moving forward, we have to return operational
374 * state during PE reset. 376 * state during PE reset.
375 */ 377 */
376 if (pe->state & EEH_PE_CFG_BLOCKED) { 378 if (pe->state & EEH_PE_RESET) {
377 result = (EEH_STATE_MMIO_ACTIVE | 379 result = (EEH_STATE_MMIO_ACTIVE |
378 EEH_STATE_DMA_ACTIVE | 380 EEH_STATE_DMA_ACTIVE |
379 EEH_STATE_MMIO_ENABLED | 381 EEH_STATE_MMIO_ENABLED |
@@ -452,6 +454,9 @@ static int ioda_eeh_get_pe_state(struct eeh_pe *pe)
452 454
453 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 455 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
454 ioda_eeh_phb_diag(pe); 456 ioda_eeh_phb_diag(pe);
457
458 if (eeh_has_flag(EEH_EARLY_DUMP_LOG))
459 pnv_pci_dump_phb_diag_data(pe->phb, pe->data);
455 } 460 }
456 461
457 return result; 462 return result;
@@ -731,7 +736,8 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
731static int ioda_eeh_get_log(struct eeh_pe *pe, int severity, 736static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
732 char *drv_log, unsigned long len) 737 char *drv_log, unsigned long len)
733{ 738{
734 pnv_pci_dump_phb_diag_data(pe->phb, pe->data); 739 if (!eeh_has_flag(EEH_EARLY_DUMP_LOG))
740 pnv_pci_dump_phb_diag_data(pe->phb, pe->data);
735 741
736 return 0; 742 return 0;
737} 743}
@@ -1087,6 +1093,10 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
1087 !((*pe)->state & EEH_PE_ISOLATED)) { 1093 !((*pe)->state & EEH_PE_ISOLATED)) {
1088 eeh_pe_state_mark(*pe, EEH_PE_ISOLATED); 1094 eeh_pe_state_mark(*pe, EEH_PE_ISOLATED);
1089 ioda_eeh_phb_diag(*pe); 1095 ioda_eeh_phb_diag(*pe);
1096
1097 if (eeh_has_flag(EEH_EARLY_DUMP_LOG))
1098 pnv_pci_dump_phb_diag_data((*pe)->phb,
1099 (*pe)->data);
1090 } 1100 }
1091 1101
1092 /* 1102 /*
diff --git a/arch/powerpc/platforms/powernv/opal-async.c b/arch/powerpc/platforms/powernv/opal-async.c
index e462ab947d16..693b6cdac691 100644
--- a/arch/powerpc/platforms/powernv/opal-async.c
+++ b/arch/powerpc/platforms/powernv/opal-async.c
@@ -71,6 +71,7 @@ int opal_async_get_token_interruptible(void)
71 71
72 return token; 72 return token;
73} 73}
74EXPORT_SYMBOL_GPL(opal_async_get_token_interruptible);
74 75
75int __opal_async_release_token(int token) 76int __opal_async_release_token(int token)
76{ 77{
@@ -102,6 +103,7 @@ int opal_async_release_token(int token)
102 103
103 return 0; 104 return 0;
104} 105}
106EXPORT_SYMBOL_GPL(opal_async_release_token);
105 107
106int opal_async_wait_response(uint64_t token, struct opal_msg *msg) 108int opal_async_wait_response(uint64_t token, struct opal_msg *msg)
107{ 109{
@@ -120,6 +122,7 @@ int opal_async_wait_response(uint64_t token, struct opal_msg *msg)
120 122
121 return 0; 123 return 0;
122} 124}
125EXPORT_SYMBOL_GPL(opal_async_wait_response);
123 126
124static int opal_async_comp_event(struct notifier_block *nb, 127static int opal_async_comp_event(struct notifier_block *nb,
125 unsigned long msg_type, void *msg) 128 unsigned long msg_type, void *msg)
diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c
index 499707ddaa9c..37dbee15769f 100644
--- a/arch/powerpc/platforms/powernv/opal-rtc.c
+++ b/arch/powerpc/platforms/powernv/opal-rtc.c
@@ -15,6 +15,8 @@
15#include <linux/bcd.h> 15#include <linux/bcd.h>
16#include <linux/rtc.h> 16#include <linux/rtc.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/platform_device.h>
19#include <linux/of_platform.h>
18 20
19#include <asm/opal.h> 21#include <asm/opal.h>
20#include <asm/firmware.h> 22#include <asm/firmware.h>
@@ -43,7 +45,7 @@ unsigned long __init opal_get_boot_time(void)
43 long rc = OPAL_BUSY; 45 long rc = OPAL_BUSY;
44 46
45 if (!opal_check_token(OPAL_RTC_READ)) 47 if (!opal_check_token(OPAL_RTC_READ))
46 goto out; 48 return 0;
47 49
48 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 50 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
49 rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); 51 rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms);
@@ -53,62 +55,33 @@ unsigned long __init opal_get_boot_time(void)
53 mdelay(10); 55 mdelay(10);
54 } 56 }
55 if (rc != OPAL_SUCCESS) 57 if (rc != OPAL_SUCCESS)
56 goto out; 58 return 0;
57 59
58 y_m_d = be32_to_cpu(__y_m_d); 60 y_m_d = be32_to_cpu(__y_m_d);
59 h_m_s_ms = be64_to_cpu(__h_m_s_ms); 61 h_m_s_ms = be64_to_cpu(__h_m_s_ms);
60 opal_to_tm(y_m_d, h_m_s_ms, &tm); 62 opal_to_tm(y_m_d, h_m_s_ms, &tm);
61 return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 63 return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
62 tm.tm_hour, tm.tm_min, tm.tm_sec); 64 tm.tm_hour, tm.tm_min, tm.tm_sec);
63out:
64 ppc_md.get_rtc_time = NULL;
65 ppc_md.set_rtc_time = NULL;
66 return 0;
67} 65}
68 66
69void opal_get_rtc_time(struct rtc_time *tm) 67static __init int opal_time_init(void)
70{ 68{
71 long rc = OPAL_BUSY; 69 struct platform_device *pdev;
72 u32 y_m_d; 70 struct device_node *rtc;
73 u64 h_m_s_ms;
74 __be32 __y_m_d;
75 __be64 __h_m_s_ms;
76 71
77 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 72 rtc = of_find_node_by_path("/ibm,opal/rtc");
78 rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); 73 if (rtc) {
79 if (rc == OPAL_BUSY_EVENT) 74 pdev = of_platform_device_create(rtc, "opal-rtc", NULL);
80 opal_poll_events(NULL); 75 of_node_put(rtc);
76 } else {
77 if (opal_check_token(OPAL_RTC_READ) ||
78 opal_check_token(OPAL_READ_TPO))
79 pdev = platform_device_register_simple("opal-rtc", -1,
80 NULL, 0);
81 else 81 else
82 mdelay(10); 82 return -ENODEV;
83 } 83 }
84 if (rc != OPAL_SUCCESS)
85 return;
86 y_m_d = be32_to_cpu(__y_m_d);
87 h_m_s_ms = be64_to_cpu(__h_m_s_ms);
88 opal_to_tm(y_m_d, h_m_s_ms, tm);
89}
90
91int opal_set_rtc_time(struct rtc_time *tm)
92{
93 long rc = OPAL_BUSY;
94 u32 y_m_d = 0;
95 u64 h_m_s_ms = 0;
96
97 y_m_d |= ((u32)bin2bcd((tm->tm_year + 1900) / 100)) << 24;
98 y_m_d |= ((u32)bin2bcd((tm->tm_year + 1900) % 100)) << 16;
99 y_m_d |= ((u32)bin2bcd((tm->tm_mon + 1))) << 8;
100 y_m_d |= ((u32)bin2bcd(tm->tm_mday));
101
102 h_m_s_ms |= ((u64)bin2bcd(tm->tm_hour)) << 56;
103 h_m_s_ms |= ((u64)bin2bcd(tm->tm_min)) << 48;
104 h_m_s_ms |= ((u64)bin2bcd(tm->tm_sec)) << 40;
105 84
106 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 85 return PTR_ERR_OR_ZERO(pdev);
107 rc = opal_rtc_write(y_m_d, h_m_s_ms);
108 if (rc == OPAL_BUSY_EVENT)
109 opal_poll_events(NULL);
110 else
111 mdelay(10);
112 }
113 return rc == OPAL_SUCCESS ? 0 : -EIO;
114} 86}
87machine_subsys_initcall(powernv, opal_time_init);
diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
index ae14c40b4b1c..e11273b2386d 100644
--- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
+++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
@@ -48,7 +48,7 @@ void __trace_opal_entry(unsigned long opcode, unsigned long *args)
48 48
49 local_irq_save(flags); 49 local_irq_save(flags);
50 50
51 depth = &__get_cpu_var(opal_trace_depth); 51 depth = this_cpu_ptr(&opal_trace_depth);
52 52
53 if (*depth) 53 if (*depth)
54 goto out; 54 goto out;
@@ -69,7 +69,7 @@ void __trace_opal_exit(long opcode, unsigned long retval)
69 69
70 local_irq_save(flags); 70 local_irq_save(flags);
71 71
72 depth = &__get_cpu_var(opal_trace_depth); 72 depth = this_cpu_ptr(&opal_trace_depth);
73 73
74 if (*depth) 74 if (*depth)
75 goto out; 75 goto out;
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index feb549aa3eea..0a299be588af 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -18,7 +18,7 @@
18 .section ".text" 18 .section ".text"
19 19
20#ifdef CONFIG_TRACEPOINTS 20#ifdef CONFIG_TRACEPOINTS
21#ifdef CONFIG_JUMP_LABEL 21#ifdef HAVE_JUMP_LABEL
22#define OPAL_BRANCH(LABEL) \ 22#define OPAL_BRANCH(LABEL) \
23 ARCH_STATIC_BRANCH(LABEL, opal_tracepoint_key) 23 ARCH_STATIC_BRANCH(LABEL, opal_tracepoint_key)
24#else 24#else
@@ -250,3 +250,7 @@ OPAL_CALL(opal_handle_hmi, OPAL_HANDLE_HMI);
250OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION); 250OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION);
251OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION); 251OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION);
252OPAL_CALL(opal_pci_set_phb_cxl_mode, OPAL_PCI_SET_PHB_CXL_MODE); 252OPAL_CALL(opal_pci_set_phb_cxl_mode, OPAL_PCI_SET_PHB_CXL_MODE);
253OPAL_CALL(opal_tpo_write, OPAL_WRITE_TPO);
254OPAL_CALL(opal_tpo_read, OPAL_READ_TPO);
255OPAL_CALL(opal_ipmi_send, OPAL_IPMI_SEND);
256OPAL_CALL(opal_ipmi_recv, OPAL_IPMI_RECV);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index d019b081df9d..cb0b6de79cd4 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -50,7 +50,6 @@ static int mc_recoverable_range_len;
50 50
51struct device_node *opal_node; 51struct device_node *opal_node;
52static DEFINE_SPINLOCK(opal_write_lock); 52static DEFINE_SPINLOCK(opal_write_lock);
53extern u64 opal_mc_secondary_handler[];
54static unsigned int *opal_irqs; 53static unsigned int *opal_irqs;
55static unsigned int opal_irq_count; 54static unsigned int opal_irq_count;
56static ATOMIC_NOTIFIER_HEAD(opal_notifier_head); 55static ATOMIC_NOTIFIER_HEAD(opal_notifier_head);
@@ -644,6 +643,16 @@ static void __init opal_dump_region_init(void)
644 pr_warn("DUMP: Failed to register kernel log buffer. " 643 pr_warn("DUMP: Failed to register kernel log buffer. "
645 "rc = %d\n", rc); 644 "rc = %d\n", rc);
646} 645}
646
647static void opal_ipmi_init(struct device_node *opal_node)
648{
649 struct device_node *np;
650
651 for_each_child_of_node(opal_node, np)
652 if (of_device_is_compatible(np, "ibm,opal-ipmi"))
653 of_platform_device_create(np, NULL, NULL);
654}
655
647static int __init opal_init(void) 656static int __init opal_init(void)
648{ 657{
649 struct device_node *np, *consoles; 658 struct device_node *np, *consoles;
@@ -707,6 +716,8 @@ static int __init opal_init(void)
707 opal_msglog_init(); 716 opal_msglog_init();
708 } 717 }
709 718
719 opal_ipmi_init(opal_node);
720
710 return 0; 721 return 0;
711} 722}
712machine_subsys_initcall(powernv, opal_init); 723machine_subsys_initcall(powernv, opal_init);
@@ -742,6 +753,8 @@ void opal_shutdown(void)
742 753
743/* Export this so that test modules can use it */ 754/* Export this so that test modules can use it */
744EXPORT_SYMBOL_GPL(opal_invalid_call); 755EXPORT_SYMBOL_GPL(opal_invalid_call);
756EXPORT_SYMBOL_GPL(opal_ipmi_send);
757EXPORT_SYMBOL_GPL(opal_ipmi_recv);
745 758
746/* Convert a region of vmalloc memory to an opal sg list */ 759/* Convert a region of vmalloc memory to an opal sg list */
747struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr, 760struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
@@ -805,3 +818,9 @@ void opal_free_sg_list(struct opal_sg_list *sg)
805 sg = NULL; 818 sg = NULL;
806 } 819 }
807} 820}
821
822EXPORT_SYMBOL_GPL(opal_poll_events);
823EXPORT_SYMBOL_GPL(opal_rtc_read);
824EXPORT_SYMBOL_GPL(opal_rtc_write);
825EXPORT_SYMBOL_GPL(opal_tpo_read);
826EXPORT_SYMBOL_GPL(opal_tpo_write);
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 3ba435ec3dcd..fac88ed8a915 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -91,6 +91,24 @@ static inline bool pnv_pci_is_mem_pref_64(unsigned long flags)
91 (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH)); 91 (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH));
92} 92}
93 93
94static void pnv_ioda_reserve_pe(struct pnv_phb *phb, int pe_no)
95{
96 if (!(pe_no >= 0 && pe_no < phb->ioda.total_pe)) {
97 pr_warn("%s: Invalid PE %d on PHB#%x\n",
98 __func__, pe_no, phb->hose->global_number);
99 return;
100 }
101
102 if (test_and_set_bit(pe_no, phb->ioda.pe_alloc)) {
103 pr_warn("%s: PE %d was assigned on PHB#%x\n",
104 __func__, pe_no, phb->hose->global_number);
105 return;
106 }
107
108 phb->ioda.pe_array[pe_no].phb = phb;
109 phb->ioda.pe_array[pe_no].pe_number = pe_no;
110}
111
94static int pnv_ioda_alloc_pe(struct pnv_phb *phb) 112static int pnv_ioda_alloc_pe(struct pnv_phb *phb)
95{ 113{
96 unsigned long pe; 114 unsigned long pe;
@@ -172,7 +190,7 @@ fail:
172 return -EIO; 190 return -EIO;
173} 191}
174 192
175static void pnv_ioda2_alloc_m64_pe(struct pnv_phb *phb) 193static void pnv_ioda2_reserve_m64_pe(struct pnv_phb *phb)
176{ 194{
177 resource_size_t sgsz = phb->ioda.m64_segsize; 195 resource_size_t sgsz = phb->ioda.m64_segsize;
178 struct pci_dev *pdev; 196 struct pci_dev *pdev;
@@ -185,16 +203,15 @@ static void pnv_ioda2_alloc_m64_pe(struct pnv_phb *phb)
185 * instead of root bus. 203 * instead of root bus.
186 */ 204 */
187 list_for_each_entry(pdev, &phb->hose->bus->devices, bus_list) { 205 list_for_each_entry(pdev, &phb->hose->bus->devices, bus_list) {
188 for (i = PCI_BRIDGE_RESOURCES; 206 for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
189 i <= PCI_BRIDGE_RESOURCE_END; i++) { 207 r = &pdev->resource[PCI_BRIDGE_RESOURCES + i];
190 r = &pdev->resource[i];
191 if (!r->parent || 208 if (!r->parent ||
192 !pnv_pci_is_mem_pref_64(r->flags)) 209 !pnv_pci_is_mem_pref_64(r->flags))
193 continue; 210 continue;
194 211
195 base = (r->start - phb->ioda.m64_base) / sgsz; 212 base = (r->start - phb->ioda.m64_base) / sgsz;
196 for (step = 0; step < resource_size(r) / sgsz; step++) 213 for (step = 0; step < resource_size(r) / sgsz; step++)
197 set_bit(base + step, phb->ioda.pe_alloc); 214 pnv_ioda_reserve_pe(phb, base + step);
198 } 215 }
199 } 216 }
200} 217}
@@ -287,8 +304,6 @@ done:
287 while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe, i + 1)) < 304 while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe, i + 1)) <
288 phb->ioda.total_pe) { 305 phb->ioda.total_pe) {
289 pe = &phb->ioda.pe_array[i]; 306 pe = &phb->ioda.pe_array[i];
290 pe->phb = phb;
291 pe->pe_number = i;
292 307
293 if (!master_pe) { 308 if (!master_pe) {
294 pe->flags |= PNV_IODA_PE_MASTER; 309 pe->flags |= PNV_IODA_PE_MASTER;
@@ -313,6 +328,12 @@ static void __init pnv_ioda_parse_m64_window(struct pnv_phb *phb)
313 const u32 *r; 328 const u32 *r;
314 u64 pci_addr; 329 u64 pci_addr;
315 330
331 /* FIXME: Support M64 for P7IOC */
332 if (phb->type != PNV_PHB_IODA2) {
333 pr_info(" Not support M64 window\n");
334 return;
335 }
336
316 if (!firmware_has_feature(FW_FEATURE_OPALv3)) { 337 if (!firmware_has_feature(FW_FEATURE_OPALv3)) {
317 pr_info(" Firmware too old to support M64 window\n"); 338 pr_info(" Firmware too old to support M64 window\n");
318 return; 339 return;
@@ -325,12 +346,6 @@ static void __init pnv_ioda_parse_m64_window(struct pnv_phb *phb)
325 return; 346 return;
326 } 347 }
327 348
328 /* FIXME: Support M64 for P7IOC */
329 if (phb->type != PNV_PHB_IODA2) {
330 pr_info(" Not support M64 window\n");
331 return;
332 }
333
334 res = &hose->mem_resources[1]; 349 res = &hose->mem_resources[1];
335 res->start = of_translate_address(dn, r + 2); 350 res->start = of_translate_address(dn, r + 2);
336 res->end = res->start + of_read_number(r + 4, 2) - 1; 351 res->end = res->start + of_read_number(r + 4, 2) - 1;
@@ -345,7 +360,7 @@ static void __init pnv_ioda_parse_m64_window(struct pnv_phb *phb)
345 /* Use last M64 BAR to cover M64 window */ 360 /* Use last M64 BAR to cover M64 window */
346 phb->ioda.m64_bar_idx = 15; 361 phb->ioda.m64_bar_idx = 15;
347 phb->init_m64 = pnv_ioda2_init_m64; 362 phb->init_m64 = pnv_ioda2_init_m64;
348 phb->alloc_m64_pe = pnv_ioda2_alloc_m64_pe; 363 phb->reserve_m64_pe = pnv_ioda2_reserve_m64_pe;
349 phb->pick_m64_pe = pnv_ioda2_pick_m64_pe; 364 phb->pick_m64_pe = pnv_ioda2_pick_m64_pe;
350} 365}
351 366
@@ -358,7 +373,9 @@ static void pnv_ioda_freeze_pe(struct pnv_phb *phb, int pe_no)
358 /* Fetch master PE */ 373 /* Fetch master PE */
359 if (pe->flags & PNV_IODA_PE_SLAVE) { 374 if (pe->flags & PNV_IODA_PE_SLAVE) {
360 pe = pe->master; 375 pe = pe->master;
361 WARN_ON(!pe || !(pe->flags & PNV_IODA_PE_MASTER)); 376 if (WARN_ON(!pe || !(pe->flags & PNV_IODA_PE_MASTER)))
377 return;
378
362 pe_no = pe->pe_number; 379 pe_no = pe->pe_number;
363 } 380 }
364 381
@@ -507,6 +524,106 @@ static struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev)
507} 524}
508#endif /* CONFIG_PCI_MSI */ 525#endif /* CONFIG_PCI_MSI */
509 526
527static int pnv_ioda_set_one_peltv(struct pnv_phb *phb,
528 struct pnv_ioda_pe *parent,
529 struct pnv_ioda_pe *child,
530 bool is_add)
531{
532 const char *desc = is_add ? "adding" : "removing";
533 uint8_t op = is_add ? OPAL_ADD_PE_TO_DOMAIN :
534 OPAL_REMOVE_PE_FROM_DOMAIN;
535 struct pnv_ioda_pe *slave;
536 long rc;
537
538 /* Parent PE affects child PE */
539 rc = opal_pci_set_peltv(phb->opal_id, parent->pe_number,
540 child->pe_number, op);
541 if (rc != OPAL_SUCCESS) {
542 pe_warn(child, "OPAL error %ld %s to parent PELTV\n",
543 rc, desc);
544 return -ENXIO;
545 }
546
547 if (!(child->flags & PNV_IODA_PE_MASTER))
548 return 0;
549
550 /* Compound case: parent PE affects slave PEs */
551 list_for_each_entry(slave, &child->slaves, list) {
552 rc = opal_pci_set_peltv(phb->opal_id, parent->pe_number,
553 slave->pe_number, op);
554 if (rc != OPAL_SUCCESS) {
555 pe_warn(slave, "OPAL error %ld %s to parent PELTV\n",
556 rc, desc);
557 return -ENXIO;
558 }
559 }
560
561 return 0;
562}
563
564static int pnv_ioda_set_peltv(struct pnv_phb *phb,
565 struct pnv_ioda_pe *pe,
566 bool is_add)
567{
568 struct pnv_ioda_pe *slave;
569 struct pci_dev *pdev;
570 int ret;
571
572 /*
573 * Clear PE frozen state. If it's master PE, we need
574 * clear slave PE frozen state as well.
575 */
576 if (is_add) {
577 opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number,
578 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
579 if (pe->flags & PNV_IODA_PE_MASTER) {
580 list_for_each_entry(slave, &pe->slaves, list)
581 opal_pci_eeh_freeze_clear(phb->opal_id,
582 slave->pe_number,
583 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
584 }
585 }
586
587 /*
588 * Associate PE in PELT. We need add the PE into the
589 * corresponding PELT-V as well. Otherwise, the error
590 * originated from the PE might contribute to other
591 * PEs.
592 */
593 ret = pnv_ioda_set_one_peltv(phb, pe, pe, is_add);
594 if (ret)
595 return ret;
596
597 /* For compound PEs, any one affects all of them */
598 if (pe->flags & PNV_IODA_PE_MASTER) {
599 list_for_each_entry(slave, &pe->slaves, list) {
600 ret = pnv_ioda_set_one_peltv(phb, slave, pe, is_add);
601 if (ret)
602 return ret;
603 }
604 }
605
606 if (pe->flags & (PNV_IODA_PE_BUS_ALL | PNV_IODA_PE_BUS))
607 pdev = pe->pbus->self;
608 else
609 pdev = pe->pdev->bus->self;
610 while (pdev) {
611 struct pci_dn *pdn = pci_get_pdn(pdev);
612 struct pnv_ioda_pe *parent;
613
614 if (pdn && pdn->pe_number != IODA_INVALID_PE) {
615 parent = &phb->ioda.pe_array[pdn->pe_number];
616 ret = pnv_ioda_set_one_peltv(phb, parent, pe, is_add);
617 if (ret)
618 return ret;
619 }
620
621 pdev = pdev->bus->self;
622 }
623
624 return 0;
625}
626
510static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe) 627static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
511{ 628{
512 struct pci_dev *parent; 629 struct pci_dev *parent;
@@ -561,48 +678,36 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
561 return -ENXIO; 678 return -ENXIO;
562 } 679 }
563 680
564 rc = opal_pci_set_peltv(phb->opal_id, pe->pe_number, 681 /* Configure PELTV */
565 pe->pe_number, OPAL_ADD_PE_TO_DOMAIN); 682 pnv_ioda_set_peltv(phb, pe, true);
566 if (rc)
567 pe_warn(pe, "OPAL error %d adding self to PELTV\n", rc);
568 opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number,
569 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
570 683
571 /* Add to all parents PELT-V */
572 while (parent) {
573 struct pci_dn *pdn = pci_get_pdn(parent);
574 if (pdn && pdn->pe_number != IODA_INVALID_PE) {
575 rc = opal_pci_set_peltv(phb->opal_id, pdn->pe_number,
576 pe->pe_number, OPAL_ADD_PE_TO_DOMAIN);
577 /* XXX What to do in case of error ? */
578 }
579 parent = parent->bus->self;
580 }
581 /* Setup reverse map */ 684 /* Setup reverse map */
582 for (rid = pe->rid; rid < rid_end; rid++) 685 for (rid = pe->rid; rid < rid_end; rid++)
583 phb->ioda.pe_rmap[rid] = pe->pe_number; 686 phb->ioda.pe_rmap[rid] = pe->pe_number;
584 687
585 /* Setup one MVTs on IODA1 */ 688 /* Setup one MVTs on IODA1 */
586 if (phb->type == PNV_PHB_IODA1) { 689 if (phb->type != PNV_PHB_IODA1) {
587 pe->mve_number = pe->pe_number; 690 pe->mve_number = 0;
588 rc = opal_pci_set_mve(phb->opal_id, pe->mve_number, 691 goto out;
589 pe->pe_number); 692 }
693
694 pe->mve_number = pe->pe_number;
695 rc = opal_pci_set_mve(phb->opal_id, pe->mve_number, pe->pe_number);
696 if (rc != OPAL_SUCCESS) {
697 pe_err(pe, "OPAL error %ld setting up MVE %d\n",
698 rc, pe->mve_number);
699 pe->mve_number = -1;
700 } else {
701 rc = opal_pci_set_mve_enable(phb->opal_id,
702 pe->mve_number, OPAL_ENABLE_MVE);
590 if (rc) { 703 if (rc) {
591 pe_err(pe, "OPAL error %ld setting up MVE %d\n", 704 pe_err(pe, "OPAL error %ld enabling MVE %d\n",
592 rc, pe->mve_number); 705 rc, pe->mve_number);
593 pe->mve_number = -1; 706 pe->mve_number = -1;
594 } else {
595 rc = opal_pci_set_mve_enable(phb->opal_id,
596 pe->mve_number, OPAL_ENABLE_MVE);
597 if (rc) {
598 pe_err(pe, "OPAL error %ld enabling MVE %d\n",
599 rc, pe->mve_number);
600 pe->mve_number = -1;
601 }
602 } 707 }
603 } else if (phb->type == PNV_PHB_IODA2) 708 }
604 pe->mve_number = 0;
605 709
710out:
606 return 0; 711 return 0;
607} 712}
608 713
@@ -837,8 +942,8 @@ static void pnv_pci_ioda_setup_PEs(void)
837 phb = hose->private_data; 942 phb = hose->private_data;
838 943
839 /* M64 layout might affect PE allocation */ 944 /* M64 layout might affect PE allocation */
840 if (phb->alloc_m64_pe) 945 if (phb->reserve_m64_pe)
841 phb->alloc_m64_pe(phb); 946 phb->reserve_m64_pe(phb);
842 947
843 pnv_ioda_setup_PEs(hose->bus); 948 pnv_ioda_setup_PEs(hose->bus);
844 } 949 }
@@ -1834,19 +1939,14 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
1834 phb_id = be64_to_cpup(prop64); 1939 phb_id = be64_to_cpup(prop64);
1835 pr_debug(" PHB-ID : 0x%016llx\n", phb_id); 1940 pr_debug(" PHB-ID : 0x%016llx\n", phb_id);
1836 1941
1837 phb = alloc_bootmem(sizeof(struct pnv_phb)); 1942 phb = memblock_virt_alloc(sizeof(struct pnv_phb), 0);
1838 if (!phb) {
1839 pr_err(" Out of memory !\n");
1840 return;
1841 }
1842 1943
1843 /* Allocate PCI controller */ 1944 /* Allocate PCI controller */
1844 memset(phb, 0, sizeof(struct pnv_phb));
1845 phb->hose = hose = pcibios_alloc_controller(np); 1945 phb->hose = hose = pcibios_alloc_controller(np);
1846 if (!phb->hose) { 1946 if (!phb->hose) {
1847 pr_err(" Can't allocate PCI controller for %s\n", 1947 pr_err(" Can't allocate PCI controller for %s\n",
1848 np->full_name); 1948 np->full_name);
1849 free_bootmem((unsigned long)phb, sizeof(struct pnv_phb)); 1949 memblock_free(__pa(phb), sizeof(struct pnv_phb));
1850 return; 1950 return;
1851 } 1951 }
1852 1952
@@ -1913,8 +2013,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
1913 } 2013 }
1914 pemap_off = size; 2014 pemap_off = size;
1915 size += phb->ioda.total_pe * sizeof(struct pnv_ioda_pe); 2015 size += phb->ioda.total_pe * sizeof(struct pnv_ioda_pe);
1916 aux = alloc_bootmem(size); 2016 aux = memblock_virt_alloc(size, 0);
1917 memset(aux, 0, size);
1918 phb->ioda.pe_alloc = aux; 2017 phb->ioda.pe_alloc = aux;
1919 phb->ioda.m32_segmap = aux + m32map_off; 2018 phb->ioda.m32_segmap = aux + m32map_off;
1920 if (phb->type == PNV_PHB_IODA1) 2019 if (phb->type == PNV_PHB_IODA1)
@@ -1999,8 +2098,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
1999 ioda_eeh_phb_reset(hose, EEH_RESET_DEACTIVATE); 2098 ioda_eeh_phb_reset(hose, EEH_RESET_DEACTIVATE);
2000 } 2099 }
2001 2100
2002 /* Configure M64 window */ 2101 /* Remove M64 resource if we can't configure it successfully */
2003 if (phb->init_m64 && phb->init_m64(phb)) 2102 if (!phb->init_m64 || phb->init_m64(phb))
2004 hose->mem_resources[1].flags = 0; 2103 hose->mem_resources[1].flags = 0;
2005} 2104}
2006 2105
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index 94ce3481490b..6ef6d4d8e7e2 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -122,12 +122,9 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
122 return; 122 return;
123 } 123 }
124 124
125 phb = alloc_bootmem(sizeof(struct pnv_phb)); 125 phb = memblock_virt_alloc(sizeof(struct pnv_phb), 0);
126 if (phb) { 126 phb->hose = pcibios_alloc_controller(np);
127 memset(phb, 0, sizeof(struct pnv_phb)); 127 if (!phb->hose) {
128 phb->hose = pcibios_alloc_controller(np);
129 }
130 if (!phb || !phb->hose) {
131 pr_err(" Failed to allocate PCI controller\n"); 128 pr_err(" Failed to allocate PCI controller\n");
132 return; 129 return;
133 } 130 }
@@ -196,16 +193,27 @@ void __init pnv_pci_init_p5ioc2_hub(struct device_node *np)
196 hub_id = be64_to_cpup(prop64); 193 hub_id = be64_to_cpup(prop64);
197 pr_info(" HUB-ID : 0x%016llx\n", hub_id); 194 pr_info(" HUB-ID : 0x%016llx\n", hub_id);
198 195
196 /* Count child PHBs and calculate TCE space per PHB */
197 for_each_child_of_node(np, phbn) {
198 if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") ||
199 of_device_is_compatible(phbn, "ibm,p5ioc2-pciex"))
200 phb_count++;
201 }
202
203 if (phb_count <= 0) {
204 pr_info(" No PHBs for Hub %s\n", np->full_name);
205 return;
206 }
207
208 tce_per_phb = __rounddown_pow_of_two(P5IOC2_TCE_MEMORY / phb_count);
209 pr_info(" Allocating %lld MB of TCE memory per PHB\n",
210 tce_per_phb >> 20);
211
199 /* Currently allocate 16M of TCE memory for every Hub 212 /* Currently allocate 16M of TCE memory for every Hub
200 * 213 *
201 * XXX TODO: Make it chip local if possible 214 * XXX TODO: Make it chip local if possible
202 */ 215 */
203 tce_mem = __alloc_bootmem(P5IOC2_TCE_MEMORY, P5IOC2_TCE_MEMORY, 216 tce_mem = memblock_virt_alloc(P5IOC2_TCE_MEMORY, P5IOC2_TCE_MEMORY);
204 __pa(MAX_DMA_ADDRESS));
205 if (!tce_mem) {
206 pr_err(" Failed to allocate TCE Memory !\n");
207 return;
208 }
209 pr_debug(" TCE : 0x%016lx..0x%016lx\n", 217 pr_debug(" TCE : 0x%016lx..0x%016lx\n",
210 __pa(tce_mem), __pa(tce_mem) + P5IOC2_TCE_MEMORY - 1); 218 __pa(tce_mem), __pa(tce_mem) + P5IOC2_TCE_MEMORY - 1);
211 rc = opal_pci_set_hub_tce_memory(hub_id, __pa(tce_mem), 219 rc = opal_pci_set_hub_tce_memory(hub_id, __pa(tce_mem),
@@ -215,18 +223,6 @@ void __init pnv_pci_init_p5ioc2_hub(struct device_node *np)
215 return; 223 return;
216 } 224 }
217 225
218 /* Count child PHBs */
219 for_each_child_of_node(np, phbn) {
220 if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") ||
221 of_device_is_compatible(phbn, "ibm,p5ioc2-pciex"))
222 phb_count++;
223 }
224
225 /* Calculate how much TCE space we can give per PHB */
226 tce_per_phb = __rounddown_pow_of_two(P5IOC2_TCE_MEMORY / phb_count);
227 pr_info(" Allocating %lld MB of TCE memory per PHB\n",
228 tce_per_phb >> 20);
229
230 /* Initialize PHBs */ 226 /* Initialize PHBs */
231 for_each_child_of_node(np, phbn) { 227 for_each_child_of_node(np, phbn) {
232 if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") || 228 if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") ||
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 540fc6dd56b3..4945e87f12dc 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -16,7 +16,6 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/bootmem.h>
20#include <linux/irq.h> 19#include <linux/irq.h>
21#include <linux/io.h> 20#include <linux/io.h>
22#include <linux/msi.h> 21#include <linux/msi.h>
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 34d29eb2a4de..6c02ff8dd69f 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -130,7 +130,7 @@ struct pnv_phb {
130 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); 130 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn);
131 void (*shutdown)(struct pnv_phb *phb); 131 void (*shutdown)(struct pnv_phb *phb);
132 int (*init_m64)(struct pnv_phb *phb); 132 int (*init_m64)(struct pnv_phb *phb);
133 void (*alloc_m64_pe)(struct pnv_phb *phb); 133 void (*reserve_m64_pe)(struct pnv_phb *phb);
134 int (*pick_m64_pe)(struct pnv_phb *phb, struct pci_bus *bus, int all); 134 int (*pick_m64_pe)(struct pnv_phb *phb, struct pci_bus *bus, int all);
135 int (*get_pe_state)(struct pnv_phb *phb, int pe_no); 135 int (*get_pe_state)(struct pnv_phb *phb, int pe_no);
136 void (*freeze_pe)(struct pnv_phb *phb, int pe_no); 136 void (*freeze_pe)(struct pnv_phb *phb, int pe_no);
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 3f9546d8a51f..30b1c3e298a6 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -265,10 +265,8 @@ static unsigned long pnv_memory_block_size(void)
265static void __init pnv_setup_machdep_opal(void) 265static void __init pnv_setup_machdep_opal(void)
266{ 266{
267 ppc_md.get_boot_time = opal_get_boot_time; 267 ppc_md.get_boot_time = opal_get_boot_time;
268 ppc_md.get_rtc_time = opal_get_rtc_time;
269 ppc_md.set_rtc_time = opal_set_rtc_time;
270 ppc_md.restart = pnv_restart; 268 ppc_md.restart = pnv_restart;
271 ppc_md.power_off = pnv_power_off; 269 pm_power_off = pnv_power_off;
272 ppc_md.halt = pnv_halt; 270 ppc_md.halt = pnv_halt;
273 ppc_md.machine_check_exception = opal_machine_check; 271 ppc_md.machine_check_exception = opal_machine_check;
274 ppc_md.mce_check_early_recovery = opal_mce_check_early_recovery; 272 ppc_md.mce_check_early_recovery = opal_mce_check_early_recovery;
@@ -285,7 +283,7 @@ static void __init pnv_setup_machdep_rtas(void)
285 ppc_md.set_rtc_time = rtas_set_rtc_time; 283 ppc_md.set_rtc_time = rtas_set_rtc_time;
286 } 284 }
287 ppc_md.restart = rtas_restart; 285 ppc_md.restart = rtas_restart;
288 ppc_md.power_off = rtas_power_off; 286 pm_power_off = rtas_power_off;
289 ppc_md.halt = rtas_halt; 287 ppc_md.halt = rtas_halt;
290} 288}
291#endif /* CONFIG_PPC_POWERNV_RTAS */ 289#endif /* CONFIG_PPC_POWERNV_RTAS */
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 4753958cd509..b716f666e48a 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -149,6 +149,7 @@ static int pnv_smp_cpu_disable(void)
149static void pnv_smp_cpu_kill_self(void) 149static void pnv_smp_cpu_kill_self(void)
150{ 150{
151 unsigned int cpu; 151 unsigned int cpu;
152 unsigned long srr1;
152 153
153 /* Standard hot unplug procedure */ 154 /* Standard hot unplug procedure */
154 local_irq_disable(); 155 local_irq_disable();
@@ -165,13 +166,25 @@ static void pnv_smp_cpu_kill_self(void)
165 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1); 166 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1);
166 while (!generic_check_cpu_restart(cpu)) { 167 while (!generic_check_cpu_restart(cpu)) {
167 ppc64_runlatch_off(); 168 ppc64_runlatch_off();
168 power7_nap(1); 169 srr1 = power7_nap(1);
169 ppc64_runlatch_on(); 170 ppc64_runlatch_on();
170 171
171 /* Clear the IPI that woke us up */ 172 /*
172 icp_native_flush_interrupt(); 173 * If the SRR1 value indicates that we woke up due to
173 local_paca->irq_happened &= PACA_IRQ_HARD_DIS; 174 * an external interrupt, then clear the interrupt.
174 mb(); 175 * We clear the interrupt before checking for the
176 * reason, so as to avoid a race where we wake up for
177 * some other reason, find nothing and clear the interrupt
178 * just as some other cpu is sending us an interrupt.
179 * If we returned from power7_nap as a result of
180 * having finished executing in a KVM guest, then srr1
181 * contains 0.
182 */
183 if ((srr1 & SRR1_WAKEMASK) == SRR1_WAKEEE) {
184 icp_native_flush_interrupt();
185 local_paca->irq_happened &= PACA_IRQ_HARD_DIS;
186 smp_mb();
187 }
175 188
176 if (cpu_core_split_required()) 189 if (cpu_core_split_required())
177 continue; 190 continue;
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 3e270e3412ae..2f95d33cf34a 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -110,7 +110,7 @@ static long ps3_hpte_remove(unsigned long hpte_group)
110 110
111static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, 111static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
112 unsigned long vpn, int psize, int apsize, 112 unsigned long vpn, int psize, int apsize,
113 int ssize, int local) 113 int ssize, unsigned long inv_flags)
114{ 114{
115 int result; 115 int result;
116 u64 hpte_v, want_v, hpte_rs; 116 u64 hpte_v, want_v, hpte_rs;
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 5f3b23220b8e..a6c42f34303a 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -711,7 +711,7 @@ void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq)
711 711
712static unsigned int ps3_get_irq(void) 712static unsigned int ps3_get_irq(void)
713{ 713{
714 struct ps3_private *pd = &__get_cpu_var(ps3_private); 714 struct ps3_private *pd = this_cpu_ptr(&ps3_private);
715 u64 x = (pd->bmp.status & pd->bmp.mask); 715 u64 x = (pd->bmp.status & pd->bmp.mask);
716 unsigned int plug; 716 unsigned int plug;
717 717
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 3f509f86432c..799c8580ab09 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -125,12 +125,7 @@ static void __init prealloc(struct ps3_prealloc *p)
125 if (!p->size) 125 if (!p->size)
126 return; 126 return;
127 127
128 p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS)); 128 p->address = memblock_virt_alloc(p->size, p->align);
129 if (!p->address) {
130 printk(KERN_ERR "%s: Cannot allocate %s\n", __func__,
131 p->name);
132 return;
133 }
134 129
135 printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size, 130 printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size,
136 p->address); 131 p->address);
@@ -248,6 +243,7 @@ static int __init ps3_probe(void)
248 ps3_mm_init(); 243 ps3_mm_init();
249 ps3_mm_vas_create(&htab_size); 244 ps3_mm_vas_create(&htab_size);
250 ps3_hpte_init(htab_size); 245 ps3_hpte_init(htab_size);
246 pm_power_off = ps3_power_off;
251 247
252 DBG(" <- %s:%d\n", __func__, __LINE__); 248 DBG(" <- %s:%d\n", __func__, __LINE__);
253 return 1; 249 return 1;
@@ -278,7 +274,6 @@ define_machine(ps3) {
278 .calibrate_decr = ps3_calibrate_decr, 274 .calibrate_decr = ps3_calibrate_decr,
279 .progress = ps3_progress, 275 .progress = ps3_progress,
280 .restart = ps3_restart, 276 .restart = ps3_restart,
281 .power_off = ps3_power_off,
282 .halt = ps3_halt, 277 .halt = ps3_halt,
283#if defined(CONFIG_KEXEC) 278#if defined(CONFIG_KEXEC)
284 .kexec_cpu_down = ps3_kexec_cpu_down, 279 .kexec_cpu_down = ps3_kexec_cpu_down,
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index 1062f71f5a85..39049e4884fb 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -75,7 +75,7 @@ static atomic_t dtl_count;
75 */ 75 */
76static void consume_dtle(struct dtl_entry *dtle, u64 index) 76static void consume_dtle(struct dtl_entry *dtle, u64 index)
77{ 77{
78 struct dtl_ring *dtlr = &__get_cpu_var(dtl_rings); 78 struct dtl_ring *dtlr = this_cpu_ptr(&dtl_rings);
79 struct dtl_entry *wp = dtlr->write_ptr; 79 struct dtl_entry *wp = dtlr->write_ptr;
80 struct lppaca *vpa = local_paca->lppaca_ptr; 80 struct lppaca *vpa = local_paca->lppaca_ptr;
81 81
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 1bbb78fab530..fa41f0da5b6f 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -12,7 +12,6 @@
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/of_address.h> 13#include <linux/of_address.h>
14#include <linux/memblock.h> 14#include <linux/memblock.h>
15#include <linux/vmalloc.h>
16#include <linux/memory.h> 15#include <linux/memory.h>
17#include <linux/memory_hotplug.h> 16#include <linux/memory_hotplug.h>
18 17
@@ -66,22 +65,6 @@ unsigned long pseries_memory_block_size(void)
66} 65}
67 66
68#ifdef CONFIG_MEMORY_HOTREMOVE 67#ifdef CONFIG_MEMORY_HOTREMOVE
69static int pseries_remove_memory(u64 start, u64 size)
70{
71 int ret;
72
73 /* Remove htab bolted mappings for this section of memory */
74 start = (unsigned long)__va(start);
75 ret = remove_section_mapping(start, start + size);
76
77 /* Ensure all vmalloc mappings are flushed in case they also
78 * hit that section of memory
79 */
80 vm_unmap_aliases();
81
82 return ret;
83}
84
85static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) 68static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
86{ 69{
87 unsigned long block_sz, start_pfn; 70 unsigned long block_sz, start_pfn;
@@ -261,10 +244,6 @@ static int __init pseries_memory_hotplug_init(void)
261 if (firmware_has_feature(FW_FEATURE_LPAR)) 244 if (firmware_has_feature(FW_FEATURE_LPAR))
262 of_reconfig_notifier_register(&pseries_mem_nb); 245 of_reconfig_notifier_register(&pseries_mem_nb);
263 246
264#ifdef CONFIG_MEMORY_HOTREMOVE
265 ppc_md.remove_memory = pseries_remove_memory;
266#endif
267
268 return 0; 247 return 0;
269} 248}
270machine_device_initcall(pseries, pseries_memory_hotplug_init); 249machine_device_initcall(pseries, pseries_memory_hotplug_init);
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 3fda3f17b84e..ccd53f91e8aa 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -18,7 +18,7 @@
18 18
19#ifdef CONFIG_TRACEPOINTS 19#ifdef CONFIG_TRACEPOINTS
20 20
21#ifndef CONFIG_JUMP_LABEL 21#ifndef HAVE_JUMP_LABEL
22 .section ".toc","aw" 22 .section ".toc","aw"
23 23
24 .globl hcall_tracepoint_refcount 24 .globl hcall_tracepoint_refcount
@@ -78,7 +78,7 @@ hcall_tracepoint_refcount:
78 mr r5,BUFREG; \ 78 mr r5,BUFREG; \
79 __HCALL_INST_POSTCALL 79 __HCALL_INST_POSTCALL
80 80
81#ifdef CONFIG_JUMP_LABEL 81#ifdef HAVE_JUMP_LABEL
82#define HCALL_BRANCH(LABEL) \ 82#define HCALL_BRANCH(LABEL) \
83 ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key) 83 ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key)
84#else 84#else
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index 4575f0c9e521..f02ec3ab428c 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -110,7 +110,7 @@ static void probe_hcall_entry(void *ignored, unsigned long opcode, unsigned long
110 if (opcode > MAX_HCALL_OPCODE) 110 if (opcode > MAX_HCALL_OPCODE)
111 return; 111 return;
112 112
113 h = &__get_cpu_var(hcall_stats)[opcode / 4]; 113 h = this_cpu_ptr(&hcall_stats[opcode / 4]);
114 h->tb_start = mftb(); 114 h->tb_start = mftb();
115 h->purr_start = mfspr(SPRN_PURR); 115 h->purr_start = mfspr(SPRN_PURR);
116} 116}
@@ -123,7 +123,7 @@ static void probe_hcall_exit(void *ignored, unsigned long opcode, unsigned long
123 if (opcode > MAX_HCALL_OPCODE) 123 if (opcode > MAX_HCALL_OPCODE)
124 return; 124 return;
125 125
126 h = &__get_cpu_var(hcall_stats)[opcode / 4]; 126 h = this_cpu_ptr(&hcall_stats[opcode / 4]);
127 h->num_calls++; 127 h->num_calls++;
128 h->tb_total += mftb() - h->tb_start; 128 h->tb_total += mftb() - h->tb_start;
129 h->purr_total += mfspr(SPRN_PURR) - h->purr_start; 129 h->purr_total += mfspr(SPRN_PURR) - h->purr_start;
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 3e5bfdafee63..1d3d52dc3ff3 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -199,7 +199,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
199 199
200 local_irq_save(flags); /* to protect tcep and the page behind it */ 200 local_irq_save(flags); /* to protect tcep and the page behind it */
201 201
202 tcep = __get_cpu_var(tce_page); 202 tcep = __this_cpu_read(tce_page);
203 203
204 /* This is safe to do since interrupts are off when we're called 204 /* This is safe to do since interrupts are off when we're called
205 * from iommu_alloc{,_sg}() 205 * from iommu_alloc{,_sg}()
@@ -212,7 +212,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
212 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, 212 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
213 direction, attrs); 213 direction, attrs);
214 } 214 }
215 __get_cpu_var(tce_page) = tcep; 215 __this_cpu_write(tce_page, tcep);
216 } 216 }
217 217
218 rpn = __pa(uaddr) >> TCE_SHIFT; 218 rpn = __pa(uaddr) >> TCE_SHIFT;
@@ -398,7 +398,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
398 long l, limit; 398 long l, limit;
399 399
400 local_irq_disable(); /* to protect tcep and the page behind it */ 400 local_irq_disable(); /* to protect tcep and the page behind it */
401 tcep = __get_cpu_var(tce_page); 401 tcep = __this_cpu_read(tce_page);
402 402
403 if (!tcep) { 403 if (!tcep) {
404 tcep = (__be64 *)__get_free_page(GFP_ATOMIC); 404 tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
@@ -406,7 +406,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
406 local_irq_enable(); 406 local_irq_enable();
407 return -ENOMEM; 407 return -ENOMEM;
408 } 408 }
409 __get_cpu_var(tce_page) = tcep; 409 __this_cpu_write(tce_page, tcep);
410 } 410 }
411 411
412 proto_tce = TCE_PCI_READ | TCE_PCI_WRITE; 412 proto_tce = TCE_PCI_READ | TCE_PCI_WRITE;
@@ -574,8 +574,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
574 while (isa_dn && isa_dn != dn) 574 while (isa_dn && isa_dn != dn)
575 isa_dn = isa_dn->parent; 575 isa_dn = isa_dn->parent;
576 576
577 if (isa_dn_orig) 577 of_node_put(isa_dn_orig);
578 of_node_put(isa_dn_orig);
579 578
580 /* Count number of direct PCI children of the PHB. */ 579 /* Count number of direct PCI children of the PHB. */
581 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling) 580 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index f6880d2a40fb..469751d92004 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -284,7 +284,7 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot,
284 unsigned long newpp, 284 unsigned long newpp,
285 unsigned long vpn, 285 unsigned long vpn,
286 int psize, int apsize, 286 int psize, int apsize,
287 int ssize, int local) 287 int ssize, unsigned long inv_flags)
288{ 288{
289 unsigned long lpar_rc; 289 unsigned long lpar_rc;
290 unsigned long flags = (newpp & 7) | H_AVPN; 290 unsigned long flags = (newpp & 7) | H_AVPN;
@@ -442,7 +442,7 @@ static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
442static void pSeries_lpar_hugepage_invalidate(unsigned long vsid, 442static void pSeries_lpar_hugepage_invalidate(unsigned long vsid,
443 unsigned long addr, 443 unsigned long addr,
444 unsigned char *hpte_slot_array, 444 unsigned char *hpte_slot_array,
445 int psize, int ssize) 445 int psize, int ssize, int local)
446{ 446{
447 int i, index = 0; 447 int i, index = 0;
448 unsigned long s_addr = addr; 448 unsigned long s_addr = addr;
@@ -515,7 +515,7 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
515 unsigned long vpn; 515 unsigned long vpn;
516 unsigned long i, pix, rc; 516 unsigned long i, pix, rc;
517 unsigned long flags = 0; 517 unsigned long flags = 0;
518 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 518 struct ppc64_tlb_batch *batch = this_cpu_ptr(&ppc64_tlb_batch);
519 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); 519 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
520 unsigned long param[9]; 520 unsigned long param[9];
521 unsigned long hash, index, shift, hidx, slot; 521 unsigned long hash, index, shift, hidx, slot;
@@ -705,7 +705,7 @@ void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
705 705
706 local_irq_save(flags); 706 local_irq_save(flags);
707 707
708 depth = &__get_cpu_var(hcall_trace_depth); 708 depth = this_cpu_ptr(&hcall_trace_depth);
709 709
710 if (*depth) 710 if (*depth)
711 goto out; 711 goto out;
@@ -730,7 +730,7 @@ void __trace_hcall_exit(long opcode, unsigned long retval,
730 730
731 local_irq_save(flags); 731 local_irq_save(flags);
732 732
733 depth = &__get_cpu_var(hcall_trace_depth); 733 depth = this_cpu_ptr(&hcall_trace_depth);
734 734
735 if (*depth) 735 if (*depth)
736 goto out; 736 goto out;
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 11a3b617ef5d..054a0ed5c7ee 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -715,6 +715,8 @@ static int nvram_pstore_init(void)
715 nvram_pstore_info.buf = oops_data; 715 nvram_pstore_info.buf = oops_data;
716 nvram_pstore_info.bufsize = oops_data_sz; 716 nvram_pstore_info.bufsize = oops_data_sz;
717 717
718 spin_lock_init(&nvram_pstore_info.buf_lock);
719
718 rc = pstore_register(&nvram_pstore_info); 720 rc = pstore_register(&nvram_pstore_info);
719 if (rc != 0) 721 if (rc != 0)
720 pr_err("nvram: pstore_register() failed, defaults to " 722 pr_err("nvram: pstore_register() failed, defaults to "
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 67e48594040c..fe16a50700de 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -134,7 +134,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
134 of_node_put(pdn); 134 of_node_put(pdn);
135 135
136 if (rc) { 136 if (rc) {
137 pr_err("no ibm,pcie-link-speed-stats property\n"); 137 pr_debug("no ibm,pcie-link-speed-stats property\n");
138 return 0; 138 return 0;
139 } 139 }
140 140
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 5a4d0fc03b03..c3b2a7e81ddb 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -302,8 +302,8 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs)
302 /* If it isn't an extended log we can use the per cpu 64bit buffer */ 302 /* If it isn't an extended log we can use the per cpu 64bit buffer */
303 h = (struct rtas_error_log *)&savep[1]; 303 h = (struct rtas_error_log *)&savep[1];
304 if (!rtas_error_extended(h)) { 304 if (!rtas_error_extended(h)) {
305 memcpy(&__get_cpu_var(mce_data_buf), h, sizeof(__u64)); 305 memcpy(this_cpu_ptr(&mce_data_buf), h, sizeof(__u64));
306 errhdr = (struct rtas_error_log *)&__get_cpu_var(mce_data_buf); 306 errhdr = (struct rtas_error_log *)this_cpu_ptr(&mce_data_buf);
307 } else { 307 } else {
308 int len, error_log_length; 308 int len, error_log_length;
309 309
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ed8a90022a3d..e445b6701f50 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -500,7 +500,11 @@ static void __init pSeries_setup_arch(void)
500 500
501 if (firmware_has_feature(FW_FEATURE_SET_MODE)) { 501 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
502 long rc; 502 long rc;
503 if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) { 503
504 rc = pSeries_enable_reloc_on_exc();
505 if (rc == H_P2) {
506 pr_info("Relocation on exceptions not supported\n");
507 } else if (rc != H_SUCCESS) {
504 pr_warn("Unable to enable relocation on exceptions: " 508 pr_warn("Unable to enable relocation on exceptions: "
505 "%ld\n", rc); 509 "%ld\n", rc);
506 } 510 }
@@ -660,6 +664,34 @@ static void __init pSeries_init_early(void)
660 pr_debug(" <- pSeries_init_early()\n"); 664 pr_debug(" <- pSeries_init_early()\n");
661} 665}
662 666
667/**
668 * pseries_power_off - tell firmware about how to power off the system.
669 *
670 * This function calls either the power-off rtas token in normal cases
671 * or the ibm,power-off-ups token (if present & requested) in case of
672 * a power failure. If power-off token is used, power on will only be
673 * possible with power button press. If ibm,power-off-ups token is used
674 * it will allow auto poweron after power is restored.
675 */
676static void pseries_power_off(void)
677{
678 int rc;
679 int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups");
680
681 if (rtas_flash_term_hook)
682 rtas_flash_term_hook(SYS_POWER_OFF);
683
684 if (rtas_poweron_auto == 0 ||
685 rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) {
686 rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1);
687 printk(KERN_INFO "RTAS power-off returned %d\n", rc);
688 } else {
689 rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL);
690 printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc);
691 }
692 for (;;);
693}
694
663/* 695/*
664 * Called very early, MMU is off, device-tree isn't unflattened 696 * Called very early, MMU is off, device-tree isn't unflattened
665 */ 697 */
@@ -742,6 +774,8 @@ static int __init pSeries_probe(void)
742 else 774 else
743 hpte_init_native(); 775 hpte_init_native();
744 776
777 pm_power_off = pseries_power_off;
778
745 pr_debug("Machine is%s LPAR !\n", 779 pr_debug("Machine is%s LPAR !\n",
746 (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not"); 780 (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
747 781
@@ -755,34 +789,6 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
755 return PCI_PROBE_NORMAL; 789 return PCI_PROBE_NORMAL;
756} 790}
757 791
758/**
759 * pSeries_power_off - tell firmware about how to power off the system.
760 *
761 * This function calls either the power-off rtas token in normal cases
762 * or the ibm,power-off-ups token (if present & requested) in case of
763 * a power failure. If power-off token is used, power on will only be
764 * possible with power button press. If ibm,power-off-ups token is used
765 * it will allow auto poweron after power is restored.
766 */
767static void pSeries_power_off(void)
768{
769 int rc;
770 int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups");
771
772 if (rtas_flash_term_hook)
773 rtas_flash_term_hook(SYS_POWER_OFF);
774
775 if (rtas_poweron_auto == 0 ||
776 rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) {
777 rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1);
778 printk(KERN_INFO "RTAS power-off returned %d\n", rc);
779 } else {
780 rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL);
781 printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc);
782 }
783 for (;;);
784}
785
786#ifndef CONFIG_PCI 792#ifndef CONFIG_PCI
787void pSeries_final_fixup(void) { } 793void pSeries_final_fixup(void) { }
788#endif 794#endif
@@ -797,7 +803,6 @@ define_machine(pseries) {
797 .pcibios_fixup = pSeries_final_fixup, 803 .pcibios_fixup = pSeries_final_fixup,
798 .pci_probe_mode = pSeries_pci_probe_mode, 804 .pci_probe_mode = pSeries_pci_probe_mode,
799 .restart = rtas_restart, 805 .restart = rtas_restart,
800 .power_off = pSeries_power_off,
801 .halt = rtas_halt, 806 .halt = rtas_halt,
802 .panic = rtas_os_term, 807 .panic = rtas_os_term,
803 .get_boot_time = rtas_get_boot_time, 808 .get_boot_time = rtas_get_boot_time,