15 #include <linux/sched.h>
17 #include <linux/slab.h>
21 #include <asm/paravirt.h>
23 #include <asm/pgtable.h>
29 #include <asm/xen/interface.h>
30 #include <asm/xen/hypercall.h>
34 #include <xen/events.h>
81 notify_cpu_starting(cpu);
95 static void __cpuinit cpu_bringup_and_idle(
void)
104 const char *resched_name, *callfunc_name, *debug_name;
109 xen_reschedule_interrupt,
120 xen_call_function_interrupt,
139 xen_call_function_single_interrupt,
145 per_cpu(xen_callfuncsingle_irq, cpu) =
rc;
150 xen_irq_work_interrupt,
161 if (
per_cpu(xen_resched_irq, cpu) >= 0)
163 if (
per_cpu(xen_callfunc_irq, cpu) >= 0)
165 if (
per_cpu(xen_debug_irq, cpu) >= 0)
167 if (
per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
170 if (
per_cpu(xen_irq_work, cpu) >= 0)
176 static void __init xen_fill_possible_map(
void)
192 static void __init xen_filter_cpu_maps(
void)
195 unsigned int subtract = 0;
202 for (i = 0; i < nr_cpu_ids; i++) {
213 #ifdef CONFIG_HOTPLUG_CPU
223 nr_cpu_ids = nr_cpu_ids - subtract;
228 static void __init xen_smp_prepare_boot_cpu(
void)
237 xen_filter_cpu_maps();
241 static void __init xen_smp_prepare_cpus(
unsigned int max_cpus)
247 char *
m = (max_cpus == 0) ?
248 "The nosmp parameter is incompatible with Xen; " \
249 "use Xen dom0_max_vcpus=1 parameter" :
250 "The noapic parameter is incompatible with Xen";
271 panic(
"could not allocate xen_cpu_initialized_map\n");
291 unsigned long gdt_mfn;
300 gdt = get_cpu_gdt_table(cpu);
308 ctxt->
user_regs.gs = __KERNEL_STACK_CANARY;
310 ctxt->gs_base_kernel = per_cpu_offset(cpu);
361 clear_tsk_thread_flag(idle,
TIF_FORK);
373 per_cpu(xen_vcpu, cpu)->evtchn_upcall_mask = 1;
375 rc = cpu_initialize_context(cpu, idle);
381 alternatives_enable_smp();
398 static void xen_smp_cpus_done(
unsigned int max_cpus)
402 #ifdef CONFIG_HOTPLUG_CPU
403 static int xen_cpu_disable(
void)
409 cpu_disable_common();
415 static void xen_cpu_die(
unsigned int cpu)
430 static void __cpuinit xen_play_dead(
void)
445 static int xen_cpu_disable(
void)
450 static void xen_cpu_die(
unsigned int cpu)
455 static void xen_play_dead(
void)
461 static void stop_self(
void *
v)
475 static void xen_stop_other_cpus(
int wait)
480 static void xen_smp_send_reschedule(
int cpu)
485 static void __xen_send_IPI_mask(
const struct cpumask *
mask,
509 static void xen_smp_send_call_function_single_ipi(
int cpu)
515 static inline int xen_map_vector(
int vector)
544 int xen_vector = xen_map_vector(vector);
547 __xen_send_IPI_mask(mask, xen_vector);
552 int xen_vector = xen_map_vector(vector);
560 int xen_vector = xen_map_vector(vector);
579 xen_smp_send_call_function_single_ipi(cpu);
585 int xen_vector = xen_map_vector(vector);
594 generic_smp_call_function_interrupt();
604 generic_smp_call_function_single_interrupt();
622 .smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
623 .smp_prepare_cpus = xen_smp_prepare_cpus,
624 .smp_cpus_done = xen_smp_cpus_done,
626 .cpu_up = xen_cpu_up,
627 .cpu_die = xen_cpu_die,
628 .cpu_disable = xen_cpu_disable,
629 .play_dead = xen_play_dead,
631 .stop_other_cpus = xen_stop_other_cpus,
632 .smp_send_reschedule = xen_smp_send_reschedule,
634 .send_call_func_ipi = xen_smp_send_call_function_ipi,
635 .send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
641 xen_fill_possible_map();
645 static void __init xen_hvm_smp_prepare_cpus(
unsigned int max_cpus)
661 static void xen_hvm_cpu_die(
unsigned int cpu)