12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/sched.h>
25 #include <asm/machdep.h>
26 #include <asm/cputable.h>
29 #include <asm/vdso_datapage.h>
38 #define DBG(fmt...) udbg_printf(fmt)
49 static int pnv_smp_cpu_bootable(
unsigned int nr)
67 unsigned int pcpu = get_hard_smp_processor_id(nr);
68 unsigned long start_here =
__pa(*((
unsigned long *)
69 generic_secondary_smp_init));
77 if (!
paca[nr].cpu_start && firmware_has_feature(FW_FEATURE_OPALv2)) {
78 pr_devel(
"OPAL: Starting CPU %d (HW 0x%x)...\n", nr, pcpu);
81 pr_warn(
"OPAL Error %ld starting CPU %d\n",
84 return smp_generic_kick_cpu(nr);
87 #ifdef CONFIG_HOTPLUG_CPU
89 static int pnv_smp_cpu_disable(
void)
105 static void pnv_smp_cpu_kill_self(
void)
114 DBG(
"CPU%d offline\n", cpu);
115 generic_set_cpu_dead(cpu);
122 while (!generic_check_cpu_restart(cpu)) {
124 if (!generic_check_cpu_restart(cpu)) {
125 DBG(
"CPU%d Unexpected exit while offline !\n", cpu);
134 mtspr(SPRN_LPCR,
mfspr(SPRN_LPCR) | LPCR_PECE1);
135 DBG(
"CPU%d coming online...\n", cpu);
140 static struct smp_ops_t pnv_smp_ops = {
141 .message_pass = smp_muxed_ipi_message_pass,
145 .setup_cpu = pnv_smp_setup_cpu,
146 .cpu_bootable = pnv_smp_cpu_bootable,
147 #ifdef CONFIG_HOTPLUG_CPU
148 .cpu_disable = pnv_smp_cpu_disable,
149 .cpu_die = generic_cpu_die,
162 #ifdef CONFIG_PPC_RTAS
164 if (
rtas_token(
"freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
170 #ifdef CONFIG_HOTPLUG_CPU
171 ppc_md.cpu_die = pnv_smp_cpu_kill_self;