x86: KVM guest: merge CONFIG_KVM_CLOCK into CONFIG_KVM_GUEST
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 16 Aug 2012 20:00:19 +0000 (17:00 -0300)
committerMarcelo Tosatti <mtosatti@redhat.com>
Thu, 23 Aug 2012 07:57:54 +0000 (04:57 -0300)
The distinction between CONFIG_KVM_CLOCK and CONFIG_KVM_GUEST is
not so clear anymore, as demonstrated by recent bugs caused by poor
handling of on/off combinations of these options.

Merge CONFIG_KVM_CLOCK into CONFIG_KVM_GUEST.

Reported-By: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/Kconfig
arch/x86/include/asm/kvm_para.h
arch/x86/kernel/Makefile
arch/x86/kernel/kvm.c
arch/x86/kernel/setup.c

index 8ec3a1aa4abd3f612df4a5da31f30c67554d5182..a42e2e99caae813f7d12644b367286881a5f3363 100644 (file)
@@ -573,23 +573,18 @@ config PARAVIRT_TIME_ACCOUNTING
 
 source "arch/x86/xen/Kconfig"
 
-config KVM_CLOCK
-       bool "KVM paravirtualized clock"
-       select PARAVIRT
-       select PARAVIRT_CLOCK
-       ---help---
-         Turning on this option will allow you to run a paravirtualized clock
-         when running over the KVM hypervisor. Instead of relying on a PIT
-         (or probably other) emulation by the underlying device model, the host
-         provides the guest with timing infrastructure such as time of day, and
-         system time
-
 config KVM_GUEST
-       bool "KVM Guest support"
+       bool "KVM Guest support (including kvmclock)"
+       select PARAVIRT
        select PARAVIRT
+       select PARAVIRT_CLOCK
+       default y if PARAVIRT_GUEST
        ---help---
          This option enables various optimizations for running under the KVM
-         hypervisor.
+         hypervisor. It includes a paravirtualized clock, so that instead
+         of relying on a PIT (or probably other) emulation by the
+         underlying device model, the host provides the guest with
+         timing infrastructure such as time of day, and system time
 
 source "arch/x86/lguest/Kconfig"
 
index 20f5697888bd46a4aacf630c374d2bfe2ef5e2b6..eb3e9d85e1f1c75fc0db709cc40dd7a226d928cd 100644 (file)
@@ -102,14 +102,14 @@ struct kvm_vcpu_pv_apf_data {
 extern void kvmclock_init(void);
 extern int kvm_register_clock(char *txt);
 
-#ifdef CONFIG_KVM_CLOCK
+#ifdef CONFIG_KVM_GUEST
 bool kvm_check_and_clear_guest_paused(void);
 #else
 static inline bool kvm_check_and_clear_guest_paused(void)
 {
        return false;
 }
-#endif /* CONFIG_KVMCLOCK */
+#endif /* CONFIG_KVM_GUEST */
 
 /* This instruction is vmcall.  On non-VT architectures, it will generate a
  * trap that we will then rewrite to the appropriate instruction.
index 8215e5652d9747b6a7eb5302abca77446933acf3..7203298e0b832757eb858df88390342c24d57eff 100644 (file)
@@ -81,8 +81,7 @@ obj-$(CONFIG_DEBUG_RODATA_TEST)       += test_rodata.o
 obj-$(CONFIG_DEBUG_NX_TEST)    += test_nx.o
 obj-$(CONFIG_DEBUG_NMI_SELFTEST) += nmi_selftest.o
 
-obj-$(CONFIG_KVM_GUEST)                += kvm.o
-obj-$(CONFIG_KVM_CLOCK)                += kvmclock.o
+obj-$(CONFIG_KVM_GUEST)                += kvm.o kvmclock.o
 obj-$(CONFIG_PARAVIRT)         += paravirt.o paravirt_patch_$(BITS).o
 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= paravirt-spinlocks.o
 obj-$(CONFIG_PARAVIRT_CLOCK)   += pvclock.o
index 1596cc8fd79304554d83cbcb2f9c48f56c4d42b8..b3e5e51bc907ef4da71549ff7e2214467721af0a 100644 (file)
@@ -397,9 +397,7 @@ void kvm_disable_steal_time(void)
 #ifdef CONFIG_SMP
 static void __init kvm_smp_prepare_boot_cpu(void)
 {
-#ifdef CONFIG_KVM_CLOCK
        WARN_ON(kvm_register_clock("primary cpu clock"));
-#endif
        kvm_guest_cpu_init();
        native_smp_prepare_boot_cpu();
 }
index f4b9b80e1b95e2a9d0341fd62ed4412949b52243..b3386ae3438bef82283774db6c734704038adea6 100644 (file)
@@ -957,7 +957,7 @@ void __init setup_arch(char **cmdline_p)
        initmem_init();
        memblock_find_dma_reserve();
 
-#ifdef CONFIG_KVM_CLOCK
+#ifdef CONFIG_KVM_GUEST
        kvmclock_init();
 #endif