]> 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

1  2 
arch/x86/Kconfig
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/paravirt_types.h
arch/x86/kernel/acpi/wakeup_32.S
arch/x86/kernel/cpu/Makefile
arch/x86/kernel/paravirt.c
arch/x86/power/cpu.c
arch/x86/xen/enlighten.c
drivers/misc/Kconfig

diff --combined arch/x86/Kconfig
index e93ccb9b1cc1111744c1cd75fd2ddb756f29c73c,e9e4623bd4da971527366182228340e362fd70fd..05b057dca4a70ba4c891c78794e9b67870fbd52b
@@@ -112,7 -112,7 +112,7 @@@ config X8
        select GENERIC_STRNLEN_USER
        select HAVE_CONTEXT_TRACKING if X86_64
        select HAVE_IRQ_TIME_ACCOUNTING
 -      select HAVE_VIRT_TO_BUS
 +      select VIRT_TO_BUS
        select MODULES_USE_ELF_REL if X86_32
        select MODULES_USE_ELF_RELA if X86_64
        select CLONE_BACKWARDS if X86_32
        select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION
        select OLD_SIGACTION if X86_32
        select COMPAT_OLD_SIGACTION if IA32_EMULATION
 +      select RTC_LIB
  
  config INSTRUCTION_DECODER
        def_bool y
@@@ -189,6 -188,9 +189,6 @@@ config GENERIC_CALIBRATE_DELA
  config ARCH_HAS_CPU_RELAX
        def_bool y
  
 -config ARCH_HAS_DEFAULT_IDLE
 -      def_bool y
 -
  config ARCH_HAS_CACHE_LINE_SIZE
        def_bool y
  
@@@ -387,7 -389,7 +387,7 @@@ config X86_NUMACHI
  
  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 -596,17 +594,17 @@@ config SCHED_OMIT_FRAME_POINTE
  
          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"
          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
  
          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
@@@ -1547,7 -1550,6 +1548,7 @@@ config X86_SMA
  config EFI
        bool "EFI runtime service support"
        depends on ACPI
 +      select UCS2_STRING
        ---help---
          This enables the kernel to use EFI runtime services that are
          available (such as the EFI variable services).
index 7361e47db79f50158ada1cdde859c4871b99ee51,736512869950a7a971e0146bc1061805246a5de3..cfdc9ee4c90013d577be1d9be33135ce63245ed7
@@@ -262,10 -262,6 +262,6 @@@ static inline void set_ldt(const void *
  {
        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);
@@@ -703,10 -699,7 +699,10 @@@ static inline void arch_leave_lazy_mmu_
        PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave);
  }
  
 -void arch_flush_lazy_mmu_mode(void);
 +static inline void arch_flush_lazy_mmu_mode(void)
 +{
 +      PVOP_VCALL0(pv_mmu_ops.lazy_mode.flush);
 +}
  
  static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
                                phys_addr_t phys, pgprot_t flags)
index b3b0ec1dac86d91ac6289b961afefe65f1f48d11,b6c69a6917c8bf7554398afc456eccb08cbfbd1a..0db1fcac668cf52b02f26ab3efa0b66e03b2670a
@@@ -91,7 -91,6 +91,7 @@@ struct pv_lazy_ops 
        /* Set deferred update mode, used for batching operations. */
        void (*enter)(void);
        void (*leave)(void);
 +      void (*flush)(void);
  };
  
  struct pv_time_ops {
@@@ -123,7 -122,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);
@@@ -680,7 -679,6 +680,7 @@@ void paravirt_end_context_switch(struc
  
  void paravirt_enter_lazy_mmu(void);
  void paravirt_leave_lazy_mmu(void);
 +void paravirt_flush_lazy_mmu(void);
  
  void _paravirt_nop(void);
  u32 _paravirt_ident_32(u32);
index ced4638c83415717173c7699b9c169b06eb8f9d8,91adb1be24bcdaa8a62235fa45611f09eeb46393..d1daa66ab162c872b84fe4a8050c53f6f997246f
@@@ -1,4 -1,4 +1,4 @@@
 -      .section .text..page_aligned
 +      .text
  #include <linux/linkage.h>
  #include <asm/segment.h>
  #include <asm/page_types.h>
@@@ -18,7 -18,6 +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 +43,6 @@@ bogus_magic
  
  
  save_registers:
-       sgdt    saved_gdt
        sidt    saved_idt
        sldt    saved_ldt
        str     saved_tss
@@@ -93,7 -91,6 +91,6 @@@ ENTRY(saved_magic)    .long   
  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,5f81bcefbe14db8b7ea8f7e47ab528da868bb3f5..b0684e4a73aa60ae8edee4d3b729de2b663b079c
@@@ -14,7 -14,6 +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
  
@@@ -31,7 -30,7 +30,7 @@@ obj-$(CONFIG_CPU_SUP_UMC_32)          += umc.
  obj-$(CONFIG_PERF_EVENTS)             += perf_event.o
  
  ifdef CONFIG_PERF_EVENTS
 -obj-$(CONFIG_CPU_SUP_AMD)             += perf_event_amd.o
 +obj-$(CONFIG_CPU_SUP_AMD)             += perf_event_amd.o perf_event_amd_uncore.o
  obj-$(CONFIG_CPU_SUP_INTEL)           += perf_event_p6.o perf_event_knc.o perf_event_p4.o
  obj-$(CONFIG_CPU_SUP_INTEL)           += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
  obj-$(CONFIG_CPU_SUP_INTEL)           += perf_event_intel_uncore.o
@@@ -42,11 -41,13 +41,13 @@@ 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 = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
 +      cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
  
  cpufeature = $(src)/../../include/asm/cpufeature.h
  
  targets += capflags.c
 -$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.pl FORCE
 +$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE
        $(call if_changed,mkcapflags)
index 8bfb335f74bb377776adb4b6b1da98dc17ed82ae,4ae3d2305db1ac13540f87a235968f5259ad23cd..cd6de64cc480bb755e8102f47df988b61c6a6f76
@@@ -263,18 -263,6 +263,18 @@@ void paravirt_leave_lazy_mmu(void
        leave_lazy(PARAVIRT_LAZY_MMU);
  }
  
 +void paravirt_flush_lazy_mmu(void)
 +{
 +      preempt_disable();
 +
 +      if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
 +              arch_leave_lazy_mmu_mode();
 +              arch_enter_lazy_mmu_mode();
 +      }
 +
 +      preempt_enable();
 +}
 +
  void paravirt_start_context_switch(struct task_struct *prev)
  {
        BUG_ON(preemptible());
@@@ -304,6 -292,18 +304,6 @@@ enum paravirt_lazy_mode paravirt_get_la
        return this_cpu_read(paravirt_lazy_mode);
  }
  
 -void arch_flush_lazy_mmu_mode(void)
 -{
 -      preempt_disable();
 -
 -      if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
 -              arch_leave_lazy_mmu_mode();
 -              arch_enter_lazy_mmu_mode();
 -      }
 -
 -      preempt_enable();
 -}
 -
  struct pv_info pv_info = {
        .name = "bare hardware",
        .paravirt_enabled = 0,
@@@ -360,7 -360,6 +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,
@@@ -475,7 -474,6 +474,7 @@@ struct pv_mmu_ops pv_mmu_ops = 
        .lazy_mode = {
                .enter = paravirt_nop,
                .leave = paravirt_nop,
 +              .flush = paravirt_nop,
        },
  
        .set_fixmap = native_set_fixmap,
diff --combined arch/x86/power/cpu.c
index 3c68768d7a75963d8825f65b3ac28fff2f257361,168da8429032cbc94ba02fa77b6428be5c57e92e..6d6e907cee4688273e9848b0cfae0149a46d71e4
@@@ -11,7 -11,6 +11,7 @@@
  #include <linux/suspend.h>
  #include <linux/export.h>
  #include <linux/smp.h>
 +#include <linux/perf_event.h>
  
  #include <asm/pgtable.h>
  #include <asm/proto.h>
@@@ -62,11 -61,9 +62,9 @@@ static void __save_processor_state(stru
         * 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 -132,10 +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
                                 */
  
  #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 -185,9 +186,9 @@@ static void __restore_processor_state(s
         * 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
  
        do_fpu_end();
        x86_platform.restore_sched_clock_state();
        mtrr_bp_restore();
 +      perf_restore_debug_store();
  }
  
  /* Needed by apm.c */
diff --combined arch/x86/xen/enlighten.c
index ddbd54a9b845d08abf73f3004d637ee8dad72eac,ddab5390d5482659eda2a0d363f0950bdc8b39b4..53d4f680c9b59f498d41148325cd5a96ef1723e3
@@@ -31,7 -31,6 +31,7 @@@
  #include <linux/pci.h>
  #include <linux/gfp.h>
  #include <linux/memblock.h>
 +#include <linux/edd.h>
  
  #include <xen/xen.h>
  #include <xen/events.h>
@@@ -1221,7 -1220,6 +1221,6 @@@ static const struct pv_cpu_ops xen_cpu_
        .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,
  
@@@ -1307,55 -1305,6 +1306,55 @@@ static const struct machine_ops xen_mac
        .emergency_restart = xen_emergency_restart,
  };
  
 +static void __init xen_boot_params_init_edd(void)
 +{
 +#if IS_ENABLED(CONFIG_EDD)
 +      struct xen_platform_op op;
 +      struct edd_info *edd_info;
 +      u32 *mbr_signature;
 +      unsigned nr;
 +      int ret;
 +
 +      edd_info = boot_params.eddbuf;
 +      mbr_signature = boot_params.edd_mbr_sig_buffer;
 +
 +      op.cmd = XENPF_firmware_info;
 +
 +      op.u.firmware_info.type = XEN_FW_DISK_INFO;
 +      for (nr = 0; nr < EDDMAXNR; nr++) {
 +              struct edd_info *info = edd_info + nr;
 +
 +              op.u.firmware_info.index = nr;
 +              info->params.length = sizeof(info->params);
 +              set_xen_guest_handle(op.u.firmware_info.u.disk_info.edd_params,
 +                                   &info->params);
 +              ret = HYPERVISOR_dom0_op(&op);
 +              if (ret)
 +                      break;
 +
 +#define C(x) info->x = op.u.firmware_info.u.disk_info.x
 +              C(device);
 +              C(version);
 +              C(interface_support);
 +              C(legacy_max_cylinder);
 +              C(legacy_max_head);
 +              C(legacy_sectors_per_track);
 +#undef C
 +      }
 +      boot_params.eddbuf_entries = nr;
 +
 +      op.u.firmware_info.type = XEN_FW_DISK_MBR_SIGNATURE;
 +      for (nr = 0; nr < EDD_MBR_SIG_MAX; nr++) {
 +              op.u.firmware_info.index = nr;
 +              ret = HYPERVISOR_dom0_op(&op);
 +              if (ret)
 +                      break;
 +              mbr_signature[nr] = op.u.firmware_info.u.disk_mbr_signature.mbr_signature;
 +      }
 +      boot_params.edd_mbr_sig_buf_entries = nr;
 +#endif
 +}
 +
  /*
   * Set up the GDT and segment registers for -fstack-protector.  Until
   * we do this, we have to be careful not to call any stack-protected
@@@ -1558,8 -1507,6 +1557,8 @@@ asmlinkage void __init xen_start_kernel
                /* Avoid searching for BIOS MP tables */
                x86_init.mpparse.find_smp_config = x86_init_noop;
                x86_init.mpparse.get_smp_config = x86_init_uint_noop;
 +
 +              xen_boot_params_init_edd();
        }
  #ifdef CONFIG_PCI
        /* PCI BIOS service won't work from a PV guest. */
@@@ -1641,11 -1588,8 +1640,11 @@@ static int __cpuinit xen_hvm_cpu_notify
        switch (action) {
        case CPU_UP_PREPARE:
                xen_vcpu_setup(cpu);
 -              if (xen_have_vector_callback)
 +              if (xen_have_vector_callback) {
                        xen_init_lock_cpu(cpu);
 +                      if (xen_feature(XENFEAT_hvm_safe_pvclock))
 +                              xen_setup_timer(cpu);
 +              }
                break;
        default:
                break;
diff --combined drivers/misc/Kconfig
index 3659d00efdc5f2013d57a2798e334f4b1f65630f,891123e319329bcb803a56e17b2e179563ff528a..c002d8660e3053b056220018f5b25b81eccaade5
@@@ -93,14 -93,6 +93,14 @@@ config ATMEL_TCB_CLKSRC_BLOC
          TC can be used for other purposes, such as PWM generation and
          interval timing.
  
 +config DUMMY_IRQ
 +      tristate "Dummy IRQ handler"
 +      default n
 +      ---help---
 +        This module accepts a single 'irq' parameter, which it should register for.
 +        The sole purpose of this module is to help with debugging of systems on
 +        which spurious IRQs would happen on disabled IRQ vector.
 +
  config IBM_ASM
        tristate "Device driver for IBM RSA service processor"
        depends on X86 && PCI && INPUT
@@@ -406,7 -398,7 +406,7 @@@ config DS168
  
  config SPEAR13XX_PCIE_GADGET
        bool "PCIe gadget support for SPEAr13XX platform"
 -      depends on ARCH_SPEAR13XX
 +      depends on ARCH_SPEAR13XX && BROKEN
        default n
        help
         This option enables gadget support for PCIe controller. If
@@@ -426,7 -418,7 +426,7 @@@ config TI_DAC751
  
  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
@@@ -518,15 -510,6 +518,15 @@@ config LATTICE_ECP3_CONFI
  
          If unsure, say N.
  
 +config SRAM
 +      bool "Generic on-chip SRAM driver"
 +      depends on HAS_IOMEM
 +      select GENERIC_ALLOCATOR
 +      help
 +        This driver allows you to declare a memory region to be managed by
 +        the genalloc API. It is supposed to be used for small on-chip SRAM
 +        areas found on many SoCs.
 +
  source "drivers/misc/c2port/Kconfig"
  source "drivers/misc/eeprom/Kconfig"
  source "drivers/misc/cb710/Kconfig"