]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge branch 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 15:41:21 +0000 (08:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 15:41:21 +0000 (08:41 -0700)
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

18 files changed:
arch/x86/Kconfig
arch/x86/include/asm/hypervisor.h
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/paravirt_types.h
arch/x86/include/asm/suspend_32.h
arch/x86/include/asm/suspend_64.h
arch/x86/kernel/acpi/sleep.c
arch/x86/kernel/acpi/wakeup_32.S
arch/x86/kernel/cpu/Makefile
arch/x86/kernel/doublefault_32.c
arch/x86/kernel/paravirt.c
arch/x86/kvm/vmx.c
arch/x86/lguest/Kconfig
arch/x86/power/cpu.c
arch/x86/xen/Kconfig
arch/x86/xen/enlighten.c
drivers/hv/Kconfig
drivers/misc/Kconfig

index e93ccb9b1cc1111744c1cd75fd2ddb756f29c73c..05b057dca4a70ba4c891c78794e9b67870fbd52b 100644 (file)
@@ -387,7 +387,7 @@ config X86_NUMACHIP
 
 config X86_VSMP
        bool "ScaleMP vSMP"
-       select PARAVIRT_GUEST
+       select HYPERVISOR_GUEST
        select PARAVIRT
        depends on X86_64 && PCI
        depends on X86_EXTENDED_PLATFORM
@@ -594,44 +594,17 @@ config SCHED_OMIT_FRAME_POINTER
 
          If in doubt, say "Y".
 
-menuconfig PARAVIRT_GUEST
-       bool "Paravirtualized guest support"
+menuconfig HYPERVISOR_GUEST
+       bool "Linux guest support"
        ---help---
-         Say Y here to get to see options related to running Linux under
-         various hypervisors.  This option alone does not add any kernel code.
+         Say Y here to enable options for running Linux under various hyper-
+         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
-
-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"
+if HYPERVISOR_GUEST
 
 config PARAVIRT
        bool "Enable paravirtualization code"
@@ -641,6 +614,13 @@ config PARAVIRT
          over full virtualization.  However, when run without a hypervisor
          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
        bool "Paravirtualization layer for spinlocks"
        depends on PARAVIRT && SMP
@@ -654,17 +634,38 @@ config PARAVIRT_SPINLOCKS
 
          If you are unsure how to answer this question, answer N.
 
-config PARAVIRT_CLOCK
-       bool
+source "arch/x86/xen/Kconfig"
 
-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
-       bool "paravirt-ops debugging"
-       depends on PARAVIRT && DEBUG_KERNEL
+source "arch/x86/lguest/Kconfig"
+
+config PARAVIRT_TIME_ACCOUNTING
+       bool "Paravirtual steal time accounting"
+       depends on PARAVIRT
+       default n
        ---help---
-         Enable to debug paravirt_ops internals.  Specifically, BUG if
-         a paravirt_op is missing when it is called.
+         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 #HYPERVISOR_GUEST
 
 config NO_BOOTMEM
        def_bool y
index 86095ed141356f3210fee6954f80a763df4a5bea..2d4b5e6107cd70d2977a12c090b01ed7908a58ae 100644 (file)
 #ifndef _ASM_X86_HYPERVISOR_H
 #define _ASM_X86_HYPERVISOR_H
 
+#ifdef CONFIG_HYPERVISOR_GUEST
+
 #include <asm/kvm_para.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
  */
@@ -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_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 */
index 7361e47db79f50158ada1cdde859c4871b99ee51..cfdc9ee4c90013d577be1d9be33135ce63245ed7 100644 (file)
@@ -262,10 +262,6 @@ static inline void set_ldt(const void *addr, unsigned 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)
 {
        PVOP_VCALL1(pv_cpu_ops.store_idt, dtr);
index b3b0ec1dac86d91ac6289b961afefe65f1f48d11..0db1fcac668cf52b02f26ab3efa0b66e03b2670a 100644 (file)
@@ -123,7 +123,7 @@ struct pv_cpu_ops {
        void (*load_tr_desc)(void);
        void (*load_gdt)(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 (*set_ldt)(const void *desc, unsigned entries);
        unsigned long (*store_tr)(void);
index 487055c8c1aaf2d63bbf2b0d8bcfcdd5d616c721..f6064b7385b0619d9fe09dab76e482a0d95e89c1 100644 (file)
@@ -15,7 +15,6 @@ struct saved_context {
        unsigned long cr0, cr2, cr3, cr4;
        u64 misc_enable;
        bool misc_enable_saved;
-       struct desc_ptr gdt;
        struct desc_ptr idt;
        u16 ldt;
        u16 tss;
index 09b0bf104156579ae49f72b17c603befcf2db5a6..97b84e08a211de2f55fc5830e8bacc7d80729eac 100644 (file)
@@ -25,9 +25,6 @@ struct saved_context {
        u64 misc_enable;
        bool misc_enable_saved;
        unsigned long efer;
-       u16 gdt_pad;
-       u16 gdt_limit;
-       unsigned long gdt_base;
        u16 idt_pad;
        u16 idt_limit;
        unsigned long idt_base;
index 0532f5d6e4efc66c264d1e7d47d44e615b833be3..b44577bc97449c14af7988e18a14b4b9c31cc262 100644 (file)
@@ -46,7 +46,7 @@ int acpi_suspend_lowlevel(void)
        header->pmode_behavior = 0;
 
 #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,
                        &header->pmode_efer_low,
index ced4638c83415717173c7699b9c169b06eb8f9d8..d1daa66ab162c872b84fe4a8050c53f6f997246f 100644 (file)
@@ -18,7 +18,6 @@ wakeup_pmode_return:
        movw    %ax, %gs
 
        # reload the gdt, as we need the full 32 bit address
-       lgdt    saved_gdt
        lidt    saved_idt
        lldt    saved_ldt
        ljmp    $(__KERNEL_CS), $1f
@@ -44,7 +43,6 @@ bogus_magic:
 
 
 save_registers:
-       sgdt    saved_gdt
        sidt    saved_idt
        sldt    saved_ldt
        str     saved_tss
@@ -93,7 +91,6 @@ ENTRY(saved_magic)    .long   0
 ENTRY(saved_eip)       .long   0
 
 # saved registers
-saved_gdt:     .long   0,0
 saved_idt:     .long   0,0
 saved_ldt:     .long   0
 saved_tss:     .long   0
index deef0399fc7859962d9f8477b6218929d40abee4..b0684e4a73aa60ae8edee4d3b729de2b663b079c 100644 (file)
@@ -14,7 +14,6 @@ CFLAGS_common.o               := $(nostackp)
 
 obj-y                  := intel_cacheinfo.o scattered.o topology.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                  += match.o
 
@@ -42,6 +41,8 @@ obj-$(CONFIG_MTRR)                    += mtrr/
 
 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   $@
       cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
 
index 37250fe490b1292185ce55d95dae254be23e1c77..155a13f33ed8aa60f58d2aef7856dd0eb419ecf7 100644 (file)
@@ -20,7 +20,7 @@ static void doublefault_fn(void)
        struct desc_ptr gdt_desc = {0, 0};
        unsigned long gdt, tss;
 
-       store_gdt(&gdt_desc);
+       native_store_gdt(&gdt_desc);
        gdt = gdt_desc.address;
 
        printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
index 8bfb335f74bb377776adb4b6b1da98dc17ed82ae..cd6de64cc480bb755e8102f47df988b61c6a6f76 100644 (file)
@@ -360,7 +360,6 @@ struct pv_cpu_ops pv_cpu_ops = {
        .set_ldt = native_set_ldt,
        .load_gdt = native_load_gdt,
        .load_idt = native_load_idt,
-       .store_gdt = native_store_gdt,
        .store_idt = native_store_idt,
        .store_tr = native_store_tr,
        .load_tls = native_load_tls,
index 6667042714cc65e78208c517ccc0802a40dd4ccf..867b81037f9680d09f745884f7df03e710b45042 100644 (file)
@@ -2459,7 +2459,7 @@ static int hardware_enable(void *garbage)
                ept_sync_global();
        }
 
-       store_gdt(&__get_cpu_var(host_gdt));
+       native_store_gdt(&__get_cpu_var(host_gdt));
 
        return 0;
 }
index 29043d2048a053d65483bbca9ec079c582597142..4a0890f815c40dc2641d092ff7aeaee5cb6f0039 100644 (file)
@@ -1,7 +1,6 @@
 config LGUEST_GUEST
        bool "Lguest guest support"
-       select PARAVIRT
-       depends on X86_32
+       depends on X86_32 && PARAVIRT
        select TTY
        select VIRTUALIZATION
        select VIRTIO
index 3c68768d7a75963d8825f65b3ac28fff2f257361..6d6e907cee4688273e9848b0cfae0149a46d71e4 100644 (file)
@@ -62,11 +62,9 @@ static void __save_processor_state(struct saved_context *ctxt)
         * descriptor tables
         */
 #ifdef CONFIG_X86_32
-       store_gdt(&ctxt->gdt);
        store_idt(&ctxt->idt);
 #else
 /* CONFIG_X86_64 */
-       store_gdt((struct desc_ptr *)&ctxt->gdt_limit);
        store_idt((struct desc_ptr *)&ctxt->idt_limit);
 #endif
        store_tr(ctxt->tr);
@@ -135,7 +133,10 @@ static void fix_processor_context(void)
 {
        int cpu = smp_processor_id();
        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);   /*
                                 * This just modifies memory; should not be
                                 * necessary. But... This is necessary, because
@@ -144,7 +145,9 @@ static void fix_processor_context(void)
                                 */
 
 #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 */
 #endif
@@ -183,11 +186,9 @@ static void __restore_processor_state(struct saved_context *ctxt)
         * ltr is done i fix_processor_context().
         */
 #ifdef CONFIG_X86_32
-       load_gdt(&ctxt->gdt);
        load_idt(&ctxt->idt);
 #else
 /* CONFIG_X86_64 */
-       load_gdt((const struct desc_ptr *)&ctxt->gdt_limit);
        load_idt((const struct desc_ptr *)&ctxt->idt_limit);
 #endif
 
index 131dacd2748a0faedc9986c112652ec52875ab1d..1a3c76505649d8c266c07f808c7fe5aafaadae30 100644 (file)
@@ -4,7 +4,7 @@
 
 config XEN
        bool "Xen guest support"
-       select PARAVIRT
+       depends on PARAVIRT
        select PARAVIRT_CLOCK
        select XEN_HAVE_PVMMU
        depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS)
index ddbd54a9b845d08abf73f3004d637ee8dad72eac..53d4f680c9b59f498d41148325cd5a96ef1723e3 100644 (file)
@@ -1221,7 +1221,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
        .alloc_ldt = xen_alloc_ldt,
        .free_ldt = xen_free_ldt,
 
-       .store_gdt = native_store_gdt,
        .store_idt = native_store_idt,
        .store_tr = xen_store_tr,
 
index 64630f15f1816231ddc83feb88eab58e872cca3d..0403b51d20ba067840af755373871e37fc52575d 100644 (file)
@@ -2,7 +2,7 @@ menu "Microsoft Hyper-V guest support"
 
 config HYPERV
        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
          Select this option to run Linux as a Hyper-V client operating
          system.
index 3659d00efdc5f2013d57a2798e334f4b1f65630f..c002d8660e3053b056220018f5b25b81eccaade5 100644 (file)
@@ -426,7 +426,7 @@ config TI_DAC7512
 
 config VMWARE_BALLOON
        tristate "VMware Balloon Driver"
-       depends on X86
+       depends on X86 && HYPERVISOR_GUEST
        help
          This is VMware physical memory management driver which acts
          like a "balloon" that can be inflated to reclaim physical pages