Commit 1e2f5b59 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 paravirt update from Ingo Molnar:
 "Various paravirtualization related changes - the biggest one makes
  guest support optional via CONFIG_HYPERVISOR_GUEST"

* 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, wakeup, sleep: Use pvops functions for changing GDT entries
  x86, xen, gdt: Remove the pvops variant of store_gdt.
  x86-32, gdt: Store/load GDT for ACPI S3 or hibernation/resume path is not needed
  x86-64, gdt: Store/load GDT for ACPI S3 or hibernate/resume path is not needed.
  x86: Make Linux guest support optional
  x86, Kconfig: Move PARAVIRT_DEBUG into the paravirt menu
parents f9b3bcfb 4d681be3
...@@ -387,7 +387,7 @@ config X86_NUMACHIP ...@@ -387,7 +387,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
...@@ -594,44 +594,17 @@ config SCHED_OMIT_FRAME_POINTER ...@@ -594,44 +594,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"
...@@ -641,6 +614,13 @@ config PARAVIRT ...@@ -641,6 +614,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
...@@ -654,17 +634,38 @@ config PARAVIRT_SPINLOCKS ...@@ -654,17 +634,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
endif config KVM_GUEST
bool "KVM Guest support (including kvmclock)"
depends on PARAVIRT
select PARAVIRT_CLOCK
default y
---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
config PARAVIRT_DEBUG source "arch/x86/lguest/Kconfig"
bool "paravirt-ops debugging"
depends on PARAVIRT && DEBUG_KERNEL config PARAVIRT_TIME_ACCOUNTING
bool "Paravirtual steal time accounting"
depends on PARAVIRT
default n
---help--- ---help---
Enable to debug paravirt_ops internals. Specifically, BUG if Select this option to enable fine granularity task steal time
a paravirt_op is missing when it is called. 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 #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 */
...@@ -262,10 +262,6 @@ static inline void set_ldt(const void *addr, unsigned entries) ...@@ -262,10 +262,6 @@ static inline void set_ldt(const void *addr, unsigned entries)
{ {
PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries); PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries);
} }
static inline void store_gdt(struct desc_ptr *dtr)
{
PVOP_VCALL1(pv_cpu_ops.store_gdt, dtr);
}
static inline void store_idt(struct desc_ptr *dtr) static inline void store_idt(struct desc_ptr *dtr)
{ {
PVOP_VCALL1(pv_cpu_ops.store_idt, dtr); PVOP_VCALL1(pv_cpu_ops.store_idt, dtr);
......
...@@ -123,7 +123,7 @@ struct pv_cpu_ops { ...@@ -123,7 +123,7 @@ struct pv_cpu_ops {
void (*load_tr_desc)(void); void (*load_tr_desc)(void);
void (*load_gdt)(const struct desc_ptr *); void (*load_gdt)(const struct desc_ptr *);
void (*load_idt)(const struct desc_ptr *); void (*load_idt)(const struct desc_ptr *);
void (*store_gdt)(struct desc_ptr *); /* store_gdt has been removed. */
void (*store_idt)(struct desc_ptr *); void (*store_idt)(struct desc_ptr *);
void (*set_ldt)(const void *desc, unsigned entries); void (*set_ldt)(const void *desc, unsigned entries);
unsigned long (*store_tr)(void); unsigned long (*store_tr)(void);
......
...@@ -15,7 +15,6 @@ struct saved_context { ...@@ -15,7 +15,6 @@ struct saved_context {
unsigned long cr0, cr2, cr3, cr4; unsigned long cr0, cr2, cr3, cr4;
u64 misc_enable; u64 misc_enable;
bool misc_enable_saved; bool misc_enable_saved;
struct desc_ptr gdt;
struct desc_ptr idt; struct desc_ptr idt;
u16 ldt; u16 ldt;
u16 tss; u16 tss;
......
...@@ -25,9 +25,6 @@ struct saved_context { ...@@ -25,9 +25,6 @@ struct saved_context {
u64 misc_enable; u64 misc_enable;
bool misc_enable_saved; bool misc_enable_saved;
unsigned long efer; unsigned long efer;
u16 gdt_pad;
u16 gdt_limit;
unsigned long gdt_base;
u16 idt_pad; u16 idt_pad;
u16 idt_limit; u16 idt_limit;
unsigned long idt_base; unsigned long idt_base;
......
...@@ -46,7 +46,7 @@ int acpi_suspend_lowlevel(void) ...@@ -46,7 +46,7 @@ int acpi_suspend_lowlevel(void)
header->pmode_behavior = 0; header->pmode_behavior = 0;
#ifndef CONFIG_64BIT #ifndef CONFIG_64BIT
store_gdt((struct desc_ptr *)&header->pmode_gdt); native_store_gdt((struct desc_ptr *)&header->pmode_gdt);
if (!rdmsr_safe(MSR_EFER, if (!rdmsr_safe(MSR_EFER,
&header->pmode_efer_low, &header->pmode_efer_low,
......
...@@ -18,7 +18,6 @@ wakeup_pmode_return: ...@@ -18,7 +18,6 @@ wakeup_pmode_return:
movw %ax, %gs movw %ax, %gs
# reload the gdt, as we need the full 32 bit address # reload the gdt, as we need the full 32 bit address
lgdt saved_gdt
lidt saved_idt lidt saved_idt
lldt saved_ldt lldt saved_ldt
ljmp $(__KERNEL_CS), $1f ljmp $(__KERNEL_CS), $1f
...@@ -44,7 +43,6 @@ bogus_magic: ...@@ -44,7 +43,6 @@ bogus_magic:
save_registers: save_registers:
sgdt saved_gdt
sidt saved_idt sidt saved_idt
sldt saved_ldt sldt saved_ldt
str saved_tss str saved_tss
...@@ -93,7 +91,6 @@ ENTRY(saved_magic) .long 0 ...@@ -93,7 +91,6 @@ ENTRY(saved_magic) .long 0
ENTRY(saved_eip) .long 0 ENTRY(saved_eip) .long 0
# saved registers # saved registers
saved_gdt: .long 0,0
saved_idt: .long 0,0 saved_idt: .long 0,0
saved_ldt: .long 0 saved_ldt: .long 0
saved_tss: .long 0 saved_tss: .long 0
......
...@@ -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 = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@ cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
......
...@@ -20,7 +20,7 @@ static void doublefault_fn(void) ...@@ -20,7 +20,7 @@ static void doublefault_fn(void)
struct desc_ptr gdt_desc = {0, 0}; struct desc_ptr gdt_desc = {0, 0};
unsigned long gdt, tss; unsigned long gdt, tss;
store_gdt(&gdt_desc); native_store_gdt(&gdt_desc);
gdt = gdt_desc.address; gdt = gdt_desc.address;
printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size); printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
......
...@@ -360,7 +360,6 @@ struct pv_cpu_ops pv_cpu_ops = { ...@@ -360,7 +360,6 @@ struct pv_cpu_ops pv_cpu_ops = {
.set_ldt = native_set_ldt, .set_ldt = native_set_ldt,
.load_gdt = native_load_gdt, .load_gdt = native_load_gdt,
.load_idt = native_load_idt, .load_idt = native_load_idt,
.store_gdt = native_store_gdt,
.store_idt = native_store_idt, .store_idt = native_store_idt,
.store_tr = native_store_tr, .store_tr = native_store_tr,
.load_tls = native_load_tls, .load_tls = native_load_tls,
......
...@@ -2459,7 +2459,7 @@ static int hardware_enable(void *garbage) ...@@ -2459,7 +2459,7 @@ static int hardware_enable(void *garbage)
ept_sync_global(); ept_sync_global();
} }
store_gdt(&__get_cpu_var(host_gdt)); native_store_gdt(&__get_cpu_var(host_gdt));
return 0; return 0;
} }
......
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
......
...@@ -62,11 +62,9 @@ static void __save_processor_state(struct saved_context *ctxt) ...@@ -62,11 +62,9 @@ static void __save_processor_state(struct saved_context *ctxt)
* descriptor tables * descriptor tables
*/ */
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
store_gdt(&ctxt->gdt);
store_idt(&ctxt->idt); store_idt(&ctxt->idt);
#else #else
/* CONFIG_X86_64 */ /* CONFIG_X86_64 */
store_gdt((struct desc_ptr *)&ctxt->gdt_limit);
store_idt((struct desc_ptr *)&ctxt->idt_limit); store_idt((struct desc_ptr *)&ctxt->idt_limit);
#endif #endif
store_tr(ctxt->tr); store_tr(ctxt->tr);
...@@ -135,7 +133,10 @@ static void fix_processor_context(void) ...@@ -135,7 +133,10 @@ static void fix_processor_context(void)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
struct tss_struct *t = &per_cpu(init_tss, cpu); struct tss_struct *t = &per_cpu(init_tss, cpu);
#ifdef CONFIG_X86_64
struct desc_struct *desc = get_cpu_gdt_table(cpu);
tss_desc tss;
#endif
set_tss_desc(cpu, t); /* set_tss_desc(cpu, t); /*
* This just modifies memory; should not be * This just modifies memory; should not be
* necessary. But... This is necessary, because * necessary. But... This is necessary, because
...@@ -144,7 +145,9 @@ static void fix_processor_context(void) ...@@ -144,7 +145,9 @@ static void fix_processor_context(void)
*/ */
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9; memcpy(&tss, &desc[GDT_ENTRY_TSS], sizeof(tss_desc));
tss.type = 0x9; /* The available 64-bit TSS (see AMD vol 2, pg 91 */
write_gdt_entry(desc, GDT_ENTRY_TSS, &tss, DESC_TSS);
syscall_init(); /* This sets MSR_*STAR and related */ syscall_init(); /* This sets MSR_*STAR and related */
#endif #endif
...@@ -183,11 +186,9 @@ static void __restore_processor_state(struct saved_context *ctxt) ...@@ -183,11 +186,9 @@ static void __restore_processor_state(struct saved_context *ctxt)
* ltr is done i fix_processor_context(). * ltr is done i fix_processor_context().
*/ */
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
load_gdt(&ctxt->gdt);
load_idt(&ctxt->idt); load_idt(&ctxt->idt);
#else #else
/* CONFIG_X86_64 */ /* CONFIG_X86_64 */
load_gdt((const struct desc_ptr *)&ctxt->gdt_limit);
load_idt((const struct desc_ptr *)&ctxt->idt_limit); load_idt((const struct desc_ptr *)&ctxt->idt_limit);
#endif #endif
......
...@@ -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)
......
...@@ -1221,7 +1221,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { ...@@ -1221,7 +1221,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
.alloc_ldt = xen_alloc_ldt, .alloc_ldt = xen_alloc_ldt,
.free_ldt = xen_free_ldt, .free_ldt = xen_free_ldt,
.store_gdt = native_store_gdt,
.store_idt = native_store_idt, .store_idt = native_store_idt,
.store_tr = xen_store_tr, .store_tr = xen_store_tr,
......
...@@ -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.
......
...@@ -426,7 +426,7 @@ config TI_DAC7512 ...@@ -426,7 +426,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