16 #include <linux/kernel.h>
17 #include <linux/sched.h>
25 #include <linux/device.h>
28 #include <asm/ptrace.h>
32 #include <asm/pgtable.h>
37 #include <asm/machdep.h>
38 #include <asm/cputable.h>
43 #include <asm/vdso_datapage.h>
62 int qcss_tok =
rtas_token(
"query-cpu-stopped-state");
64 if (qcss_tok == RTAS_UNKNOWN_SERVICE) {
66 "Firmware doesn't support query-cpu-stopped-state\n");
70 status =
rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
73 "RTAS query-cpu-stopped-state failed: %i\n", status);
91 static inline int __devinit smp_startup_cpu(
unsigned int lcpu)
94 unsigned long start_here =
__pa((
u32)*((
unsigned long *)
95 generic_secondary_smp_init));
103 pcpu = get_hard_smp_processor_id(lcpu);
107 cpumask_set_cpu(lcpu, of_spin_mask);
113 #ifdef CONFIG_HOTPLUG_CPU
122 if (start_cpu == RTAS_UNKNOWN_SERVICE)
125 status =
rtas_call(start_cpu, 3, 1,
NULL, pcpu, start_here, pcpu);
131 #ifdef CONFIG_HOTPLUG_CPU
142 if (firmware_has_feature(FW_FEATURE_SPLPAR))
145 cpumask_clear_cpu(cpu, of_spin_mask);
146 #ifdef CONFIG_HOTPLUG_CPU
156 if (!smp_startup_cpu(nr))
165 #ifdef CONFIG_HOTPLUG_CPU
170 unsigned long hcpuid;
172 hcpuid = get_hard_smp_processor_id(nr);
173 rc = plpar_hcall_norets(H_PROD, hcpuid);
176 "Ret= %ld\n", nr, rc);
183 static int smp_pSeries_cpu_bootable(
unsigned int nr)
199 static struct smp_ops_t pSeries_mpic_smp_ops = {
200 .message_pass = smp_mpic_message_pass,
201 .probe = smp_mpic_probe,
202 .kick_cpu = smp_pSeries_kick_cpu,
203 .setup_cpu = smp_mpic_setup_cpu,
206 static struct smp_ops_t pSeries_xics_smp_ops = {
207 .message_pass =
NULL,
210 .kick_cpu = smp_pSeries_kick_cpu,
211 .setup_cpu = smp_xics_setup_cpu,
212 .cpu_bootable = smp_pSeries_cpu_bootable,
216 static void __init smp_init_pseries(
void)
220 pr_debug(
" -> smp_init_pSeries()\n");
222 alloc_bootmem_cpumask_var(&of_spin_mask);
227 if (cpu_thread_in_core(i) == 0)
228 cpumask_set_cpu(i, of_spin_mask);
231 cpumask_copy(of_spin_mask, cpu_present_mask);
237 if (
rtas_token(
"freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
242 pr_debug(
" <- smp_init_pSeries()\n");
247 smp_ops = &pSeries_mpic_smp_ops;
254 smp_ops = &pSeries_xics_smp_ops;