diff options
-rw-r--r-- | arch/x86/include/asm/kvm_para.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/kvm.c | 11 | ||||
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 13 |
3 files changed, 13 insertions, 12 deletions
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h index 7b562b6184bc..e3faaaf4301e 100644 --- a/arch/x86/include/asm/kvm_para.h +++ b/arch/x86/include/asm/kvm_para.h | |||
@@ -65,6 +65,7 @@ struct kvm_mmu_op_release_pt { | |||
65 | #include <asm/processor.h> | 65 | #include <asm/processor.h> |
66 | 66 | ||
67 | extern void kvmclock_init(void); | 67 | extern void kvmclock_init(void); |
68 | extern int kvm_register_clock(char *txt); | ||
68 | 69 | ||
69 | 70 | ||
70 | /* This instruction is vmcall. On non-VT architectures, it will generate a | 71 | /* This instruction is vmcall. On non-VT architectures, it will generate a |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 63b0ec8d3d4a..e6db17976b82 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -231,10 +231,21 @@ static void __init paravirt_ops_setup(void) | |||
231 | #endif | 231 | #endif |
232 | } | 232 | } |
233 | 233 | ||
234 | #ifdef CONFIG_SMP | ||
235 | static void __init kvm_smp_prepare_boot_cpu(void) | ||
236 | { | ||
237 | WARN_ON(kvm_register_clock("primary cpu clock")); | ||
238 | native_smp_prepare_boot_cpu(); | ||
239 | } | ||
240 | #endif | ||
241 | |||
234 | void __init kvm_guest_init(void) | 242 | void __init kvm_guest_init(void) |
235 | { | 243 | { |
236 | if (!kvm_para_available()) | 244 | if (!kvm_para_available()) |
237 | return; | 245 | return; |
238 | 246 | ||
239 | paravirt_ops_setup(); | 247 | paravirt_ops_setup(); |
248 | #ifdef CONFIG_SMP | ||
249 | smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu; | ||
250 | #endif | ||
240 | } | 251 | } |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index ca43ce31a19c..f98d3eafe07a 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -125,7 +125,7 @@ static struct clocksource kvm_clock = { | |||
125 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 125 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static int kvm_register_clock(char *txt) | 128 | int kvm_register_clock(char *txt) |
129 | { | 129 | { |
130 | int cpu = smp_processor_id(); | 130 | int cpu = smp_processor_id(); |
131 | int low, high, ret; | 131 | int low, high, ret; |
@@ -152,14 +152,6 @@ static void __cpuinit kvm_setup_secondary_clock(void) | |||
152 | } | 152 | } |
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | #ifdef CONFIG_SMP | ||
156 | static void __init kvm_smp_prepare_boot_cpu(void) | ||
157 | { | ||
158 | WARN_ON(kvm_register_clock("primary cpu clock")); | ||
159 | native_smp_prepare_boot_cpu(); | ||
160 | } | ||
161 | #endif | ||
162 | |||
163 | /* | 155 | /* |
164 | * After the clock is registered, the host will keep writing to the | 156 | * After the clock is registered, the host will keep writing to the |
165 | * registered memory location. If the guest happens to shutdown, this memory | 157 | * registered memory location. If the guest happens to shutdown, this memory |
@@ -206,9 +198,6 @@ void __init kvmclock_init(void) | |||
206 | x86_cpuinit.setup_percpu_clockev = | 198 | x86_cpuinit.setup_percpu_clockev = |
207 | kvm_setup_secondary_clock; | 199 | kvm_setup_secondary_clock; |
208 | #endif | 200 | #endif |
209 | #ifdef CONFIG_SMP | ||
210 | smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu; | ||
211 | #endif | ||
212 | machine_ops.shutdown = kvm_shutdown; | 201 | machine_ops.shutdown = kvm_shutdown; |
213 | #ifdef CONFIG_KEXEC | 202 | #ifdef CONFIG_KEXEC |
214 | machine_ops.crash_shutdown = kvm_crash_shutdown; | 203 | machine_ops.crash_shutdown = kvm_crash_shutdown; |