diff options
Diffstat (limited to 'arch/x86/xen/smp.c')
-rw-r--r-- | arch/x86/xen/smp.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index fe03eeed7b48..a29693fd3138 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/slab.h> | ||
17 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
18 | 19 | ||
19 | #include <asm/paravirt.h> | 20 | #include <asm/paravirt.h> |
@@ -35,10 +36,10 @@ | |||
35 | 36 | ||
36 | cpumask_var_t xen_cpu_initialized_map; | 37 | cpumask_var_t xen_cpu_initialized_map; |
37 | 38 | ||
38 | static DEFINE_PER_CPU(int, resched_irq); | 39 | static DEFINE_PER_CPU(int, xen_resched_irq); |
39 | static DEFINE_PER_CPU(int, callfunc_irq); | 40 | static DEFINE_PER_CPU(int, xen_callfunc_irq); |
40 | static DEFINE_PER_CPU(int, callfuncsingle_irq); | 41 | static DEFINE_PER_CPU(int, xen_callfuncsingle_irq); |
41 | static DEFINE_PER_CPU(int, debug_irq) = -1; | 42 | static DEFINE_PER_CPU(int, xen_debug_irq) = -1; |
42 | 43 | ||
43 | static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id); | 44 | static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id); |
44 | static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); | 45 | static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); |
@@ -73,7 +74,7 @@ static __cpuinit void cpu_bringup(void) | |||
73 | 74 | ||
74 | xen_setup_cpu_clockevents(); | 75 | xen_setup_cpu_clockevents(); |
75 | 76 | ||
76 | cpu_set(cpu, cpu_online_map); | 77 | set_cpu_online(cpu, true); |
77 | percpu_write(cpu_state, CPU_ONLINE); | 78 | percpu_write(cpu_state, CPU_ONLINE); |
78 | wmb(); | 79 | wmb(); |
79 | 80 | ||
@@ -103,7 +104,7 @@ static int xen_smp_intr_init(unsigned int cpu) | |||
103 | NULL); | 104 | NULL); |
104 | if (rc < 0) | 105 | if (rc < 0) |
105 | goto fail; | 106 | goto fail; |
106 | per_cpu(resched_irq, cpu) = rc; | 107 | per_cpu(xen_resched_irq, cpu) = rc; |
107 | 108 | ||
108 | callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu); | 109 | callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu); |
109 | rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, | 110 | rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, |
@@ -114,7 +115,7 @@ static int xen_smp_intr_init(unsigned int cpu) | |||
114 | NULL); | 115 | NULL); |
115 | if (rc < 0) | 116 | if (rc < 0) |
116 | goto fail; | 117 | goto fail; |
117 | per_cpu(callfunc_irq, cpu) = rc; | 118 | per_cpu(xen_callfunc_irq, cpu) = rc; |
118 | 119 | ||
119 | debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); | 120 | debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); |
120 | rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, | 121 | rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, |
@@ -122,7 +123,7 @@ static int xen_smp_intr_init(unsigned int cpu) | |||
122 | debug_name, NULL); | 123 | debug_name, NULL); |
123 | if (rc < 0) | 124 | if (rc < 0) |
124 | goto fail; | 125 | goto fail; |
125 | per_cpu(debug_irq, cpu) = rc; | 126 | per_cpu(xen_debug_irq, cpu) = rc; |
126 | 127 | ||
127 | callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); | 128 | callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); |
128 | rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, | 129 | rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, |
@@ -133,19 +134,20 @@ static int xen_smp_intr_init(unsigned int cpu) | |||
133 | NULL); | 134 | NULL); |
134 | if (rc < 0) | 135 | if (rc < 0) |
135 | goto fail; | 136 | goto fail; |
136 | per_cpu(callfuncsingle_irq, cpu) = rc; | 137 | per_cpu(xen_callfuncsingle_irq, cpu) = rc; |
137 | 138 | ||
138 | return 0; | 139 | return 0; |
139 | 140 | ||
140 | fail: | 141 | fail: |
141 | if (per_cpu(resched_irq, cpu) >= 0) | 142 | if (per_cpu(xen_resched_irq, cpu) >= 0) |
142 | unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL); | 143 | unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL); |
143 | if (per_cpu(callfunc_irq, cpu) >= 0) | 144 | if (per_cpu(xen_callfunc_irq, cpu) >= 0) |
144 | unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL); | 145 | unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL); |
145 | if (per_cpu(debug_irq, cpu) >= 0) | 146 | if (per_cpu(xen_debug_irq, cpu) >= 0) |
146 | unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL); | 147 | unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL); |
147 | if (per_cpu(callfuncsingle_irq, cpu) >= 0) | 148 | if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0) |
148 | unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL); | 149 | unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), |
150 | NULL); | ||
149 | 151 | ||
150 | return rc; | 152 | return rc; |
151 | } | 153 | } |
@@ -295,6 +297,7 @@ static int __cpuinit xen_cpu_up(unsigned int cpu) | |||
295 | (unsigned long)task_stack_page(idle) - | 297 | (unsigned long)task_stack_page(idle) - |
296 | KERNEL_STACK_OFFSET + THREAD_SIZE; | 298 | KERNEL_STACK_OFFSET + THREAD_SIZE; |
297 | #endif | 299 | #endif |
300 | xen_setup_runstate_info(cpu); | ||
298 | xen_setup_timer(cpu); | 301 | xen_setup_timer(cpu); |
299 | xen_init_lock_cpu(cpu); | 302 | xen_init_lock_cpu(cpu); |
300 | 303 | ||
@@ -348,10 +351,10 @@ static void xen_cpu_die(unsigned int cpu) | |||
348 | current->state = TASK_UNINTERRUPTIBLE; | 351 | current->state = TASK_UNINTERRUPTIBLE; |
349 | schedule_timeout(HZ/10); | 352 | schedule_timeout(HZ/10); |
350 | } | 353 | } |
351 | unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL); | 354 | unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL); |
352 | unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL); | 355 | unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL); |
353 | unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL); | 356 | unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL); |
354 | unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL); | 357 | unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL); |
355 | xen_uninit_lock_cpu(cpu); | 358 | xen_uninit_lock_cpu(cpu); |
356 | xen_teardown_timer(cpu); | 359 | xen_teardown_timer(cpu); |
357 | 360 | ||
@@ -359,7 +362,7 @@ static void xen_cpu_die(unsigned int cpu) | |||
359 | alternatives_smp_switch(0); | 362 | alternatives_smp_switch(0); |
360 | } | 363 | } |
361 | 364 | ||
362 | static void __cpuinit xen_play_dead(void) /* used only with CPU_HOTPLUG */ | 365 | static void __cpuinit xen_play_dead(void) /* used only with HOTPLUG_CPU */ |
363 | { | 366 | { |
364 | play_dead_common(); | 367 | play_dead_common(); |
365 | HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); | 368 | HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); |