Commit 6276a074 authored by Borislav Petkov's avatar Borislav Petkov Committed by H. Peter Anvin

x86: Make Linux guest support optional

Put all config options needed to run Linux as a guest behind a
CONFIG_HYPERVISOR_GUEST menu so that they don't get built-in by default
but be selectable by the user. Also, make all units which depend on
x86_hyper, depend on this new symbol so that compilation doesn't fail
when CONFIG_HYPERVISOR_GUEST is disabled but those units assume its
presence.

Sort options in the new HYPERVISOR_GUEST menu, adapt config text and
drop redundant select.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1362428421-9244-3-git-send-email-bp@alien8.de
Cc: Dmitry Torokhov <dtor@vmware.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 2c59cad6
...@@ -389,7 +389,7 @@ config X86_NUMACHIP ...@@ -389,7 +389,7 @@ config X86_NUMACHIP
config X86_VSMP config X86_VSMP
bool "ScaleMP vSMP" bool "ScaleMP vSMP"
select PARAVIRT_GUEST select HYPERVISOR_GUEST
select PARAVIRT select PARAVIRT
depends on X86_64 && PCI depends on X86_64 && PCI
depends on X86_EXTENDED_PLATFORM depends on X86_EXTENDED_PLATFORM
...@@ -596,44 +596,17 @@ config SCHED_OMIT_FRAME_POINTER ...@@ -596,44 +596,17 @@ config SCHED_OMIT_FRAME_POINTER
If in doubt, say "Y". If in doubt, say "Y".
menuconfig PARAVIRT_GUEST menuconfig HYPERVISOR_GUEST
bool "Paravirtualized guest support" bool "Linux guest support"
---help--- ---help---
Say Y here to get to see options related to running Linux under Say Y here to enable options for running Linux under various hyper-
various hypervisors. This option alone does not add any kernel code. visors. This option enables basic hypervisor detection and platform
setup.
If you say N, all options in this submenu will be skipped and disabled. If you say N, all options in this submenu will be skipped and
disabled, and Linux guest support won't be built in.
if PARAVIRT_GUEST if HYPERVISOR_GUEST
config PARAVIRT_TIME_ACCOUNTING
bool "Paravirtual steal time accounting"
select PARAVIRT
default n
---help---
Select this option to enable fine granularity task steal time
accounting. Time spent executing other tasks in parallel with
the current vCPU is discounted from the vCPU power. To account for
that, there can be a small performance impact.
If in doubt, say N here.
source "arch/x86/xen/Kconfig"
config KVM_GUEST
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. 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"
config PARAVIRT config PARAVIRT
bool "Enable paravirtualization code" bool "Enable paravirtualization code"
...@@ -643,6 +616,13 @@ config PARAVIRT ...@@ -643,6 +616,13 @@ config PARAVIRT
over full virtualization. However, when run without a hypervisor over full virtualization. However, when run without a hypervisor
the kernel is theoretically slower and slightly larger. the kernel is theoretically slower and slightly larger.
config PARAVIRT_DEBUG
bool "paravirt-ops debugging"
depends on PARAVIRT && DEBUG_KERNEL
---help---
Enable to debug paravirt_ops internals. Specifically, BUG if
a paravirt_op is missing when it is called.
config PARAVIRT_SPINLOCKS config PARAVIRT_SPINLOCKS
bool "Paravirtualization layer for spinlocks" bool "Paravirtualization layer for spinlocks"
depends on PARAVIRT && SMP depends on PARAVIRT && SMP
...@@ -656,17 +636,38 @@ config PARAVIRT_SPINLOCKS ...@@ -656,17 +636,38 @@ config PARAVIRT_SPINLOCKS
If you are unsure how to answer this question, answer N. If you are unsure how to answer this question, answer N.
config PARAVIRT_CLOCK source "arch/x86/xen/Kconfig"
bool
config PARAVIRT_DEBUG config KVM_GUEST
bool "paravirt-ops debugging" bool "KVM Guest support (including kvmclock)"
depends on PARAVIRT && DEBUG_KERNEL depends on PARAVIRT
select PARAVIRT_CLOCK
default y
---help--- ---help---
Enable to debug paravirt_ops internals. Specifically, BUG if This option enables various optimizations for running under the KVM
a paravirt_op is missing when it is called. 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"
config PARAVIRT_TIME_ACCOUNTING
bool "Paravirtual steal time accounting"
depends on PARAVIRT
default n
---help---
Select this option to enable fine granularity task steal time
accounting. Time spent executing other tasks in parallel with
the current vCPU is discounted from the vCPU power. To account for
that, there can be a small performance impact.
If in doubt, say N here.
config PARAVIRT_CLOCK
bool
endif #PARAVIRT_GUEST endif #HYPERVISOR_GUEST
config NO_BOOTMEM config NO_BOOTMEM
def_bool y def_bool y
......
...@@ -20,13 +20,11 @@ ...@@ -20,13 +20,11 @@
#ifndef _ASM_X86_HYPERVISOR_H #ifndef _ASM_X86_HYPERVISOR_H
#define _ASM_X86_HYPERVISOR_H #define _ASM_X86_HYPERVISOR_H
#ifdef CONFIG_HYPERVISOR_GUEST
#include <asm/kvm_para.h> #include <asm/kvm_para.h>
#include <asm/xen/hypervisor.h> #include <asm/xen/hypervisor.h>
extern void init_hypervisor(struct cpuinfo_x86 *c);
extern void init_hypervisor_platform(void);
extern bool hypervisor_x2apic_available(void);
/* /*
* x86 hypervisor information * x86 hypervisor information
*/ */
...@@ -55,4 +53,12 @@ extern const struct hypervisor_x86 x86_hyper_ms_hyperv; ...@@ -55,4 +53,12 @@ extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
extern const struct hypervisor_x86 x86_hyper_xen_hvm; extern const struct hypervisor_x86 x86_hyper_xen_hvm;
extern const struct hypervisor_x86 x86_hyper_kvm; extern const struct hypervisor_x86 x86_hyper_kvm;
#endif extern void init_hypervisor(struct cpuinfo_x86 *c);
extern void init_hypervisor_platform(void);
extern bool hypervisor_x2apic_available(void);
#else
static inline void init_hypervisor(struct cpuinfo_x86 *c) { }
static inline void init_hypervisor_platform(void) { }
static inline bool hypervisor_x2apic_available(void) { return false; }
#endif /* CONFIG_HYPERVISOR_GUEST */
#endif /* _ASM_X86_HYPERVISOR_H */
...@@ -14,7 +14,6 @@ CFLAGS_common.o := $(nostackp) ...@@ -14,7 +14,6 @@ CFLAGS_common.o := $(nostackp)
obj-y := intel_cacheinfo.o scattered.o topology.o obj-y := intel_cacheinfo.o scattered.o topology.o
obj-y += proc.o capflags.o powerflags.o common.o obj-y += proc.o capflags.o powerflags.o common.o
obj-y += vmware.o hypervisor.o mshyperv.o
obj-y += rdrand.o obj-y += rdrand.o
obj-y += match.o obj-y += match.o
...@@ -42,6 +41,8 @@ obj-$(CONFIG_MTRR) += mtrr/ ...@@ -42,6 +41,8 @@ obj-$(CONFIG_MTRR) += mtrr/
obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o
obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
quiet_cmd_mkcapflags = MKCAP $@ quiet_cmd_mkcapflags = MKCAP $@
cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
......
config LGUEST_GUEST config LGUEST_GUEST
bool "Lguest guest support" bool "Lguest guest support"
select PARAVIRT depends on X86_32 && PARAVIRT
depends on X86_32
select TTY select TTY
select VIRTUALIZATION select VIRTUALIZATION
select VIRTIO select VIRTIO
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
config XEN config XEN
bool "Xen guest support" bool "Xen guest support"
select PARAVIRT depends on PARAVIRT
select PARAVIRT_CLOCK select PARAVIRT_CLOCK
select XEN_HAVE_PVMMU select XEN_HAVE_PVMMU
depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS) depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS)
......
...@@ -2,7 +2,7 @@ menu "Microsoft Hyper-V guest support" ...@@ -2,7 +2,7 @@ menu "Microsoft Hyper-V guest support"
config HYPERV config HYPERV
tristate "Microsoft Hyper-V client drivers" tristate "Microsoft Hyper-V client drivers"
depends on X86 && ACPI && PCI && X86_LOCAL_APIC depends on X86 && ACPI && PCI && X86_LOCAL_APIC && HYPERVISOR_GUEST
help help
Select this option to run Linux as a Hyper-V client operating Select this option to run Linux as a Hyper-V client operating
system. system.
......
...@@ -418,7 +418,7 @@ config TI_DAC7512 ...@@ -418,7 +418,7 @@ config TI_DAC7512
config VMWARE_BALLOON config VMWARE_BALLOON
tristate "VMware Balloon Driver" tristate "VMware Balloon Driver"
depends on X86 depends on X86 && HYPERVISOR_GUEST
help help
This is VMware physical memory management driver which acts This is VMware physical memory management driver which acts
like a "balloon" that can be inflated to reclaim physical pages like a "balloon" that can be inflated to reclaim physical pages
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment