aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-27 05:50:54 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-27 05:50:54 -0400
commit4944dd62de21230af039eda7cd218e9a09021d11 (patch)
treebac70f7bab8506c7e1b0408bacbdb0b1d77262e9 /arch/powerpc/platforms
parentf17845e5d97ead8fbdadfd40039e058ec7cf4a42 (diff)
parent0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff)
Merge commit 'v2.6.28-rc2' into tracing/urgent
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/40x/Kconfig38
-rw-r--r--arch/powerpc/platforms/40x/Makefile2
-rw-r--r--arch/powerpc/platforms/40x/hcu4.c61
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c80
-rw-r--r--arch/powerpc/platforms/44x/Kconfig8
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c7
-rw-r--r--arch/powerpc/platforms/85xx/ksi8560.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c4
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c4
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c4
-rw-r--r--arch/powerpc/platforms/85xx/stx_gp3.c4
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c4
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c2
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c2
-rw-r--r--arch/powerpc/platforms/86xx/sbc8641d.c2
-rw-r--r--arch/powerpc/platforms/cell/ras.c6
-rw-r--r--arch/powerpc/platforms/cell/smp.c10
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c155
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c3
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c24
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sputrace.c37
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c4
-rw-r--r--arch/powerpc/platforms/embedded6xx/c2k.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/prpmc2800.c3
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c6
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c6
-rw-r--r--arch/powerpc/platforms/pseries/smp.c13
29 files changed, 366 insertions, 135 deletions
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index a9260e21451e..65730275e012 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -14,6 +14,15 @@
14# help 14# help
15# This option enables support for the CPCI405 board. 15# This option enables support for the CPCI405 board.
16 16
17config ACADIA
18 bool "Acadia"
19 depends on 40x
20 default n
21 select PPC40x_SIMPLE
22 select 405EZ
23 help
24 This option enables support for the AMCC 405EZ Acadia evaluation board.
25
17config EP405 26config EP405
18 bool "EP405/EP405PC" 27 bool "EP405/EP405PC"
19 depends on 40x 28 depends on 40x
@@ -23,6 +32,14 @@ config EP405
23 help 32 help
24 This option enables support for the EP405/EP405PC boards. 33 This option enables support for the EP405/EP405PC boards.
25 34
35config HCU4
36 bool "Hcu4"
37 depends on 40x
38 default y
39 select 405GPR
40 help
41 This option enables support for the Nestal Maschinen HCU4 board.
42
26config KILAUEA 43config KILAUEA
27 bool "Kilauea" 44 bool "Kilauea"
28 depends on 40x 45 depends on 40x
@@ -93,6 +110,13 @@ config XILINX_VIRTEX_GENERIC_BOARD
93 Most Virtex designs should use this unless it needs to do some 110 Most Virtex designs should use this unless it needs to do some
94 special configuration at board probe time. 111 special configuration at board probe time.
95 112
113config PPC40x_SIMPLE
114 bool "Simple PowerPC 40x board support"
115 depends on 40x
116 default n
117 help
118 This option enables the simple PowerPC 40x platform support.
119
96# 40x specific CPU modules, selected based on the board above. 120# 40x specific CPU modules, selected based on the board above.
97config NP405H 121config NP405H
98 bool 122 bool
@@ -118,6 +142,12 @@ config 405EX
118 select IBM_NEW_EMAC_EMAC4 142 select IBM_NEW_EMAC_EMAC4
119 select IBM_NEW_EMAC_RGMII 143 select IBM_NEW_EMAC_RGMII
120 144
145config 405EZ
146 bool
147 select IBM_NEW_EMAC_NO_FLOW_CTRL
148 select IBM_NEW_EMAC_MAL_CLR_ICINTSTAT
149 select IBM_NEW_EMAC_MAL_COMMON_ERR
150
121config 405GPR 151config 405GPR
122 bool 152 bool
123 153
@@ -139,6 +169,14 @@ config STB03xxx
139 select IBM405_ERR77 169 select IBM405_ERR77
140 select IBM405_ERR51 170 select IBM405_ERR51
141 171
172config PPC4xx_GPIO
173 bool "PPC4xx GPIO support"
174 depends on 40x
175 select ARCH_REQUIRE_GPIOLIB
176 select GENERIC_GPIO
177 help
178 Enable gpiolib support for ppc40x based boards
179
142# 40x errata/workaround config symbols, selected by the CPU models above 180# 40x errata/workaround config symbols, selected by the CPU models above
143 181
144# All 405-based cores up until the 405GPR and 405EP have this errata. 182# All 405-based cores up until the 405GPR and 405EP have this errata.
diff --git a/arch/powerpc/platforms/40x/Makefile b/arch/powerpc/platforms/40x/Makefile
index 5533a5c8ce4e..9bab76a652a6 100644
--- a/arch/powerpc/platforms/40x/Makefile
+++ b/arch/powerpc/platforms/40x/Makefile
@@ -1,5 +1,7 @@
1obj-$(CONFIG_KILAUEA) += kilauea.o 1obj-$(CONFIG_KILAUEA) += kilauea.o
2obj-$(CONFIG_HCU4) += hcu4.o
2obj-$(CONFIG_MAKALU) += makalu.o 3obj-$(CONFIG_MAKALU) += makalu.o
3obj-$(CONFIG_WALNUT) += walnut.o 4obj-$(CONFIG_WALNUT) += walnut.o
4obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o 5obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o
5obj-$(CONFIG_EP405) += ep405.o 6obj-$(CONFIG_EP405) += ep405.o
7obj-$(CONFIG_PPC40x_SIMPLE) += ppc40x_simple.o
diff --git a/arch/powerpc/platforms/40x/hcu4.c b/arch/powerpc/platforms/40x/hcu4.c
new file mode 100644
index 000000000000..60b2afecab75
--- /dev/null
+++ b/arch/powerpc/platforms/40x/hcu4.c
@@ -0,0 +1,61 @@
1/*
2 * Architecture- / platform-specific boot-time initialization code for
3 * IBM PowerPC 4xx based boards. Adapted from original
4 * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek
5 * <dan@net4x.com>.
6 *
7 * Copyright(c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
8 *
9 * Rewritten and ported to the merged powerpc tree:
10 * Copyright 2007 IBM Corporation
11 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
12 *
13 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
14 * the terms of the GNU General Public License version 2. This program
15 * is licensed "as is" without any warranty of any kind, whether express
16 * or implied.
17 */
18
19#include <linux/init.h>
20#include <linux/of_platform.h>
21
22#include <asm/machdep.h>
23#include <asm/prom.h>
24#include <asm/udbg.h>
25#include <asm/time.h>
26#include <asm/uic.h>
27#include <asm/ppc4xx.h>
28
29static __initdata struct of_device_id hcu4_of_bus[] = {
30 { .compatible = "ibm,plb3", },
31 { .compatible = "ibm,opb", },
32 { .compatible = "ibm,ebc", },
33 {},
34};
35
36static int __init hcu4_device_probe(void)
37{
38 of_platform_bus_probe(NULL, hcu4_of_bus, NULL);
39 return 0;
40}
41machine_device_initcall(hcu4, hcu4_device_probe);
42
43static int __init hcu4_probe(void)
44{
45 unsigned long root = of_get_flat_dt_root();
46
47 if (!of_flat_dt_is_compatible(root, "netstal,hcu4"))
48 return 0;
49
50 return 1;
51}
52
53define_machine(hcu4) {
54 .name = "HCU4",
55 .probe = hcu4_probe,
56 .progress = udbg_progress,
57 .init_IRQ = uic_init_tree,
58 .get_irq = uic_get_irq,
59 .restart = ppc4xx_reset_system,
60 .calibrate_decr = generic_calibrate_decr,
61};
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
new file mode 100644
index 000000000000..4498a86b46c3
--- /dev/null
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -0,0 +1,80 @@
1/*
2 * Generic PowerPC 40x platform support
3 *
4 * Copyright 2008 IBM Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; version 2 of the License.
9 *
10 * This implements simple platform support for PowerPC 44x chips. This is
11 * mostly used for eval boards or other simple and "generic" 44x boards. If
12 * your board has custom functions or hardware, then you will likely want to
13 * implement your own board.c file to accommodate it.
14 */
15
16#include <asm/machdep.h>
17#include <asm/pci-bridge.h>
18#include <asm/ppc4xx.h>
19#include <asm/prom.h>
20#include <asm/time.h>
21#include <asm/udbg.h>
22#include <asm/uic.h>
23
24#include <linux/init.h>
25#include <linux/of_platform.h>
26
27static __initdata struct of_device_id ppc40x_of_bus[] = {
28 { .compatible = "ibm,plb3", },
29 { .compatible = "ibm,plb4", },
30 { .compatible = "ibm,opb", },
31 { .compatible = "ibm,ebc", },
32 { .compatible = "simple-bus", },
33 {},
34};
35
36static int __init ppc40x_device_probe(void)
37{
38 of_platform_bus_probe(NULL, ppc40x_of_bus, NULL);
39
40 return 0;
41}
42machine_device_initcall(ppc40x_simple, ppc40x_device_probe);
43
44/* This is the list of boards that can be supported by this simple
45 * platform code. This does _not_ mean the boards are compatible,
46 * as they most certainly are not from a device tree perspective.
47 * However, their differences are handled by the device tree and the
48 * drivers and therefore they don't need custom board support files.
49 *
50 * Again, if your board needs to do things differently then create a
51 * board.c file for it rather than adding it to this list.
52 */
53static char *board[] __initdata = {
54 "amcc,acadia"
55};
56
57static int __init ppc40x_probe(void)
58{
59 unsigned long root = of_get_flat_dt_root();
60 int i = 0;
61
62 for (i = 0; i < ARRAY_SIZE(board); i++) {
63 if (of_flat_dt_is_compatible(root, board[i])) {
64 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
65 return 1;
66 }
67 }
68
69 return 0;
70}
71
72define_machine(ppc40x_simple) {
73 .name = "PowerPC 40x Platform",
74 .probe = ppc40x_probe,
75 .progress = udbg_progress,
76 .init_IRQ = uic_init_tree,
77 .get_irq = uic_get_irq,
78 .restart = ppc4xx_reset_system,
79 .calibrate_decr = generic_calibrate_decr,
80};
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 79c1154f88d4..3496bc05058e 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -167,6 +167,14 @@ config PPC44x_SIMPLE
167 help 167 help
168 This option enables the simple PowerPC 44x platform support. 168 This option enables the simple PowerPC 44x platform support.
169 169
170config PPC4xx_GPIO
171 bool "PPC4xx GPIO support"
172 depends on 44x
173 select ARCH_REQUIRE_GPIOLIB
174 select GENERIC_GPIO
175 help
176 Enable gpiolib support for ppc440 based boards
177
170# 44x specific CPU modules, selected based on the board above. 178# 44x specific CPU modules, selected based on the board above.
171config 440EP 179config 440EP
172 bool 180 bool
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 044b4e6e8743..ae7c34f37e1c 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -99,11 +99,14 @@ mpc5200_setup_xlb_arbiter(void)
99 out_be32(&xlb->master_pri_enable, 0xff); 99 out_be32(&xlb->master_pri_enable, 0xff);
100 out_be32(&xlb->master_priority, 0x11111111); 100 out_be32(&xlb->master_priority, 0x11111111);
101 101
102 /* Disable XLB pipelining 102 /*
103 * Disable XLB pipelining
103 * (cfr errate 292. We could do this only just before ATA PIO 104 * (cfr errate 292. We could do this only just before ATA PIO
104 * transaction and re-enable it afterwards ...) 105 * transaction and re-enable it afterwards ...)
106 * Not needed on MPC5200B.
105 */ 107 */
106 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS); 108 if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR)
109 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
107 110
108 iounmap(xlb); 111 iounmap(xlb);
109} 112}
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c
index 8a3b117b6ce2..81cee7bbf2d2 100644
--- a/arch/powerpc/platforms/85xx/ksi8560.c
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -193,7 +193,6 @@ static void __init ksi8560_setup_arch(void)
193static void ksi8560_show_cpuinfo(struct seq_file *m) 193static void ksi8560_show_cpuinfo(struct seq_file *m)
194{ 194{
195 uint pvid, svid, phid1; 195 uint pvid, svid, phid1;
196 uint memsize = total_memory;
197 196
198 pvid = mfspr(SPRN_PVR); 197 pvid = mfspr(SPRN_PVR);
199 svid = mfspr(SPRN_SVR); 198 svid = mfspr(SPRN_SVR);
@@ -215,9 +214,6 @@ static void ksi8560_show_cpuinfo(struct seq_file *m)
215 /* Display cpu Pll setting */ 214 /* Display cpu Pll setting */
216 phid1 = mfspr(SPRN_HID1); 215 phid1 = mfspr(SPRN_HID1);
217 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 216 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
218
219 /* Display the amount of memory */
220 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
221} 217}
222 218
223static struct of_device_id __initdata of_bus_ids[] = { 219static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 0293e3d3580f..21f009023e26 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -207,7 +207,6 @@ static void __init mpc85xx_ads_setup_arch(void)
207static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) 207static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
208{ 208{
209 uint pvid, svid, phid1; 209 uint pvid, svid, phid1;
210 uint memsize = total_memory;
211 210
212 pvid = mfspr(SPRN_PVR); 211 pvid = mfspr(SPRN_PVR);
213 svid = mfspr(SPRN_SVR); 212 svid = mfspr(SPRN_SVR);
@@ -219,9 +218,6 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
219 /* Display cpu Pll setting */ 218 /* Display cpu Pll setting */
220 phid1 = mfspr(SPRN_HID1); 219 phid1 = mfspr(SPRN_HID1);
221 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 220 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
222
223 /* Display the amount of memory */
224 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
225} 221}
226 222
227static struct of_device_id __initdata of_bus_ids[] = { 223static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 50d7ea8f922b..aeb6a5bc5522 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -307,7 +307,6 @@ static void __init mpc85xx_cds_setup_arch(void)
307static void mpc85xx_cds_show_cpuinfo(struct seq_file *m) 307static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
308{ 308{
309 uint pvid, svid, phid1; 309 uint pvid, svid, phid1;
310 uint memsize = total_memory;
311 310
312 pvid = mfspr(SPRN_PVR); 311 pvid = mfspr(SPRN_PVR);
313 svid = mfspr(SPRN_SVR); 312 svid = mfspr(SPRN_SVR);
@@ -320,9 +319,6 @@ static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
320 /* Display cpu Pll setting */ 319 /* Display cpu Pll setting */
321 phid1 = mfspr(SPRN_HID1); 320 phid1 = mfspr(SPRN_HID1);
322 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 321 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
323
324 /* Display the amount of memory */
325 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
326} 322}
327 323
328 324
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index b9246ea0928a..7ec77ce12dad 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -136,7 +136,6 @@ static void __init sbc8548_setup_arch(void)
136static void sbc8548_show_cpuinfo(struct seq_file *m) 136static void sbc8548_show_cpuinfo(struct seq_file *m)
137{ 137{
138 uint pvid, svid, phid1; 138 uint pvid, svid, phid1;
139 uint memsize = total_memory;
140 139
141 pvid = mfspr(SPRN_PVR); 140 pvid = mfspr(SPRN_PVR);
142 svid = mfspr(SPRN_SVR); 141 svid = mfspr(SPRN_SVR);
@@ -149,9 +148,6 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
149 /* Display cpu Pll setting */ 148 /* Display cpu Pll setting */
150 phid1 = mfspr(SPRN_HID1); 149 phid1 = mfspr(SPRN_HID1);
151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 150 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
152
153 /* Display the amount of memory */
154 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
155} 151}
156 152
157static struct of_device_id __initdata of_bus_ids[] = { 153static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index 0c9a856f66b6..472f254a19d2 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -194,7 +194,6 @@ static void __init sbc8560_setup_arch(void)
194static void sbc8560_show_cpuinfo(struct seq_file *m) 194static void sbc8560_show_cpuinfo(struct seq_file *m)
195{ 195{
196 uint pvid, svid, phid1; 196 uint pvid, svid, phid1;
197 uint memsize = total_memory;
198 197
199 pvid = mfspr(SPRN_PVR); 198 pvid = mfspr(SPRN_PVR);
200 svid = mfspr(SPRN_SVR); 199 svid = mfspr(SPRN_SVR);
@@ -206,9 +205,6 @@ static void sbc8560_show_cpuinfo(struct seq_file *m)
206 /* Display cpu Pll setting */ 205 /* Display cpu Pll setting */
207 phid1 = mfspr(SPRN_HID1); 206 phid1 = mfspr(SPRN_HID1);
208 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 207 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
209
210 /* Display the amount of memory */
211 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
212} 208}
213 209
214static struct of_device_id __initdata of_bus_ids[] = { 210static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/stx_gp3.c b/arch/powerpc/platforms/85xx/stx_gp3.c
index 18499d7c9d9e..0cca8f5cb272 100644
--- a/arch/powerpc/platforms/85xx/stx_gp3.c
+++ b/arch/powerpc/platforms/85xx/stx_gp3.c
@@ -130,7 +130,6 @@ static void __init stx_gp3_setup_arch(void)
130static void stx_gp3_show_cpuinfo(struct seq_file *m) 130static void stx_gp3_show_cpuinfo(struct seq_file *m)
131{ 131{
132 uint pvid, svid, phid1; 132 uint pvid, svid, phid1;
133 uint memsize = total_memory;
134 133
135 pvid = mfspr(SPRN_PVR); 134 pvid = mfspr(SPRN_PVR);
136 svid = mfspr(SPRN_SVR); 135 svid = mfspr(SPRN_SVR);
@@ -142,9 +141,6 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)
142 /* Display cpu Pll setting */ 141 /* Display cpu Pll setting */
143 phid1 = mfspr(SPRN_HID1); 142 phid1 = mfspr(SPRN_HID1);
144 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 143 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
145
146 /* Display the amount of memory */
147 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
148} 144}
149 145
150static struct of_device_id __initdata of_bus_ids[] = { 146static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index d850880d6964..2933a8e827d9 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -138,7 +138,6 @@ static void __init tqm85xx_setup_arch(void)
138static void tqm85xx_show_cpuinfo(struct seq_file *m) 138static void tqm85xx_show_cpuinfo(struct seq_file *m)
139{ 139{
140 uint pvid, svid, phid1; 140 uint pvid, svid, phid1;
141 uint memsize = total_memory;
142 141
143 pvid = mfspr(SPRN_PVR); 142 pvid = mfspr(SPRN_PVR);
144 svid = mfspr(SPRN_SVR); 143 svid = mfspr(SPRN_SVR);
@@ -150,9 +149,6 @@ static void tqm85xx_show_cpuinfo(struct seq_file *m)
150 /* Display cpu Pll setting */ 149 /* Display cpu Pll setting */
151 phid1 = mfspr(SPRN_HID1); 150 phid1 = mfspr(SPRN_HID1);
152 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
153
154 /* Display the amount of memory */
155 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
156} 152}
157 153
158static struct of_device_id __initdata of_bus_ids[] = { 154static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index 821c45fac18b..fb371f5ce132 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -127,7 +127,6 @@ static unsigned int gef_sbc610_get_fpga_rev(void)
127 127
128static void gef_sbc610_show_cpuinfo(struct seq_file *m) 128static void gef_sbc610_show_cpuinfo(struct seq_file *m)
129{ 129{
130 uint memsize = total_memory;
131 uint svid = mfspr(SPRN_SVR); 130 uint svid = mfspr(SPRN_SVR);
132 131
133 seq_printf(m, "Vendor\t\t: GE Fanuc Intelligent Platforms\n"); 132 seq_printf(m, "Vendor\t\t: GE Fanuc Intelligent Platforms\n");
@@ -137,7 +136,6 @@ static void gef_sbc610_show_cpuinfo(struct seq_file *m)
137 seq_printf(m, "FPGA Revision\t: %u\n", gef_sbc610_get_fpga_rev()); 136 seq_printf(m, "FPGA Revision\t: %u\n", gef_sbc610_get_fpga_rev());
138 137
139 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 138 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
140 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
141} 139}
142 140
143static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev) 141static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev)
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 2672829a71dc..27e0e682d8e1 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -101,13 +101,11 @@ mpc86xx_hpcn_setup_arch(void)
101static void 101static void
102mpc86xx_hpcn_show_cpuinfo(struct seq_file *m) 102mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
103{ 103{
104 uint memsize = total_memory;
105 uint svid = mfspr(SPRN_SVR); 104 uint svid = mfspr(SPRN_SVR);
106 105
107 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); 106 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
108 107
109 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 108 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
110 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
111} 109}
112 110
113 111
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
index da677a74e2d1..5fd7ed40986f 100644
--- a/arch/powerpc/platforms/86xx/sbc8641d.c
+++ b/arch/powerpc/platforms/86xx/sbc8641d.c
@@ -63,13 +63,11 @@ sbc8641_setup_arch(void)
63static void 63static void
64sbc8641_show_cpuinfo(struct seq_file *m) 64sbc8641_show_cpuinfo(struct seq_file *m)
65{ 65{
66 uint memsize = total_memory;
67 uint svid = mfspr(SPRN_SVR); 66 uint svid = mfspr(SPRN_SVR);
68 67
69 seq_printf(m, "Vendor\t\t: Wind River Systems\n"); 68 seq_printf(m, "Vendor\t\t: Wind River Systems\n");
70 69
71 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 70 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
72 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
73} 71}
74 72
75 73
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 2a14b052abcd..665af1c4195b 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -21,6 +21,7 @@
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22#include <asm/rtas.h> 22#include <asm/rtas.h>
23#include <asm/cell-regs.h> 23#include <asm/cell-regs.h>
24#include <asm/kdump.h>
24 25
25#include "ras.h" 26#include "ras.h"
26 27
@@ -111,9 +112,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order)
111 int ret = -ENOMEM; 112 int ret = -ENOMEM;
112 unsigned long addr; 113 unsigned long addr;
113 114
114#ifdef CONFIG_CRASH_DUMP 115 if (__kdump_flag)
115 rtas_call(ptcal_stop_tok, 1, 1, NULL, nid); 116 rtas_call(ptcal_stop_tok, 1, 1, NULL, nid);
116#endif
117 117
118 area = kmalloc(sizeof(*area), GFP_KERNEL); 118 area = kmalloc(sizeof(*area), GFP_KERNEL);
119 if (!area) 119 if (!area)
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index efb3964457b1..c0d86e1f56ea 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -54,8 +54,8 @@
54#endif 54#endif
55 55
56/* 56/*
57 * The primary thread of each non-boot processor is recorded here before 57 * The Primary thread of each non-boot processor was started from the OF client
58 * smp init. 58 * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
59 */ 59 */
60static cpumask_t of_spin_map; 60static cpumask_t of_spin_map;
61 61
@@ -208,11 +208,7 @@ void __init smp_init_cell(void)
208 /* Mark threads which are still spinning in hold loops. */ 208 /* Mark threads which are still spinning in hold loops. */
209 if (cpu_has_feature(CPU_FTR_SMT)) { 209 if (cpu_has_feature(CPU_FTR_SMT)) {
210 for_each_present_cpu(i) { 210 for_each_present_cpu(i) {
211 if (i % 2 == 0) 211 if (cpu_thread_in_core(i) == 0)
212 /*
213 * Even-numbered logical cpus correspond to
214 * primary threads.
215 */
216 cpu_set(i, of_spin_map); 212 cpu_set(i, of_spin_map);
217 } 213 }
218 } else { 214 } else {
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 010a51f59796..b73c369cc6f1 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -548,6 +548,11 @@ spufs_regs_read(struct file *file, char __user *buffer,
548 int ret; 548 int ret;
549 struct spu_context *ctx = file->private_data; 549 struct spu_context *ctx = file->private_data;
550 550
551 /* pre-check for file position: if we'd return EOF, there's no point
552 * causing a deschedule */
553 if (*pos >= sizeof(ctx->csa.lscsa->gprs))
554 return 0;
555
551 ret = spu_acquire_saved(ctx); 556 ret = spu_acquire_saved(ctx);
552 if (ret) 557 if (ret)
553 return ret; 558 return ret;
@@ -2426,38 +2431,49 @@ static inline int spufs_switch_log_avail(struct spu_context *ctx)
2426static int spufs_switch_log_open(struct inode *inode, struct file *file) 2431static int spufs_switch_log_open(struct inode *inode, struct file *file)
2427{ 2432{
2428 struct spu_context *ctx = SPUFS_I(inode)->i_ctx; 2433 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2434 int rc;
2435
2436 rc = spu_acquire(ctx);
2437 if (rc)
2438 return rc;
2429 2439
2430 /*
2431 * We (ab-)use the mapping_lock here because it serves the similar
2432 * purpose for synchronizing open/close elsewhere. Maybe it should
2433 * be renamed eventually.
2434 */
2435 mutex_lock(&ctx->mapping_lock);
2436 if (ctx->switch_log) { 2440 if (ctx->switch_log) {
2437 spin_lock(&ctx->switch_log->lock); 2441 rc = -EBUSY;
2438 ctx->switch_log->head = 0; 2442 goto out;
2439 ctx->switch_log->tail = 0;
2440 spin_unlock(&ctx->switch_log->lock);
2441 } else {
2442 /*
2443 * We allocate the switch log data structures on first open.
2444 * They will never be free because we assume a context will
2445 * be traced until it goes away.
2446 */
2447 ctx->switch_log = kzalloc(sizeof(struct switch_log) +
2448 SWITCH_LOG_BUFSIZE * sizeof(struct switch_log_entry),
2449 GFP_KERNEL);
2450 if (!ctx->switch_log)
2451 goto out;
2452 spin_lock_init(&ctx->switch_log->lock);
2453 init_waitqueue_head(&ctx->switch_log->wait);
2454 } 2443 }
2455 mutex_unlock(&ctx->mapping_lock); 2444
2445 ctx->switch_log = kmalloc(sizeof(struct switch_log) +
2446 SWITCH_LOG_BUFSIZE * sizeof(struct switch_log_entry),
2447 GFP_KERNEL);
2448
2449 if (!ctx->switch_log) {
2450 rc = -ENOMEM;
2451 goto out;
2452 }
2453
2454 ctx->switch_log->head = ctx->switch_log->tail = 0;
2455 init_waitqueue_head(&ctx->switch_log->wait);
2456 rc = 0;
2457
2458out:
2459 spu_release(ctx);
2460 return rc;
2461}
2462
2463static int spufs_switch_log_release(struct inode *inode, struct file *file)
2464{
2465 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2466 int rc;
2467
2468 rc = spu_acquire(ctx);
2469 if (rc)
2470 return rc;
2471
2472 kfree(ctx->switch_log);
2473 ctx->switch_log = NULL;
2474 spu_release(ctx);
2456 2475
2457 return 0; 2476 return 0;
2458 out:
2459 mutex_unlock(&ctx->mapping_lock);
2460 return -ENOMEM;
2461} 2477}
2462 2478
2463static int switch_log_sprint(struct spu_context *ctx, char *tbuf, int n) 2479static int switch_log_sprint(struct spu_context *ctx, char *tbuf, int n)
@@ -2485,42 +2501,54 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
2485 if (!buf || len < 0) 2501 if (!buf || len < 0)
2486 return -EINVAL; 2502 return -EINVAL;
2487 2503
2504 error = spu_acquire(ctx);
2505 if (error)
2506 return error;
2507
2488 while (cnt < len) { 2508 while (cnt < len) {
2489 char tbuf[128]; 2509 char tbuf[128];
2490 int width; 2510 int width;
2491 2511
2492 if (file->f_flags & O_NONBLOCK) { 2512 if (spufs_switch_log_used(ctx) == 0) {
2493 if (spufs_switch_log_used(ctx) <= 0) 2513 if (cnt > 0) {
2494 return cnt ? cnt : -EAGAIN; 2514 /* If there's data ready to go, we can
2495 } else { 2515 * just return straight away */
2496 /* Wait for data in buffer */ 2516 break;
2497 error = wait_event_interruptible(ctx->switch_log->wait, 2517
2498 spufs_switch_log_used(ctx) > 0); 2518 } else if (file->f_flags & O_NONBLOCK) {
2499 if (error) 2519 error = -EAGAIN;
2500 break; 2520 break;
2501 }
2502 2521
2503 spin_lock(&ctx->switch_log->lock); 2522 } else {
2504 if (ctx->switch_log->head == ctx->switch_log->tail) { 2523 /* spufs_wait will drop the mutex and
2505 /* multiple readers race? */ 2524 * re-acquire, but since we're in read(), the
2506 spin_unlock(&ctx->switch_log->lock); 2525 * file cannot be _released (and so
2507 continue; 2526 * ctx->switch_log is stable).
2527 */
2528 error = spufs_wait(ctx->switch_log->wait,
2529 spufs_switch_log_used(ctx) > 0);
2530
2531 /* On error, spufs_wait returns without the
2532 * state mutex held */
2533 if (error)
2534 return error;
2535
2536 /* We may have had entries read from underneath
2537 * us while we dropped the mutex in spufs_wait,
2538 * so re-check */
2539 if (spufs_switch_log_used(ctx) == 0)
2540 continue;
2541 }
2508 } 2542 }
2509 2543
2510 width = switch_log_sprint(ctx, tbuf, sizeof(tbuf)); 2544 width = switch_log_sprint(ctx, tbuf, sizeof(tbuf));
2511 if (width < len) { 2545 if (width < len)
2512 ctx->switch_log->tail = 2546 ctx->switch_log->tail =
2513 (ctx->switch_log->tail + 1) % 2547 (ctx->switch_log->tail + 1) %
2514 SWITCH_LOG_BUFSIZE; 2548 SWITCH_LOG_BUFSIZE;
2515 } 2549 else
2516 2550 /* If the record is greater than space available return
2517 spin_unlock(&ctx->switch_log->lock); 2551 * partial buffer (so far) */
2518
2519 /*
2520 * If the record is greater than space available return
2521 * partial buffer (so far)
2522 */
2523 if (width >= len)
2524 break; 2552 break;
2525 2553
2526 error = copy_to_user(buf + cnt, tbuf, width); 2554 error = copy_to_user(buf + cnt, tbuf, width);
@@ -2529,6 +2557,8 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
2529 cnt += width; 2557 cnt += width;
2530 } 2558 }
2531 2559
2560 spu_release(ctx);
2561
2532 return cnt == 0 ? error : cnt; 2562 return cnt == 0 ? error : cnt;
2533} 2563}
2534 2564
@@ -2537,29 +2567,41 @@ static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait)
2537 struct inode *inode = file->f_path.dentry->d_inode; 2567 struct inode *inode = file->f_path.dentry->d_inode;
2538 struct spu_context *ctx = SPUFS_I(inode)->i_ctx; 2568 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2539 unsigned int mask = 0; 2569 unsigned int mask = 0;
2570 int rc;
2540 2571
2541 poll_wait(file, &ctx->switch_log->wait, wait); 2572 poll_wait(file, &ctx->switch_log->wait, wait);
2542 2573
2574 rc = spu_acquire(ctx);
2575 if (rc)
2576 return rc;
2577
2543 if (spufs_switch_log_used(ctx) > 0) 2578 if (spufs_switch_log_used(ctx) > 0)
2544 mask |= POLLIN; 2579 mask |= POLLIN;
2545 2580
2581 spu_release(ctx);
2582
2546 return mask; 2583 return mask;
2547} 2584}
2548 2585
2549static const struct file_operations spufs_switch_log_fops = { 2586static const struct file_operations spufs_switch_log_fops = {
2550 .owner = THIS_MODULE, 2587 .owner = THIS_MODULE,
2551 .open = spufs_switch_log_open, 2588 .open = spufs_switch_log_open,
2552 .read = spufs_switch_log_read, 2589 .read = spufs_switch_log_read,
2553 .poll = spufs_switch_log_poll, 2590 .poll = spufs_switch_log_poll,
2591 .release = spufs_switch_log_release,
2554}; 2592};
2555 2593
2594/**
2595 * Log a context switch event to a switch log reader.
2596 *
2597 * Must be called with ctx->state_mutex held.
2598 */
2556void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx, 2599void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
2557 u32 type, u32 val) 2600 u32 type, u32 val)
2558{ 2601{
2559 if (!ctx->switch_log) 2602 if (!ctx->switch_log)
2560 return; 2603 return;
2561 2604
2562 spin_lock(&ctx->switch_log->lock);
2563 if (spufs_switch_log_avail(ctx) > 1) { 2605 if (spufs_switch_log_avail(ctx) > 1) {
2564 struct switch_log_entry *p; 2606 struct switch_log_entry *p;
2565 2607
@@ -2573,7 +2615,6 @@ void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
2573 ctx->switch_log->head = 2615 ctx->switch_log->head =
2574 (ctx->switch_log->head + 1) % SWITCH_LOG_BUFSIZE; 2616 (ctx->switch_log->head + 1) % SWITCH_LOG_BUFSIZE;
2575 } 2617 }
2576 spin_unlock(&ctx->switch_log->lock);
2577 2618
2578 wake_up(&ctx->switch_log->wait); 2619 wake_up(&ctx->switch_log->wait);
2579} 2620}
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index c9bb7cfd3dca..c58bd36b0c5b 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -249,6 +249,7 @@ static int spu_run_fini(struct spu_context *ctx, u32 *npc,
249 249
250 spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED); 250 spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED);
251 clear_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags); 251 clear_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags);
252 spu_switch_log_notify(NULL, ctx, SWITCH_LOG_EXIT, *status);
252 spu_release(ctx); 253 spu_release(ctx);
253 254
254 if (signal_pending(current)) 255 if (signal_pending(current))
@@ -417,8 +418,6 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event)
417 ret = spu_run_fini(ctx, npc, &status); 418 ret = spu_run_fini(ctx, npc, &status);
418 spu_yield(ctx); 419 spu_yield(ctx);
419 420
420 spu_switch_log_notify(NULL, ctx, SWITCH_LOG_EXIT, status);
421
422 if ((status & SPU_STATUS_STOPPED_BY_STOP) && 421 if ((status & SPU_STATUS_STOPPED_BY_STOP) &&
423 (((status >> SPU_STOP_STATUS_SHIFT) & 0x3f00) == 0x2100)) 422 (((status >> SPU_STOP_STATUS_SHIFT) & 0x3f00) == 0x2100))
424 ctx->stats.libassist++; 423 ctx->stats.libassist++;
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 67595bc380dc..2ad914c47493 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -312,6 +312,15 @@ static struct spu *aff_ref_location(struct spu_context *ctx, int mem_aff,
312 */ 312 */
313 node = cpu_to_node(raw_smp_processor_id()); 313 node = cpu_to_node(raw_smp_processor_id());
314 for (n = 0; n < MAX_NUMNODES; n++, node++) { 314 for (n = 0; n < MAX_NUMNODES; n++, node++) {
315 /*
316 * "available_spus" counts how many spus are not potentially
317 * going to be used by other affinity gangs whose reference
318 * context is already in place. Although this code seeks to
319 * avoid having affinity gangs with a summed amount of
320 * contexts bigger than the amount of spus in the node,
321 * this may happen sporadically. In this case, available_spus
322 * becomes negative, which is harmless.
323 */
315 int available_spus; 324 int available_spus;
316 325
317 node = (node < MAX_NUMNODES) ? node : 0; 326 node = (node < MAX_NUMNODES) ? node : 0;
@@ -321,12 +330,10 @@ static struct spu *aff_ref_location(struct spu_context *ctx, int mem_aff,
321 available_spus = 0; 330 available_spus = 0;
322 mutex_lock(&cbe_spu_info[node].list_mutex); 331 mutex_lock(&cbe_spu_info[node].list_mutex);
323 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) { 332 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
324 if (spu->ctx && spu->ctx->gang 333 if (spu->ctx && spu->ctx->gang && !spu->ctx->aff_offset
325 && spu->ctx->aff_offset == 0) 334 && spu->ctx->gang->aff_ref_spu)
326 available_spus -= 335 available_spus -= spu->ctx->gang->contexts;
327 (spu->ctx->gang->contexts - 1); 336 available_spus++;
328 else
329 available_spus++;
330 } 337 }
331 if (available_spus < ctx->gang->contexts) { 338 if (available_spus < ctx->gang->contexts) {
332 mutex_unlock(&cbe_spu_info[node].list_mutex); 339 mutex_unlock(&cbe_spu_info[node].list_mutex);
@@ -437,6 +444,11 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx)
437 atomic_dec(&cbe_spu_info[spu->node].reserved_spus); 444 atomic_dec(&cbe_spu_info[spu->node].reserved_spus);
438 445
439 if (ctx->gang) 446 if (ctx->gang)
447 /*
448 * If ctx->gang->aff_sched_count is positive, SPU affinity is
449 * being considered in this gang. Using atomic_dec_if_positive
450 * allow us to skip an explicit check for affinity in this gang
451 */
440 atomic_dec_if_positive(&ctx->gang->aff_sched_count); 452 atomic_dec_if_positive(&ctx->gang->aff_sched_count);
441 453
442 spu_switch_notify(spu, NULL); 454 spu_switch_notify(spu, NULL);
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 8ae8ef9dfc22..15c62d3ca129 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -65,7 +65,6 @@ enum {
65}; 65};
66 66
67struct switch_log { 67struct switch_log {
68 spinlock_t lock;
69 wait_queue_head_t wait; 68 wait_queue_head_t wait;
70 unsigned long head; 69 unsigned long head;
71 unsigned long tail; 70 unsigned long tail;
diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c
index 2ece399f2862..d0b1f3f4d9c8 100644
--- a/arch/powerpc/platforms/cell/spufs/sputrace.c
+++ b/arch/powerpc/platforms/cell/spufs/sputrace.c
@@ -40,6 +40,7 @@ static DECLARE_WAIT_QUEUE_HEAD(sputrace_wait);
40static ktime_t sputrace_start; 40static ktime_t sputrace_start;
41static unsigned long sputrace_head, sputrace_tail; 41static unsigned long sputrace_head, sputrace_tail;
42static struct sputrace *sputrace_log; 42static struct sputrace *sputrace_log;
43static int sputrace_logging;
43 44
44static int sputrace_used(void) 45static int sputrace_used(void)
45{ 46{
@@ -79,6 +80,11 @@ static ssize_t sputrace_read(struct file *file, char __user *buf,
79 char tbuf[128]; 80 char tbuf[128];
80 int width; 81 int width;
81 82
83 /* If we have data ready to return, don't block waiting
84 * for more */
85 if (cnt > 0 && sputrace_used() == 0)
86 break;
87
82 error = wait_event_interruptible(sputrace_wait, 88 error = wait_event_interruptible(sputrace_wait,
83 sputrace_used() > 0); 89 sputrace_used() > 0);
84 if (error) 90 if (error)
@@ -109,24 +115,49 @@ static ssize_t sputrace_read(struct file *file, char __user *buf,
109 115
110static int sputrace_open(struct inode *inode, struct file *file) 116static int sputrace_open(struct inode *inode, struct file *file)
111{ 117{
118 int rc;
119
112 spin_lock(&sputrace_lock); 120 spin_lock(&sputrace_lock);
121 if (sputrace_logging) {
122 rc = -EBUSY;
123 goto out;
124 }
125
126 sputrace_logging = 1;
113 sputrace_head = sputrace_tail = 0; 127 sputrace_head = sputrace_tail = 0;
114 sputrace_start = ktime_get(); 128 sputrace_start = ktime_get();
129 rc = 0;
130
131out:
115 spin_unlock(&sputrace_lock); 132 spin_unlock(&sputrace_lock);
133 return rc;
134}
116 135
136static int sputrace_release(struct inode *inode, struct file *file)
137{
138 spin_lock(&sputrace_lock);
139 sputrace_logging = 0;
140 spin_unlock(&sputrace_lock);
117 return 0; 141 return 0;
118} 142}
119 143
120static const struct file_operations sputrace_fops = { 144static const struct file_operations sputrace_fops = {
121 .owner = THIS_MODULE, 145 .owner = THIS_MODULE,
122 .open = sputrace_open, 146 .open = sputrace_open,
123 .read = sputrace_read, 147 .read = sputrace_read,
148 .release = sputrace_release,
124}; 149};
125 150
126static void sputrace_log_item(const char *name, struct spu_context *ctx, 151static void sputrace_log_item(const char *name, struct spu_context *ctx,
127 struct spu *spu) 152 struct spu *spu)
128{ 153{
129 spin_lock(&sputrace_lock); 154 spin_lock(&sputrace_lock);
155
156 if (!sputrace_logging) {
157 spin_unlock(&sputrace_lock);
158 return;
159 }
160
130 if (sputrace_avail() > 1) { 161 if (sputrace_avail() > 1) {
131 struct sputrace *t = sputrace_log + sputrace_head; 162 struct sputrace *t = sputrace_log + sputrace_head;
132 163
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 49c87769b1f8..c23617c6baf3 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -69,9 +69,9 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
69 if (!IS_ERR(tmp)) { 69 if (!IS_ERR(tmp)) {
70 struct nameidata nd; 70 struct nameidata nd;
71 71
72 ret = path_lookup(tmp, LOOKUP_PARENT| 72 ret = path_lookup(tmp, LOOKUP_PARENT, &nd);
73 LOOKUP_OPEN|LOOKUP_CREATE, &nd);
74 if (!ret) { 73 if (!ret) {
74 nd.flags |= LOOKUP_OPEN | LOOKUP_CREATE;
75 ret = spufs_create(&nd, flags, mode, neighbor); 75 ret = spufs_create(&nd, flags, mode, neighbor);
76 path_put(&nd.path); 76 path_put(&nd.path);
77 } 77 }
diff --git a/arch/powerpc/platforms/embedded6xx/c2k.c b/arch/powerpc/platforms/embedded6xx/c2k.c
index d0b25b8c39d1..32ba0fa0ad03 100644
--- a/arch/powerpc/platforms/embedded6xx/c2k.c
+++ b/arch/powerpc/platforms/embedded6xx/c2k.c
@@ -116,10 +116,7 @@ static void c2k_restart(char *cmd)
116 116
117void c2k_show_cpuinfo(struct seq_file *m) 117void c2k_show_cpuinfo(struct seq_file *m)
118{ 118{
119 uint memsize = total_memory;
120
121 seq_printf(m, "Vendor\t\t: GEFanuc\n"); 119 seq_printf(m, "Vendor\t\t: GEFanuc\n");
122 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
123 seq_printf(m, "coherency\t: %s\n", COHERENCY_SETTING); 120 seq_printf(m, "coherency\t: %s\n", COHERENCY_SETTING);
124} 121}
125 122
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index 5a19b9a1457c..4c485e984236 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -119,10 +119,7 @@ static void prpmc2800_restart(char *cmd)
119 119
120void prpmc2800_show_cpuinfo(struct seq_file *m) 120void prpmc2800_show_cpuinfo(struct seq_file *m)
121{ 121{
122 uint memsize = total_memory;
123
124 seq_printf(m, "Vendor\t\t: Motorola\n"); 122 seq_printf(m, "Vendor\t\t: Motorola\n");
125 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
126 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING); 123 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING);
127} 124}
128 125
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 140d02a5232a..a623ad256e9e 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -22,6 +22,12 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
22 int ret; 22 int ret;
23 23
24 start_pfn = base >> PAGE_SHIFT; 24 start_pfn = base >> PAGE_SHIFT;
25
26 if (!pfn_valid(start_pfn)) {
27 lmb_remove(base, lmb_size);
28 return 0;
29 }
30
25 zone = page_zone(pfn_to_page(start_pfn)); 31 zone = page_zone(pfn_to_page(start_pfn));
26 32
27 /* 33 /*
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index a8c446697f9e..d56491d182d3 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -44,6 +44,7 @@
44#include <asm/tce.h> 44#include <asm/tce.h>
45#include <asm/ppc-pci.h> 45#include <asm/ppc-pci.h>
46#include <asm/udbg.h> 46#include <asm/udbg.h>
47#include <asm/kdump.h>
47 48
48#include "plpar_wrappers.h" 49#include "plpar_wrappers.h"
49 50
@@ -291,9 +292,8 @@ static void iommu_table_setparms(struct pci_controller *phb,
291 292
292 tbl->it_base = (unsigned long)__va(*basep); 293 tbl->it_base = (unsigned long)__va(*basep);
293 294
294#ifndef CONFIG_CRASH_DUMP 295 if (!__kdump_flag)
295 memset((void *)tbl->it_base, 0, *sizep); 296 memset((void *)tbl->it_base, 0, *sizep);
296#endif
297 297
298 tbl->it_busno = phb->bus->number; 298 tbl->it_busno = phb->bus->number;
299 299
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index e00f96baa381..1a231c389ba0 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -52,8 +52,8 @@
52 52
53 53
54/* 54/*
55 * The primary thread of each non-boot processor is recorded here before 55 * The Primary thread of each non-boot processor was started from the OF client
56 * smp init. 56 * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
57 */ 57 */
58static cpumask_t of_spin_map; 58static cpumask_t of_spin_map;
59 59
@@ -161,8 +161,7 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
161static int smp_pSeries_cpu_bootable(unsigned int nr) 161static int smp_pSeries_cpu_bootable(unsigned int nr)
162{ 162{
163 /* Special case - we inhibit secondary thread startup 163 /* Special case - we inhibit secondary thread startup
164 * during boot if the user requests it. Odd-numbered 164 * during boot if the user requests it.
165 * cpus are assumed to be secondary threads.
166 */ 165 */
167 if (system_state < SYSTEM_RUNNING && 166 if (system_state < SYSTEM_RUNNING &&
168 cpu_has_feature(CPU_FTR_SMT) && 167 cpu_has_feature(CPU_FTR_SMT) &&
@@ -199,11 +198,7 @@ static void __init smp_init_pseries(void)
199 /* Mark threads which are still spinning in hold loops. */ 198 /* Mark threads which are still spinning in hold loops. */
200 if (cpu_has_feature(CPU_FTR_SMT)) { 199 if (cpu_has_feature(CPU_FTR_SMT)) {
201 for_each_present_cpu(i) { 200 for_each_present_cpu(i) {
202 if (i % 2 == 0) 201 if (cpu_thread_in_core(i) == 0)
203 /*
204 * Even-numbered logical cpus correspond to
205 * primary threads.
206 */
207 cpu_set(i, of_spin_map); 202 cpu_set(i, of_spin_map);
208 } 203 }
209 } else { 204 } else {