KVM paravirt: Move kvm_smp_prepare_boot_cpu() from kvmclock.c to kvm.c.
authorGleb Natapov <gleb@redhat.com>
Thu, 14 Oct 2010 09:22:49 +0000 (11:22 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 12 Jan 2011 09:23:10 +0000 (11:23 +0200)
Async PF also needs to hook into smp_prepare_boot_cpu so move the hook
into generic code.

Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/include/asm/kvm_para.h
arch/x86/kernel/kvm.c
arch/x86/kernel/kvmclock.c

index 7b562b6184bcf6d1b4b640c676ed6d4f3f0bae2e..e3faaaf4301ed8aaf3cf652f8b33389764276f53 100644 (file)
@@ -65,6 +65,7 @@ struct kvm_mmu_op_release_pt {
 #include <asm/processor.h>
 
 extern void kvmclock_init(void);
+extern int kvm_register_clock(char *txt);
 
 
 /* This instruction is vmcall.  On non-VT architectures, it will generate a
index 63b0ec8d3d4a4d8856ed21f7f9a174d7732c5ce0..e6db17976b8224a42cf2d66ae708e2adbe8a5d5e 100644 (file)
@@ -231,10 +231,21 @@ static void __init paravirt_ops_setup(void)
 #endif
 }
 
+#ifdef CONFIG_SMP
+static void __init kvm_smp_prepare_boot_cpu(void)
+{
+       WARN_ON(kvm_register_clock("primary cpu clock"));
+       native_smp_prepare_boot_cpu();
+}
+#endif
+
 void __init kvm_guest_init(void)
 {
        if (!kvm_para_available())
                return;
 
        paravirt_ops_setup();
+#ifdef CONFIG_SMP
+       smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu;
+#endif
 }
index ca43ce31a19c241dcf224cf15d952026b269353a..f98d3eafe07a6f98884ad55dce00c74d3dd91967 100644 (file)
@@ -125,7 +125,7 @@ static struct clocksource kvm_clock = {
        .flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-static int kvm_register_clock(char *txt)
+int kvm_register_clock(char *txt)
 {
        int cpu = smp_processor_id();
        int low, high, ret;
@@ -152,14 +152,6 @@ static void __cpuinit kvm_setup_secondary_clock(void)
 }
 #endif
 
-#ifdef CONFIG_SMP
-static void __init kvm_smp_prepare_boot_cpu(void)
-{
-       WARN_ON(kvm_register_clock("primary cpu clock"));
-       native_smp_prepare_boot_cpu();
-}
-#endif
-
 /*
  * After the clock is registered, the host will keep writing to the
  * registered memory location. If the guest happens to shutdown, this memory
@@ -205,9 +197,6 @@ void __init kvmclock_init(void)
 #ifdef CONFIG_X86_LOCAL_APIC
        x86_cpuinit.setup_percpu_clockev =
                kvm_setup_secondary_clock;
-#endif
-#ifdef CONFIG_SMP
-       smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu;
 #endif
        machine_ops.shutdown  = kvm_shutdown;
 #ifdef CONFIG_KEXEC