diff options
author | Borislav Petkov <bp@suse.de> | 2013-03-04 15:20:21 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-03-04 16:14:25 -0500 |
commit | 6276a074c6519946c527f03e2ab69770a62652d9 (patch) | |
tree | 29527fb4e5a6c4f3089d82643616465d85697530 | |
parent | 2c59cad6941cb55990fa6e19d84ae027c46991ee (diff) |
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: Borislav 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: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/Kconfig | 89 | ||||
-rw-r--r-- | arch/x86/include/asm/hypervisor.h | 16 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/Makefile | 3 | ||||
-rw-r--r-- | arch/x86/lguest/Kconfig | 3 | ||||
-rw-r--r-- | arch/x86/xen/Kconfig | 2 | ||||
-rw-r--r-- | drivers/hv/Kconfig | 2 | ||||
-rw-r--r-- | drivers/misc/Kconfig | 2 |
7 files changed, 62 insertions, 55 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f922a9b9a319..e9e4623bd4da 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -389,7 +389,7 @@ config X86_NUMACHIP | |||
389 | 389 | ||
390 | config X86_VSMP | 390 | config X86_VSMP |
391 | bool "ScaleMP vSMP" | 391 | bool "ScaleMP vSMP" |
392 | select PARAVIRT_GUEST | 392 | select HYPERVISOR_GUEST |
393 | select PARAVIRT | 393 | select PARAVIRT |
394 | depends on X86_64 && PCI | 394 | depends on X86_64 && PCI |
395 | depends on X86_EXTENDED_PLATFORM | 395 | depends on X86_EXTENDED_PLATFORM |
@@ -596,44 +596,17 @@ config SCHED_OMIT_FRAME_POINTER | |||
596 | 596 | ||
597 | If in doubt, say "Y". | 597 | If in doubt, say "Y". |
598 | 598 | ||
599 | menuconfig PARAVIRT_GUEST | 599 | menuconfig HYPERVISOR_GUEST |
600 | bool "Paravirtualized guest support" | 600 | bool "Linux guest support" |
601 | ---help--- | 601 | ---help--- |
602 | Say Y here to get to see options related to running Linux under | 602 | Say Y here to enable options for running Linux under various hyper- |
603 | various hypervisors. This option alone does not add any kernel code. | 603 | visors. This option enables basic hypervisor detection and platform |
604 | setup. | ||
604 | 605 | ||
605 | If you say N, all options in this submenu will be skipped and disabled. | 606 | If you say N, all options in this submenu will be skipped and |
607 | disabled, and Linux guest support won't be built in. | ||
606 | 608 | ||
607 | if PARAVIRT_GUEST | 609 | if HYPERVISOR_GUEST |
608 | |||
609 | config PARAVIRT_TIME_ACCOUNTING | ||
610 | bool "Paravirtual steal time accounting" | ||
611 | select PARAVIRT | ||
612 | default n | ||
613 | ---help--- | ||
614 | Select this option to enable fine granularity task steal time | ||
615 | accounting. Time spent executing other tasks in parallel with | ||
616 | the current vCPU is discounted from the vCPU power. To account for | ||
617 | that, there can be a small performance impact. | ||
618 | |||
619 | If in doubt, say N here. | ||
620 | |||
621 | source "arch/x86/xen/Kconfig" | ||
622 | |||
623 | config KVM_GUEST | ||
624 | bool "KVM Guest support (including kvmclock)" | ||
625 | select PARAVIRT | ||
626 | select PARAVIRT | ||
627 | select PARAVIRT_CLOCK | ||
628 | default y if PARAVIRT_GUEST | ||
629 | ---help--- | ||
630 | This option enables various optimizations for running under the KVM | ||
631 | hypervisor. It includes a paravirtualized clock, so that instead | ||
632 | of relying on a PIT (or probably other) emulation by the | ||
633 | underlying device model, the host provides the guest with | ||
634 | timing infrastructure such as time of day, and system time | ||
635 | |||
636 | source "arch/x86/lguest/Kconfig" | ||
637 | 610 | ||
638 | config PARAVIRT | 611 | config PARAVIRT |
639 | bool "Enable paravirtualization code" | 612 | bool "Enable paravirtualization code" |
@@ -643,6 +616,13 @@ config PARAVIRT | |||
643 | over full virtualization. However, when run without a hypervisor | 616 | over full virtualization. However, when run without a hypervisor |
644 | the kernel is theoretically slower and slightly larger. | 617 | the kernel is theoretically slower and slightly larger. |
645 | 618 | ||
619 | config PARAVIRT_DEBUG | ||
620 | bool "paravirt-ops debugging" | ||
621 | depends on PARAVIRT && DEBUG_KERNEL | ||
622 | ---help--- | ||
623 | Enable to debug paravirt_ops internals. Specifically, BUG if | ||
624 | a paravirt_op is missing when it is called. | ||
625 | |||
646 | config PARAVIRT_SPINLOCKS | 626 | config PARAVIRT_SPINLOCKS |
647 | bool "Paravirtualization layer for spinlocks" | 627 | bool "Paravirtualization layer for spinlocks" |
648 | depends on PARAVIRT && SMP | 628 | depends on PARAVIRT && SMP |
@@ -656,17 +636,38 @@ config PARAVIRT_SPINLOCKS | |||
656 | 636 | ||
657 | If you are unsure how to answer this question, answer N. | 637 | If you are unsure how to answer this question, answer N. |
658 | 638 | ||
659 | config PARAVIRT_CLOCK | 639 | source "arch/x86/xen/Kconfig" |
660 | bool | ||
661 | 640 | ||
662 | config PARAVIRT_DEBUG | 641 | config KVM_GUEST |
663 | bool "paravirt-ops debugging" | 642 | bool "KVM Guest support (including kvmclock)" |
664 | depends on PARAVIRT && DEBUG_KERNEL | 643 | depends on PARAVIRT |
644 | select PARAVIRT_CLOCK | ||
645 | default y | ||
665 | ---help--- | 646 | ---help--- |
666 | Enable to debug paravirt_ops internals. Specifically, BUG if | 647 | This option enables various optimizations for running under the KVM |
667 | a paravirt_op is missing when it is called. | 648 | hypervisor. It includes a paravirtualized clock, so that instead |
649 | of relying on a PIT (or probably other) emulation by the | ||
650 | underlying device model, the host provides the guest with | ||
651 | timing infrastructure such as time of day, and system time | ||
652 | |||
653 | source "arch/x86/lguest/Kconfig" | ||
654 | |||
655 | config PARAVIRT_TIME_ACCOUNTING | ||
656 | bool "Paravirtual steal time accounting" | ||
657 | depends on PARAVIRT | ||
658 | default n | ||
659 | ---help--- | ||
660 | Select this option to enable fine granularity task steal time | ||
661 | accounting. Time spent executing other tasks in parallel with | ||
662 | the current vCPU is discounted from the vCPU power. To account for | ||
663 | that, there can be a small performance impact. | ||
664 | |||
665 | If in doubt, say N here. | ||
666 | |||
667 | config PARAVIRT_CLOCK | ||
668 | bool | ||
668 | 669 | ||
669 | endif #PARAVIRT_GUEST | 670 | endif #HYPERVISOR_GUEST |
670 | 671 | ||
671 | config NO_BOOTMEM | 672 | config NO_BOOTMEM |
672 | def_bool y | 673 | def_bool y |
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 86095ed14135..2d4b5e6107cd 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h | |||
@@ -20,13 +20,11 @@ | |||
20 | #ifndef _ASM_X86_HYPERVISOR_H | 20 | #ifndef _ASM_X86_HYPERVISOR_H |
21 | #define _ASM_X86_HYPERVISOR_H | 21 | #define _ASM_X86_HYPERVISOR_H |
22 | 22 | ||
23 | #ifdef CONFIG_HYPERVISOR_GUEST | ||
24 | |||
23 | #include <asm/kvm_para.h> | 25 | #include <asm/kvm_para.h> |
24 | #include <asm/xen/hypervisor.h> | 26 | #include <asm/xen/hypervisor.h> |
25 | 27 | ||
26 | extern void init_hypervisor(struct cpuinfo_x86 *c); | ||
27 | extern void init_hypervisor_platform(void); | ||
28 | extern bool hypervisor_x2apic_available(void); | ||
29 | |||
30 | /* | 28 | /* |
31 | * x86 hypervisor information | 29 | * x86 hypervisor information |
32 | */ | 30 | */ |
@@ -55,4 +53,12 @@ extern const struct hypervisor_x86 x86_hyper_ms_hyperv; | |||
55 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; | 53 | extern const struct hypervisor_x86 x86_hyper_xen_hvm; |
56 | extern const struct hypervisor_x86 x86_hyper_kvm; | 54 | extern const struct hypervisor_x86 x86_hyper_kvm; |
57 | 55 | ||
58 | #endif | 56 | extern void init_hypervisor(struct cpuinfo_x86 *c); |
57 | extern void init_hypervisor_platform(void); | ||
58 | extern bool hypervisor_x2apic_available(void); | ||
59 | #else | ||
60 | static inline void init_hypervisor(struct cpuinfo_x86 *c) { } | ||
61 | static inline void init_hypervisor_platform(void) { } | ||
62 | static inline bool hypervisor_x2apic_available(void) { return false; } | ||
63 | #endif /* CONFIG_HYPERVISOR_GUEST */ | ||
64 | #endif /* _ASM_X86_HYPERVISOR_H */ | ||
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index a0e067d3d96c..5f81bcefbe14 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -14,7 +14,6 @@ CFLAGS_common.o := $(nostackp) | |||
14 | 14 | ||
15 | obj-y := intel_cacheinfo.o scattered.o topology.o | 15 | obj-y := intel_cacheinfo.o scattered.o topology.o |
16 | obj-y += proc.o capflags.o powerflags.o common.o | 16 | obj-y += proc.o capflags.o powerflags.o common.o |
17 | obj-y += vmware.o hypervisor.o mshyperv.o | ||
18 | obj-y += rdrand.o | 17 | obj-y += rdrand.o |
19 | obj-y += match.o | 18 | obj-y += match.o |
20 | 19 | ||
@@ -42,6 +41,8 @@ obj-$(CONFIG_MTRR) += mtrr/ | |||
42 | 41 | ||
43 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o | 42 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o |
44 | 43 | ||
44 | obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o | ||
45 | |||
45 | quiet_cmd_mkcapflags = MKCAP $@ | 46 | quiet_cmd_mkcapflags = MKCAP $@ |
46 | cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ | 47 | cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ |
47 | 48 | ||
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig index 29043d2048a0..4a0890f815c4 100644 --- a/arch/x86/lguest/Kconfig +++ b/arch/x86/lguest/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | config LGUEST_GUEST | 1 | config LGUEST_GUEST |
2 | bool "Lguest guest support" | 2 | bool "Lguest guest support" |
3 | select PARAVIRT | 3 | depends on X86_32 && PARAVIRT |
4 | depends on X86_32 | ||
5 | select TTY | 4 | select TTY |
6 | select VIRTUALIZATION | 5 | select VIRTUALIZATION |
7 | select VIRTIO | 6 | select VIRTIO |
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 131dacd2748a..1a3c76505649 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config XEN | 5 | config XEN |
6 | bool "Xen guest support" | 6 | bool "Xen guest support" |
7 | select PARAVIRT | 7 | depends on PARAVIRT |
8 | select PARAVIRT_CLOCK | 8 | select PARAVIRT_CLOCK |
9 | select XEN_HAVE_PVMMU | 9 | select XEN_HAVE_PVMMU |
10 | depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS) | 10 | depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS) |
diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 64630f15f181..0403b51d20ba 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig | |||
@@ -2,7 +2,7 @@ menu "Microsoft Hyper-V guest support" | |||
2 | 2 | ||
3 | config HYPERV | 3 | config HYPERV |
4 | tristate "Microsoft Hyper-V client drivers" | 4 | tristate "Microsoft Hyper-V client drivers" |
5 | depends on X86 && ACPI && PCI && X86_LOCAL_APIC | 5 | depends on X86 && ACPI && PCI && X86_LOCAL_APIC && HYPERVISOR_GUEST |
6 | help | 6 | help |
7 | Select this option to run Linux as a Hyper-V client operating | 7 | Select this option to run Linux as a Hyper-V client operating |
8 | system. | 8 | system. |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index e83fdfe0c8ca..891123e31932 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -418,7 +418,7 @@ config TI_DAC7512 | |||
418 | 418 | ||
419 | config VMWARE_BALLOON | 419 | config VMWARE_BALLOON |
420 | tristate "VMware Balloon Driver" | 420 | tristate "VMware Balloon Driver" |
421 | depends on X86 | 421 | depends on X86 && HYPERVISOR_GUEST |
422 | help | 422 | help |
423 | This is VMware physical memory management driver which acts | 423 | This is VMware physical memory management driver which acts |
424 | like a "balloon" that can be inflated to reclaim physical pages | 424 | like a "balloon" that can be inflated to reclaim physical pages |