aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/iSeries_smp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ppc64/kernel/iSeries_smp.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/ppc64/kernel/iSeries_smp.c')
-rw-r--r--arch/ppc64/kernel/iSeries_smp.c151
1 files changed, 151 insertions, 0 deletions
diff --git a/arch/ppc64/kernel/iSeries_smp.c b/arch/ppc64/kernel/iSeries_smp.c
new file mode 100644
index 000000000000..ba1f084d5462
--- /dev/null
+++ b/arch/ppc64/kernel/iSeries_smp.c
@@ -0,0 +1,151 @@
1/*
2 * SMP support for iSeries machines.
3 *
4 * Dave Engebretsen, Peter Bergner, and
5 * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
6 *
7 * Plus various changes from other IBM teams...
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#undef DEBUG
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/sched.h>
21#include <linux/smp.h>
22#include <linux/smp_lock.h>
23#include <linux/interrupt.h>
24#include <linux/kernel_stat.h>
25#include <linux/delay.h>
26#include <linux/init.h>
27#include <linux/spinlock.h>
28#include <linux/cache.h>
29#include <linux/err.h>
30#include <linux/sysdev.h>
31#include <linux/cpu.h>
32
33#include <asm/ptrace.h>
34#include <asm/atomic.h>
35#include <asm/irq.h>
36#include <asm/page.h>
37#include <asm/pgtable.h>
38#include <asm/io.h>
39#include <asm/smp.h>
40#include <asm/paca.h>
41#include <asm/iSeries/LparData.h>
42#include <asm/iSeries/HvCall.h>
43#include <asm/iSeries/HvCallCfg.h>
44#include <asm/time.h>
45#include <asm/ppcdebug.h>
46#include <asm/machdep.h>
47#include <asm/cputable.h>
48#include <asm/system.h>
49
50static unsigned long iSeries_smp_message[NR_CPUS];
51
52void iSeries_smp_message_recv( struct pt_regs * regs )
53{
54 int cpu = smp_processor_id();
55 int msg;
56
57 if ( num_online_cpus() < 2 )
58 return;
59
60 for ( msg = 0; msg < 4; ++msg )
61 if ( test_and_clear_bit( msg, &iSeries_smp_message[cpu] ) )
62 smp_message_recv( msg, regs );
63}
64
65static inline void smp_iSeries_do_message(int cpu, int msg)
66{
67 set_bit(msg, &iSeries_smp_message[cpu]);
68 HvCall_sendIPI(&(paca[cpu]));
69}
70
71static void smp_iSeries_message_pass(int target, int msg)
72{
73 int i;
74
75 if (target < NR_CPUS)
76 smp_iSeries_do_message(target, msg);
77 else {
78 for_each_online_cpu(i) {
79 if (target == MSG_ALL_BUT_SELF
80 && i == smp_processor_id())
81 continue;
82 smp_iSeries_do_message(i, msg);
83 }
84 }
85}
86
87static int smp_iSeries_numProcs(void)
88{
89 unsigned np, i;
90
91 np = 0;
92 for (i=0; i < NR_CPUS; ++i) {
93 if (paca[i].lppaca.dyn_proc_status < 2) {
94 cpu_set(i, cpu_possible_map);
95 cpu_set(i, cpu_present_map);
96 cpu_set(i, cpu_sibling_map[i]);
97 ++np;
98 }
99 }
100 return np;
101}
102
103static int smp_iSeries_probe(void)
104{
105 unsigned i;
106 unsigned np = 0;
107
108 for (i=0; i < NR_CPUS; ++i) {
109 if (paca[i].lppaca.dyn_proc_status < 2) {
110 /*paca[i].active = 1;*/
111 ++np;
112 }
113 }
114
115 return np;
116}
117
118static void smp_iSeries_kick_cpu(int nr)
119{
120 BUG_ON(nr < 0 || nr >= NR_CPUS);
121
122 /* Verify that our partition has a processor nr */
123 if (paca[nr].lppaca.dyn_proc_status >= 2)
124 return;
125
126 /* The processor is currently spinning, waiting
127 * for the cpu_start field to become non-zero
128 * After we set cpu_start, the processor will
129 * continue on to secondary_start in iSeries_head.S
130 */
131 paca[nr].cpu_start = 1;
132}
133
134static void __devinit smp_iSeries_setup_cpu(int nr)
135{
136}
137
138static struct smp_ops_t iSeries_smp_ops = {
139 .message_pass = smp_iSeries_message_pass,
140 .probe = smp_iSeries_probe,
141 .kick_cpu = smp_iSeries_kick_cpu,
142 .setup_cpu = smp_iSeries_setup_cpu,
143};
144
145/* This is called very early. */
146void __init smp_init_iSeries(void)
147{
148 smp_ops = &iSeries_smp_ops;
149 systemcfg->processorCount = smp_iSeries_numProcs();
150}
151