]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Merge branch 'x86/cpu' into x86/core
authorH. Peter Anvin <hpa@zytor.com>
Thu, 4 Sep 2008 15:08:42 +0000 (08:08 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 4 Sep 2008 15:08:42 +0000 (08:08 -0700)
Conflicts:

arch/x86/kernel/cpu/feature_names.c
include/asm-x86/cpufeature.h

38 files changed:
1  2 
Documentation/kernel-parameters.txt
arch/x86/Kconfig
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/apic_32.c
arch/x86/kernel/apic_64.c
arch/x86/kernel/cpu/common_64.c
arch/x86/kernel/cpu/mtrr/main.c
arch/x86/kernel/genx2apic_uv_x.c
arch/x86/kernel/mpparse.c
arch/x86/kernel/numaq_32.c
arch/x86/kernel/paravirt.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/setup.c
arch/x86/kernel/smpboot.c
arch/x86/mm/ioremap.c
include/asm-x86/amd_iommu_types.h
include/asm-x86/atomic_64.h
include/asm-x86/bugs.h
include/asm-x86/cpufeature.h
include/asm-x86/genapic_32.h
include/asm-x86/genapic_64.h
include/asm-x86/geode.h
include/asm-x86/io.h
include/asm-x86/irq_vectors.h
include/asm-x86/kexec.h
include/asm-x86/mce.h
include/asm-x86/mman.h
include/asm-x86/mmconfig.h
include/asm-x86/mmzone_32.h
include/asm-x86/msr.h
include/asm-x86/percpu.h
include/asm-x86/pgtable_64.h
include/asm-x86/processor.h
include/asm-x86/required-features.h
include/asm-x86/spinlock.h
include/asm-x86/uv/uv_bau.h
include/asm-x86/xen/hypervisor.h

index 0f130a4f9ba3195ab21305a656df222990599c61,1150444a21ab64140f13e706797f16664e28244f..ba27dd98a18ef81719b5cc0f47b579bfda18a471
@@@ -365,6 -365,8 +365,8 @@@ and is between 256 and 4096 characters
                        no delay (0).
                        Format: integer
  
+       bootmem_debug   [KNL] Enable bootmem allocator debug messages.
        bttv.card=      [HW,V4L] bttv (bt848 + bt878 based grabber cards)
        bttv.radio=     Most important insmod options are available as
                        kernel args too.
  
                        * [no]ncq: Turn on or off NCQ.
  
+                       * nohrst, nosrst, norst: suppress hard, soft
+                           and both resets.
                        If there are multiple matching configurations changing
                        the same attribute, the last one is used.
  
  
        nolapic_timer   [X86-32,APIC] Do not use the local APIC timer.
  
 +      nox2apic        [X86-64,APIC] Do not enable x2APIC mode.
 +
 +      x2apic_phys     [X86-64,APIC] Use x2apic physical mode instead of
 +                      default x2apic cluster mode on platforms
 +                      supporting x2apic.
 +
        noltlbs         [PPC] Do not use large page/tlb entries for kernel
                        lowmem mapping on PPC40x.
  
diff --combined arch/x86/Kconfig
index 53ab36878736ab4c65bded4b22314256f2c54000,68d91c8233f42162039af96c8ed1fdd3e1d6a88e..0a80d6a5e9f1199fb85b49821f1cb6fee6c69bd1
@@@ -951,9 -951,9 +951,9 @@@ config NUM
          local memory controller of the CPU and add some more
          NUMA awareness to the kernel.
  
-         For i386 this is currently highly experimental and should be only
+         For 32-bit this is currently highly experimental and should be only
          used for kernel development. It might also cause boot failures.
-         For x86_64 this is recommended on all multiprocessor Opteron systems.
+         For 64-bit this is recommended on all multiprocessor Opteron systems.
          If the system is EM64T, you should say N unless your system is
          EM64T NUMA.
  
@@@ -1263,7 -1263,7 +1263,7 @@@ config KEXE
          strongly in flux, so no good recommendation can be made.
  
  config CRASH_DUMP
-       bool "kernel crash dumps (EXPERIMENTAL)"
+       bool "kernel crash dumps"
        depends on X86_64 || (X86_32 && HIGHMEM)
        help
          Generate crash dump after being started by kexec.
@@@ -1657,14 -1657,6 +1657,14 @@@ config DMAR_FLOPPY_W
         workaround will setup a 1:1 mapping for the first
         16M to make floppy (an ISA device) work.
  
 +config INTR_REMAP
 +      bool "Support for Interrupt Remapping (EXPERIMENTAL)"
 +      depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL
 +      help
 +       Supports Interrupt remapping for IO-APIC and MSI devices.
 +       To use x2apic mode in the CPU's which support x2APIC enhancements or
 +       to support platforms with CPU's having > 8 bit APIC ID, say Y.
 +
  source "drivers/pci/pcie/Kconfig"
  
  source "drivers/pci/Kconfig"
index 12e260e8fb2a9c35a2434bf13d156187191fc257,bfd10fd211cd30f4e0867c8bbfd8458461aec3c8..27ef365e757da7cb55cc9a3ade5b6110b2080326
@@@ -97,6 -97,8 +97,8 @@@ static u64 acpi_lapic_addr __initdata 
  #warning ACPI uses CMPXCHG, i486 and later hardware
  #endif
  
+ static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
  /* --------------------------------------------------------------------------
                                Boot-time Configuration
     -------------------------------------------------------------------------- */
@@@ -158,6 -160,14 +160,14 @@@ char *__init __acpi_map_table(unsigned 
  struct acpi_mcfg_allocation *pci_mmcfg_config;
  int pci_mmcfg_config_num;
  
+ static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
+ {
+       if (!strcmp(mcfg->header.oem_id, "SGI"))
+               acpi_mcfg_64bit_base_addr = TRUE;
+       return 0;
+ }
  int __init acpi_parse_mcfg(struct acpi_table_header *header)
  {
        struct acpi_table_mcfg *mcfg;
        }
  
        memcpy(pci_mmcfg_config, &mcfg[1], config_size);
+       acpi_mcfg_oem_check(mcfg);
        for (i = 0; i < pci_mmcfg_config_num; ++i) {
-               if (pci_mmcfg_config[i].address > 0xFFFFFFFF) {
+               if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) &&
+                   !acpi_mcfg_64bit_base_addr) {
                        printk(KERN_ERR PREFIX
                               "MMCONFIG not in low 4GB of memory\n");
                        kfree(pci_mmcfg_config);
@@@ -761,7 -775,7 +775,7 @@@ static void __init acpi_register_lapic_
  
        set_fixmap_nocache(FIX_APIC_BASE, address);
        if (boot_cpu_physical_apicid == -1U) {
 -              boot_cpu_physical_apicid  = GET_APIC_ID(read_apic_id());
 +              boot_cpu_physical_apicid  = read_apic_id();
  #ifdef CONFIG_X86_32
                apic_version[boot_cpu_physical_apicid] =
                         GET_APIC_VERSION(apic_read(APIC_LVR));
@@@ -1337,9 -1351,7 +1351,9 @@@ static void __init acpi_process_madt(vo
                                acpi_ioapic = 1;
  
                                smp_found_config = 1;
 +#ifdef CONFIG_X86_32
                                setup_apic_routing();
 +#endif
                        }
                }
                if (error == -EINVAL) {
index 12b154822bce197ebd4f4e58b6fa1ab97220dadd,f88bd0d982b08540889e991c42a019344002d3d3..584272105051ed8f2a71c173595756cd40df37bf
@@@ -145,18 -145,13 +145,18 @@@ static int modern_apic(void
        return lapic_get_version() >= 0x14;
  }
  
 -void apic_wait_icr_idle(void)
 +/*
 + * Paravirt kernels also might be using these below ops. So we still
 + * use generic apic_read()/apic_write(), which might be pointing to different
 + * ops in PARAVIRT case.
 + */
 +void xapic_wait_icr_idle(void)
  {
        while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
                cpu_relax();
  }
  
 -u32 safe_apic_wait_icr_idle(void)
 +u32 safe_xapic_wait_icr_idle(void)
  {
        u32 send_status;
        int timeout;
        return send_status;
  }
  
 +void xapic_icr_write(u32 low, u32 id)
 +{
 +      apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id));
 +      apic_write(APIC_ICR, low);
 +}
 +
 +u64 xapic_icr_read(void)
 +{
 +      u32 icr1, icr2;
 +
 +      icr2 = apic_read(APIC_ICR2);
 +      icr1 = apic_read(APIC_ICR);
 +
 +      return icr1 | ((u64)icr2 << 32);
 +}
 +
 +static struct apic_ops xapic_ops = {
 +      .read = native_apic_mem_read,
 +      .write = native_apic_mem_write,
 +      .icr_read = xapic_icr_read,
 +      .icr_write = xapic_icr_write,
 +      .wait_icr_idle = xapic_wait_icr_idle,
 +      .safe_wait_icr_idle = safe_xapic_wait_icr_idle,
 +};
 +
 +struct apic_ops __read_mostly *apic_ops = &xapic_ops;
 +EXPORT_SYMBOL_GPL(apic_ops);
 +
  /**
   * enable_NMI_through_LVT0 - enable NMI through local vector table 0
   */
  void __cpuinit enable_NMI_through_LVT0(void)
  {
 -      unsigned int v = APIC_DM_NMI;
 +      unsigned int v;
  
 -      /* Level triggered for 82489DX */
 +      /* unmask and set to NMI */
 +      v = APIC_DM_NMI;
 +
 +      /* Level triggered for 82489DX (32bit mode) */
        if (!lapic_is_integrated())
                v |= APIC_LVT_LEVEL_TRIGGER;
 +
        apic_write(APIC_LVT0, v);
  }
  
@@@ -230,13 -193,9 +230,13 @@@ int get_physical_broadcast(void
   */
  int lapic_get_maxlvt(void)
  {
 -      unsigned int v = apic_read(APIC_LVR);
 +      unsigned int v;
  
 -      /* 82489DXs do not report # of LVT entries. */
 +      v = apic_read(APIC_LVR);
 +      /*
 +       * - we always have APIC integrated on 64bit mode
 +       * - 82489DXs do not report # of LVT entries
 +       */
        return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2;
  }
  
@@@ -1246,7 -1205,7 +1246,7 @@@ void __init init_apic_mappings(void
         * default configuration (or the MP table is broken).
         */
        if (boot_cpu_physical_apicid == -1U)
 -              boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
 +              boot_cpu_physical_apicid = read_apic_id();
  
  }
  
@@@ -1283,7 -1242,7 +1283,7 @@@ int __init APIC_init_uniprocessor(void
         * might be zero if read from MP tables. Get it from LAPIC.
         */
  #ifdef CONFIG_CRASH_DUMP
 -      boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
 +      boot_cpu_physical_apicid = read_apic_id();
  #endif
        physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
  
@@@ -1362,6 -1321,54 +1362,6 @@@ void smp_error_interrupt(struct pt_reg
        irq_exit();
  }
  
 -#ifdef CONFIG_SMP
 -void __init smp_intr_init(void)
 -{
 -      /*
 -       * IRQ0 must be given a fixed assignment and initialized,
 -       * because it's used before the IO-APIC is set up.
 -       */
 -      set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]);
 -
 -      /*
 -       * The reschedule interrupt is a CPU-to-CPU reschedule-helper
 -       * IPI, driven by wakeup.
 -       */
 -      alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
 -
 -      /* IPI for invalidation */
 -      alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt);
 -
 -      /* IPI for generic function call */
 -      alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
 -
 -      /* IPI for single call function */
 -      set_intr_gate(CALL_FUNCTION_SINGLE_VECTOR,
 -                              call_function_single_interrupt);
 -}
 -#endif
 -
 -/*
 - * Initialize APIC interrupts
 - */
 -void __init apic_intr_init(void)
 -{
 -#ifdef CONFIG_SMP
 -      smp_intr_init();
 -#endif
 -      /* self generated IPI for local APIC timer */
 -      alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
 -
 -      /* IPI vectors for APIC spurious and error interrupts */
 -      alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
 -      alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
 -
 -      /* thermal monitor LVT interrupt */
 -#ifdef CONFIG_X86_MCE_P4THERMAL
 -      alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
 -#endif
 -}
 -
  /**
   * connect_bsp_APIC - attach the APIC to the interrupt system
   */
@@@ -1447,8 -1454,6 +1447,6 @@@ void disconnect_bsp_APIC(int virt_wire_
        }
  }
  
- unsigned int __cpuinitdata maxcpus = NR_CPUS;
  void __cpuinit generic_processor_info(int apicid, int version)
  {
        int cpu;
                return;
        }
  
-       if (num_processors >= maxcpus) {
-               printk(KERN_WARNING "WARNING: maxcpus limit of %i reached."
-                       " Processor ignored.\n", maxcpus);
-               return;
-       }
        num_processors++;
        cpus_complement(tmp_map, cpu_present_map);
        cpu = first_cpu(tmp_map);
index 69a876be506fc647df977b64881d4257c623e9c1,446c062e831cf46ce8ca276f38ee95a216049a93..1a6011855af305cd2956f990040c17e9f313653e
@@@ -27,7 -27,6 +27,7 @@@
  #include <linux/clockchips.h>
  #include <linux/acpi_pmtmr.h>
  #include <linux/module.h>
 +#include <linux/dmar.h>
  
  #include <asm/atomic.h>
  #include <asm/smp.h>
@@@ -40,7 -39,6 +40,7 @@@
  #include <asm/proto.h>
  #include <asm/timex.h>
  #include <asm/apic.h>
 +#include <asm/i8259.h>
  
  #include <mach_ipi.h>
  #include <mach_apic.h>
  static int disable_apic_timer __cpuinitdata;
  static int apic_calibrate_pmtmr __initdata;
  int disable_apic;
 +int disable_x2apic;
 +int x2apic;
 +
 +/* x2apic enabled before OS handover */
 +int x2apic_preenabled;
  
  /* Local APIC timer works in C2 */
  int local_apic_timer_c2_ok;
@@@ -97,7 -90,6 +97,6 @@@ static unsigned long apic_phys
  
  unsigned long mp_lapic_addr;
  
- unsigned int __cpuinitdata maxcpus = NR_CPUS;
  /*
   * Get the LAPIC version
   */
@@@ -126,13 -118,13 +125,13 @@@ static int modern_apic(void
        return lapic_get_version() >= 0x14;
  }
  
 -void apic_wait_icr_idle(void)
 +void xapic_wait_icr_idle(void)
  {
        while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
                cpu_relax();
  }
  
 -u32 safe_apic_wait_icr_idle(void)
 +u32 safe_xapic_wait_icr_idle(void)
  {
        u32 send_status;
        int timeout;
        return send_status;
  }
  
 +void xapic_icr_write(u32 low, u32 id)
 +{
 +      apic_write(APIC_ICR2, id << 24);
 +      apic_write(APIC_ICR, low);
 +}
 +
 +u64 xapic_icr_read(void)
 +{
 +      u32 icr1, icr2;
 +
 +      icr2 = apic_read(APIC_ICR2);
 +      icr1 = apic_read(APIC_ICR);
 +
 +      return (icr1 | ((u64)icr2 << 32));
 +}
 +
 +static struct apic_ops xapic_ops = {
 +      .read = native_apic_mem_read,
 +      .write = native_apic_mem_write,
 +      .icr_read = xapic_icr_read,
 +      .icr_write = xapic_icr_write,
 +      .wait_icr_idle = xapic_wait_icr_idle,
 +      .safe_wait_icr_idle = safe_xapic_wait_icr_idle,
 +};
 +
 +struct apic_ops __read_mostly *apic_ops = &xapic_ops;
 +
 +EXPORT_SYMBOL_GPL(apic_ops);
 +
 +static void x2apic_wait_icr_idle(void)
 +{
 +      /* no need to wait for icr idle in x2apic */
 +      return;
 +}
 +
 +static u32 safe_x2apic_wait_icr_idle(void)
 +{
 +      /* no need to wait for icr idle in x2apic */
 +      return 0;
 +}
 +
 +void x2apic_icr_write(u32 low, u32 id)
 +{
 +      wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low);
 +}
 +
 +u64 x2apic_icr_read(void)
 +{
 +      unsigned long val;
 +
 +      rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val);
 +      return val;
 +}
 +
 +static struct apic_ops x2apic_ops = {
 +      .read = native_apic_msr_read,
 +      .write = native_apic_msr_write,
 +      .icr_read = x2apic_icr_read,
 +      .icr_write = x2apic_icr_write,
 +      .wait_icr_idle = x2apic_wait_icr_idle,
 +      .safe_wait_icr_idle = safe_x2apic_wait_icr_idle,
 +};
 +
  /**
   * enable_NMI_through_LVT0 - enable NMI through local vector table 0
   */
@@@ -220,11 -149,6 +219,11 @@@ void __cpuinit enable_NMI_through_LVT0(
  
        /* unmask and set to NMI */
        v = APIC_DM_NMI;
 +
 +      /* Level triggered for 82489DX (32bit mode) */
 +      if (!lapic_is_integrated())
 +              v |= APIC_LVT_LEVEL_TRIGGER;
 +
        apic_write(APIC_LVT0, v);
  }
  
   */
  int lapic_get_maxlvt(void)
  {
 -      unsigned int v, maxlvt;
 +      unsigned int v;
  
        v = apic_read(APIC_LVR);
 -      maxlvt = GET_APIC_MAXLVT(v);
 -      return maxlvt;
 +      /*
 +       * - we always have APIC integrated on 64bit mode
 +       * - 82489DXs do not report # of LVT entries
 +       */
 +      return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2;
  }
  
  /*
@@@ -708,10 -629,10 +707,10 @@@ int __init verify_local_APIC(void
        /*
         * The ID register is read/write in a real APIC.
         */
 -      reg0 = read_apic_id();
 +      reg0 = apic_read(APIC_ID);
        apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0);
        apic_write(APIC_ID, reg0 ^ APIC_ID_MASK);
 -      reg1 = read_apic_id();
 +      reg1 = apic_read(APIC_ID);
        apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1);
        apic_write(APIC_ID, reg0);
        if (reg1 != (reg0 ^ APIC_ID_MASK))
@@@ -912,125 -833,6 +911,125 @@@ void __cpuinit end_local_APIC_setup(voi
        apic_pm_activate();
  }
  
 +void check_x2apic(void)
 +{
 +      int msr, msr2;
 +
 +      rdmsr(MSR_IA32_APICBASE, msr, msr2);
 +
 +      if (msr & X2APIC_ENABLE) {
 +              printk("x2apic enabled by BIOS, switching to x2apic ops\n");
 +              x2apic_preenabled = x2apic = 1;
 +              apic_ops = &x2apic_ops;
 +      }
 +}
 +
 +void enable_x2apic(void)
 +{
 +      int msr, msr2;
 +
 +      rdmsr(MSR_IA32_APICBASE, msr, msr2);
 +      if (!(msr & X2APIC_ENABLE)) {
 +              printk("Enabling x2apic\n");
 +              wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0);
 +      }
 +}
 +
 +void enable_IR_x2apic(void)
 +{
 +#ifdef CONFIG_INTR_REMAP
 +      int ret;
 +      unsigned long flags;
 +
 +      if (!cpu_has_x2apic)
 +              return;
 +
 +      if (!x2apic_preenabled && disable_x2apic) {
 +              printk(KERN_INFO
 +                     "Skipped enabling x2apic and Interrupt-remapping "
 +                     "because of nox2apic\n");
 +              return;
 +      }
 +
 +      if (x2apic_preenabled && disable_x2apic)
 +              panic("Bios already enabled x2apic, can't enforce nox2apic");
 +
 +      if (!x2apic_preenabled && skip_ioapic_setup) {
 +              printk(KERN_INFO
 +                     "Skipped enabling x2apic and Interrupt-remapping "
 +                     "because of skipping io-apic setup\n");
 +              return;
 +      }
 +
 +      ret = dmar_table_init();
 +      if (ret) {
 +              printk(KERN_INFO
 +                     "dmar_table_init() failed with %d:\n", ret);
 +
 +              if (x2apic_preenabled)
 +                      panic("x2apic enabled by bios. But IR enabling failed");
 +              else
 +                      printk(KERN_INFO
 +                             "Not enabling x2apic,Intr-remapping\n");
 +              return;
 +      }
 +
 +      local_irq_save(flags);
 +      mask_8259A();
 +      save_mask_IO_APIC_setup();
 +
 +      ret = enable_intr_remapping(1);
 +
 +      if (ret && x2apic_preenabled) {
 +              local_irq_restore(flags);
 +              panic("x2apic enabled by bios. But IR enabling failed");
 +      }
 +
 +      if (ret)
 +              goto end;
 +
 +      if (!x2apic) {
 +              x2apic = 1;
 +              apic_ops = &x2apic_ops;
 +              enable_x2apic();
 +      }
 +end:
 +      if (ret)
 +              /*
 +               * IR enabling failed
 +               */
 +              restore_IO_APIC_setup();
 +      else
 +              reinit_intr_remapped_IO_APIC(x2apic_preenabled);
 +
 +      unmask_8259A();
 +      local_irq_restore(flags);
 +
 +      if (!ret) {
 +              if (!x2apic_preenabled)
 +                      printk(KERN_INFO
 +                             "Enabled x2apic and interrupt-remapping\n");
 +              else
 +                      printk(KERN_INFO
 +                             "Enabled Interrupt-remapping\n");
 +      } else
 +              printk(KERN_ERR
 +                     "Failed to enable Interrupt-remapping and x2apic\n");
 +#else
 +      if (!cpu_has_x2apic)
 +              return;
 +
 +      if (x2apic_preenabled)
 +              panic("x2apic enabled prior OS handover,"
 +                    " enable CONFIG_INTR_REMAP");
 +
 +      printk(KERN_INFO "Enable CONFIG_INTR_REMAP for enabling intr-remapping "
 +             " and x2apic\n");
 +#endif
 +
 +      return;
 +}
 +
  /*
   * Detect and enable local APICs on non-SMP boards.
   * Original code written by Keir Fraser.
@@@ -1070,7 -872,7 +1069,7 @@@ void __init early_init_lapic_mapping(vo
         * Fetch the APIC ID of the BSP in case we have a
         * default configuration (or the MP table is broken).
         */
 -      boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
 +      boot_cpu_physical_apicid = read_apic_id();
  }
  
  /**
   */
  void __init init_apic_mappings(void)
  {
 +      if (x2apic) {
 +              boot_cpu_physical_apicid = read_apic_id();
 +              return;
 +      }
 +
        /*
         * If no local APIC can be found then set up a fake all
         * zeroes page to simulate the local APIC and another
         * Fetch the APIC ID of the BSP in case we have a
         * default configuration (or the MP table is broken).
         */
 -      boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
 +      boot_cpu_physical_apicid = read_apic_id();
  }
  
  /*
@@@ -1121,9 -918,6 +1120,9 @@@ int __init APIC_init_uniprocessor(void
                return -1;
        }
  
 +      enable_IR_x2apic();
 +      setup_apic_routing();
 +
        verify_local_APIC();
  
        connect_bsp_APIC();
@@@ -1267,12 -1061,6 +1266,6 @@@ void __cpuinit generic_processor_info(i
                return;
        }
  
-       if (num_processors >= maxcpus) {
-               printk(KERN_WARNING "WARNING: maxcpus limit of %i reached."
-                      " Processor ignored.\n", maxcpus);
-               return;
-       }
        num_processors++;
        cpus_complement(tmp_map, cpu_present_map);
        cpu = first_cpu(tmp_map);
        cpu_set(cpu, cpu_present_map);
  }
  
 +int hard_smp_processor_id(void)
 +{
 +      return read_apic_id();
 +}
 +
  /*
   * Power management
   */
@@@ -1346,7 -1129,7 +1339,7 @@@ static int lapic_suspend(struct sys_dev
  
        maxlvt = lapic_get_maxlvt();
  
 -      apic_pm_state.apic_id = read_apic_id();
 +      apic_pm_state.apic_id = apic_read(APIC_ID);
        apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI);
        apic_pm_state.apic_ldr = apic_read(APIC_LDR);
        apic_pm_state.apic_dfr = apic_read(APIC_DFR);
@@@ -1381,14 -1164,10 +1374,14 @@@ static int lapic_resume(struct sys_devi
        maxlvt = lapic_get_maxlvt();
  
        local_irq_save(flags);
 -      rdmsr(MSR_IA32_APICBASE, l, h);
 -      l &= ~MSR_IA32_APICBASE_BASE;
 -      l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
 -      wrmsr(MSR_IA32_APICBASE, l, h);
 +      if (!x2apic) {
 +              rdmsr(MSR_IA32_APICBASE, l, h);
 +              l &= ~MSR_IA32_APICBASE_BASE;
 +              l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
 +              wrmsr(MSR_IA32_APICBASE, l, h);
 +      } else
 +              enable_x2apic();
 +
        apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
        apic_write(APIC_ID, apic_pm_state.apic_id);
        apic_write(APIC_DFR, apic_pm_state.apic_dfr);
@@@ -1528,15 -1307,6 +1521,15 @@@ __cpuinit int apic_is_clustered_box(voi
        return (clusters > 2);
  }
  
 +static __init int setup_nox2apic(char *str)
 +{
 +      disable_x2apic = 1;
 +      clear_cpu_cap(&boot_cpu_data, X86_FEATURE_X2APIC);
 +      return 0;
 +}
 +early_param("nox2apic", setup_nox2apic);
 +
 +
  /*
   * APIC command line parameters
   */
index cc6efe86249d3490059d1340799d92d6e95992ca,c3afba5a81a7bfb1780e715c153349de42106df2..35d11efdf1feffa59603e538a60bac6530649a11
@@@ -18,6 -18,7 +18,7 @@@
  #include <asm/mtrr.h>
  #include <asm/mce.h>
  #include <asm/pat.h>
+ #include <asm/asm.h>
  #include <asm/numa.h>
  #ifdef CONFIG_X86_LOCAL_APIC
  #include <asm/mpspec.h>
@@@ -215,6 -216,39 +216,39 @@@ static void __init early_cpu_support_pr
        }
  }
  
+ /*
+  * The NOPL instruction is supposed to exist on all CPUs with
+  * family >= 6, unfortunately, that's not true in practice because
+  * of early VIA chips and (more importantly) broken virtualizers that
+  * are not easy to detect.  Hence, probe for it based on first
+  * principles.
+  *
+  * Note: no 64-bit chip is known to lack these, but put the code here
+  * for consistency with 32 bits, and to make it utterly trivial to
+  * diagnose the problem should it ever surface.
+  */
+ static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
+ {
+       const u32 nopl_signature = 0x888c53b1; /* Random number */
+       u32 has_nopl = nopl_signature;
+       clear_cpu_cap(c, X86_FEATURE_NOPL);
+       if (c->x86 >= 6) {
+               asm volatile("\n"
+                            "1:      .byte 0x0f,0x1f,0xc0\n" /* nopl %eax */
+                            "2:\n"
+                            "        .section .fixup,\"ax\"\n"
+                            "3:      xor %0,%0\n"
+                            "        jmp 2b\n"
+                            "        .previous\n"
+                            _ASM_EXTABLE(1b,3b)
+                            : "+a" (has_nopl));
+               if (has_nopl == nopl_signature)
+                       set_cpu_cap(c, X86_FEATURE_NOPL);
+       }
+ }
  static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c);
  
  void __init early_cpu_init(void)
@@@ -313,6 -347,8 +347,8 @@@ static void __cpuinit early_identify_cp
                c->x86_phys_bits = eax & 0xff;
        }
  
+       detect_nopl(c);
        if (c->x86_vendor != X86_VENDOR_UNKNOWN &&
            cpu_devs[c->x86_vendor]->c_early_init)
                cpu_devs[c->x86_vendor]->c_early_init(c);
@@@ -493,20 -529,17 +529,20 @@@ void pda_init(int cpu
                /* others are initialized in smpboot.c */
                pda->pcurrent = &init_task;
                pda->irqstackptr = boot_cpu_stack;
 +              pda->irqstackptr += IRQSTACKSIZE - 64;
        } else {
 -              pda->irqstackptr = (char *)
 -                      __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER);
 -              if (!pda->irqstackptr)
 -                      panic("cannot allocate irqstack for cpu %d", cpu);
 +              if (!pda->irqstackptr) {
 +                      pda->irqstackptr = (char *)
 +                              __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER);
 +                      if (!pda->irqstackptr)
 +                              panic("cannot allocate irqstack for cpu %d",
 +                                    cpu);
 +                      pda->irqstackptr += IRQSTACKSIZE - 64;
 +              }
  
                if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE)
                        pda->nodenumber = cpu_to_node(cpu);
        }
 -
 -      pda->irqstackptr += IRQSTACKSIZE-64;
  }
  
  char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ +
@@@ -600,28 -633,23 +636,28 @@@ void __cpuinit cpu_init(void
        barrier();
  
        check_efer();
 +      if (cpu != 0 && x2apic)
 +              enable_x2apic();
  
        /*
         * set up and load the per-CPU TSS
         */
 -      for (v = 0; v < N_EXCEPTION_STACKS; v++) {
 +      if (!orig_ist->ist[0]) {
                static const unsigned int order[N_EXCEPTION_STACKS] = {
 -                      [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
 -                      [DEBUG_STACK - 1] = DEBUG_STACK_ORDER
 +                [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
 +                [DEBUG_STACK - 1] = DEBUG_STACK_ORDER
                };
 -              if (cpu) {
 -                      estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
 -                      if (!estacks)
 -                              panic("Cannot allocate exception stack %ld %d\n",
 -                                    v, cpu);
 +              for (v = 0; v < N_EXCEPTION_STACKS; v++) {
 +                      if (cpu) {
 +                              estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
 +                              if (!estacks)
 +                                      panic("Cannot allocate exception "
 +                                            "stack %ld %d\n", v, cpu);
 +                      }
 +                      estacks += PAGE_SIZE << order[v];
 +                      orig_ist->ist[v] = t->x86_tss.ist[v] =
 +                                      (unsigned long)estacks;
                }
 -              estacks += PAGE_SIZE << order[v];
 -              orig_ist->ist[v] = t->x86_tss.ist[v] = (unsigned long)estacks;
        }
  
        t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
index b5ade28ca8f8cd5332e7680162ea110afe586790,b117d7f8a5640fe51091f46247671dff5d61524e..58ac5d3d4361491d35a008181d2abfa042a0818b
@@@ -729,7 -729,7 +729,7 @@@ struct var_mtrr_range_state 
        mtrr_type type;
  };
  
 -struct var_mtrr_range_state __initdata range_state[RANGE_NUM];
 +static struct var_mtrr_range_state __initdata range_state[RANGE_NUM];
  static int __initdata debug_print;
  
  static int __init
@@@ -1496,11 -1496,8 +1496,8 @@@ int __init mtrr_trim_uncached_memory(un
  
        /* kvm/qemu doesn't have mtrr set right, don't trim them all */
        if (!highest_pfn) {
-               if (!kvm_para_available()) {
-                       printk(KERN_WARNING
+               WARN(!kvm_para_available(), KERN_WARNING
                                "WARNING: strange, CPU MTRRs all blank?\n");
-                       WARN_ON(1);
-               }
                return 0;
        }
  
index 16a93ed7baf185199180658360ca857c059eea70,bfa837cb16be83799fa1ee7e28bedca5dbe38e40..ae2ffc8a400ccc131aa8d584a2a9a420f8c40463
  #include <linux/threads.h>
  #include <linux/cpumask.h>
  #include <linux/string.h>
 -#include <linux/kernel.h>
  #include <linux/ctype.h>
  #include <linux/init.h>
  #include <linux/sched.h>
  #include <linux/bootmem.h>
  #include <linux/module.h>
 +#include <linux/hardirq.h>
  #include <asm/smp.h>
  #include <asm/ipi.h>
  #include <asm/genapic.h>
  #include <asm/uv/uv_hub.h>
  #include <asm/uv/bios.h>
  
 +DEFINE_PER_CPU(int, x2apic_extra_bits);
 +
 +static enum uv_system_type uv_system_type;
 +
 +static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 +{
 +      if (!strcmp(oem_id, "SGI")) {
 +              if (!strcmp(oem_table_id, "UVL"))
 +                      uv_system_type = UV_LEGACY_APIC;
 +              else if (!strcmp(oem_table_id, "UVX"))
 +                      uv_system_type = UV_X2APIC;
 +              else if (!strcmp(oem_table_id, "UVH")) {
 +                      uv_system_type = UV_NON_UNIQUE_APIC;
 +                      return 1;
 +              }
 +      }
 +      return 0;
 +}
 +
 +enum uv_system_type get_uv_system_type(void)
 +{
 +      return uv_system_type;
 +}
 +
 +int is_uv_system(void)
 +{
 +      return uv_system_type != UV_NONE;
 +}
 +EXPORT_SYMBOL_GPL(is_uv_system);
 +
  DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
  EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info);
  
@@@ -153,10 -123,6 +153,10 @@@ static int uv_apic_id_registered(void
        return 1;
  }
  
 +static void uv_init_apic_ldr(void)
 +{
 +}
 +
  static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask)
  {
        int cpu;
                return BAD_APICID;
  }
  
 +static unsigned int get_apic_id(unsigned long x)
 +{
 +      unsigned int id;
 +
 +      WARN_ON(preemptible() && num_online_cpus() > 1);
 +      id = x | __get_cpu_var(x2apic_extra_bits);
 +
 +      return id;
 +}
 +
 +static unsigned long set_apic_id(unsigned int id)
 +{
 +      unsigned long x;
 +
 +      /* maskout x2apic_extra_bits ? */
 +      x = id;
 +      return x;
 +}
 +
 +static unsigned int uv_read_apic_id(void)
 +{
 +
 +      return get_apic_id(apic_read(APIC_ID));
 +}
 +
  static unsigned int phys_pkg_id(int index_msb)
  {
 -      return GET_APIC_ID(read_apic_id()) >> index_msb;
 +      return uv_read_apic_id() >> index_msb;
  }
  
  #ifdef ZZZ            /* Needs x2apic patch */
@@@ -211,22 -152,17 +211,22 @@@ static void uv_send_IPI_self(int vector
  
  struct genapic apic_x2apic_uv_x = {
        .name = "UV large system",
 +      .acpi_madt_oem_check = uv_acpi_madt_oem_check,
        .int_delivery_mode = dest_Fixed,
        .int_dest_mode = (APIC_DEST_PHYSICAL != 0),
        .target_cpus = uv_target_cpus,
        .vector_allocation_domain = uv_vector_allocation_domain,/* Fixme ZZZ */
        .apic_id_registered = uv_apic_id_registered,
 +      .init_apic_ldr = uv_init_apic_ldr,
        .send_IPI_all = uv_send_IPI_all,
        .send_IPI_allbutself = uv_send_IPI_allbutself,
        .send_IPI_mask = uv_send_IPI_mask,
        /* ZZZ.send_IPI_self = uv_send_IPI_self, */
        .cpu_mask_to_apicid = uv_cpu_mask_to_apicid,
        .phys_pkg_id = phys_pkg_id,     /* Fixme ZZZ */
 +      .get_apic_id = get_apic_id,
 +      .set_apic_id = set_apic_id,
 +      .apic_id_mask = (0xFFFFFFFFu),
  };
  
  static __cpuinit void set_x2apic_extra_bits(int pnode)
@@@ -286,7 -222,7 +286,7 @@@ static __init void map_low_mmrs(void
  
  enum map_type {map_wb, map_uc};
  
- static void map_high(char *id, unsigned long base, int shift, enum map_type map_type)
+ static __init void map_high(char *id, unsigned long base, int shift, enum map_type map_type)
  {
        unsigned long bytes, paddr;
  
@@@ -357,7 -293,9 +357,9 @@@ static __init void uv_rtc_init(void
                sn_rtc_cycles_per_second = ticks_per_sec;
  }
  
- static __init void uv_system_init(void)
+ static bool uv_system_inited;
+ void __init uv_system_init(void)
  {
        union uvh_si_addr_map_config_u m_n_config;
        union uvh_node_id_u node_id;
        map_mmr_high(max_pnode);
        map_config_high(max_pnode);
        map_mmioh_high(max_pnode);
+       uv_system_inited = true;
  }
  
  /*
   */
  void __cpuinit uv_cpu_init(void)
  {
-       if (!uv_node_to_blade)
-               uv_system_init();
+       BUG_ON(!uv_system_inited);
  
        uv_blade_info[uv_numa_blade_id()].nr_online_cpus++;
  
        if (get_uv_system_type() == UV_NON_UNIQUE_APIC)
                set_x2apic_extra_bits(uv_hub_info->pnode);
  }
 +
 +
index e5d23675bb7cc9acb106e323a82724f1e5b40409,b3fb430725cb0f5c2cd5ee5da68a249cdb9854d0..f98f4e1dba0963ddc4908074a7a16e3249703677
@@@ -49,7 -49,7 +49,7 @@@ static int __init mpf_checksum(unsigne
        return sum & 0xFF;
  }
  
- static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
+ static void __init MP_processor_info(struct mpc_config_processor *m)
  {
        int apicid;
        char *bootup_cpu = "";
@@@ -397,9 -397,7 +397,9 @@@ static int __init smp_read_mpc(struct m
         generic_bigsmp_probe();
  #endif
  
 +#ifdef CONFIG_X86_32
        setup_apic_routing();
 +#endif
        if (!num_processors)
                printk(KERN_ERR "MPTABLE: no processors registered!\n");
        return num_processors;
@@@ -486,7 -484,7 +486,7 @@@ static void __init construct_default_io
  }
  
  
- static void construct_ioapic_table(int mpc_default_type)
+ static void __init construct_ioapic_table(int mpc_default_type)
  {
        struct mpc_config_ioapic ioapic;
        struct mpc_config_bus bus;
        construct_default_ioirq_mptable(mpc_default_type);
  }
  #else
- static inline void construct_ioapic_table(int mpc_default_type) { }
+ static inline void __init construct_ioapic_table(int mpc_default_type) { }
  #endif
  
  static inline void __init construct_default_ISA_mptable(int mpc_default_type)
index 2434467ddf72a9722553e880917361d699b4c1be,eecc8c18f01016a502edf711df6e9ebff61dde8f..4caff39078e0d386a0f1d2783fbc7e081582d9a9
@@@ -73,7 -73,7 +73,7 @@@ static void __init smp_dump_qct(void
  }
  
  
- void __init numaq_tsc_disable(void)
+ void __cpuinit numaq_tsc_disable(void)
  {
        if (!found_numaq)
                return;
@@@ -229,12 -229,6 +229,12 @@@ static void __init smp_read_mpc_oem(str
        }
  }
  
 +static int __init numaq_setup_ioapic_ids(void)
 +{
 +      /* so can skip it */
 +      return 1;
 +}
 +
  static struct x86_quirks numaq_x86_quirks __initdata = {
        .arch_pre_time_init     = numaq_pre_time_init,
        .arch_time_init         = NULL,
        .mpc_oem_bus_info       = mpc_oem_bus_info,
        .mpc_oem_pci_bus        = mpc_oem_pci_bus,
        .smp_read_mpc_oem       = smp_read_mpc_oem,
 +      .setup_ioapic_ids       = numaq_setup_ioapic_ids,
  };
  
  void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem,
index 5744789a78f45ce852a28ae38e1e968e0b3727cf,300da17e61cbef997d527031a49bb1e81addf897..4090cd6f843621f63563121931f3190f92f70810
@@@ -373,6 -373,8 +373,6 @@@ struct pv_cpu_ops pv_cpu_ops = 
  
  struct pv_apic_ops pv_apic_ops = {
  #ifdef CONFIG_X86_LOCAL_APIC
 -      .apic_write = native_apic_write,
 -      .apic_read = native_apic_read,
        .setup_boot_clock = setup_boot_APIC_clock,
        .setup_secondary_clock = setup_secondary_APIC_clock,
        .startup_ipi_hook = paravirt_nop,
@@@ -469,7 -471,7 +469,7 @@@ struct pv_lock_ops pv_lock_ops = 
        .spin_unlock = __ticket_spin_unlock,
  #endif
  };
- EXPORT_SYMBOL_GPL(pv_lock_ops);
+ EXPORT_SYMBOL(pv_lock_ops);
  
  EXPORT_SYMBOL_GPL(pv_time_ops);
  EXPORT_SYMBOL    (pv_cpu_ops);
index 7b6e44a7c6248340482a317d20861b1292b1a246,3b7a1ddcc0bce7eca8c989906fa377d4f0322f50..2c9abc95e026fbd3153477598185f879eab0e6e1
@@@ -55,8 -55,6 +55,8 @@@
  #include <asm/tlbflush.h>
  #include <asm/cpu.h>
  #include <asm/kdebug.h>
 +#include <asm/syscalls.h>
 +#include <asm/smp.h>
  
  asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
  
@@@ -97,7 -95,6 +97,6 @@@ static inline void play_dead(void
  {
        /* This must be done before dead CPU ack */
        cpu_exit_clear();
-       wbinvd();
        mb();
        /* Ack it */
        __get_cpu_var(cpu_state) = CPU_DEAD;
         * With physical CPU hotplug, we should halt the cpu
         */
        local_irq_disable();
-       while (1)
-               halt();
+       /* mask all interrupts, flush any and all caches, and halt */
+       wbinvd_halt();
  }
  #else
  static inline void play_dead(void)
index 87d7dfdcf46c94c30f80d9c6a5bbc0d7bf7cf4a1,71553b664e2af8601361a9af3413599b752a3e5c..00263c9e6500ce82f193db3d38b2ec4e633e6508
@@@ -51,7 -51,6 +51,7 @@@
  #include <asm/proto.h>
  #include <asm/ia32.h>
  #include <asm/idle.h>
 +#include <asm/syscalls.h>
  
  asmlinkage extern void ret_from_fork(void);
  
@@@ -94,14 -93,13 +94,13 @@@ DECLARE_PER_CPU(int, cpu_state)
  static inline void play_dead(void)
  {
        idle_task_exit();
-       wbinvd();
        mb();
        /* Ack it */
        __get_cpu_var(cpu_state) = CPU_DEAD;
  
        local_irq_disable();
-       while (1)
-               halt();
+       /* mask all interrupts, flush any and all caches, and halt */
+       wbinvd_halt();
  }
  #else
  static inline void play_dead(void)
diff --combined arch/x86/kernel/setup.c
index 59f07e14d0830a01a7098e337dc2ab554aa76207,362d4e7f2d389b81e345fa27b13db78e80c5980a..673f12cf6eb09a94795bac2122206b4994e2c608
@@@ -445,7 -445,7 +445,7 @@@ static void __init reserve_early_setup_
   * @size: Size of the crashkernel memory to reserve.
   * Returns the base address on success, and -1ULL on failure.
   */
- unsigned long long find_and_reserve_crashkernel(unsigned long long size)
+ unsigned long long __init find_and_reserve_crashkernel(unsigned long long size)
  {
        const unsigned long long alignment = 16<<20;    /* 16M */
        unsigned long long start = 0LL;
@@@ -604,14 -604,6 +604,6 @@@ void __init setup_arch(char **cmdline_p
        early_cpu_init();
        early_ioremap_init();
  
- #if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
-       /*
-        * Must be before kernel pagetables are setup
-        * or fixmap area is touched.
-        */
-       vmi_init();
- #endif
        ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
        screen_info = boot_params.screen_info;
        edid_info = boot_params.edid_info;
  
        parse_early_param();
  
+ #if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
+       /*
+        * Must be before kernel pagetables are setup
+        * or fixmap area is touched.
+        */
+       vmi_init();
+ #endif
        /* after early param, so could get panic from serial */
        reserve_early_setup_data();
  
        num_physpages = max_pfn;
  
        check_efer();
 +      if (cpu_has_x2apic)
 +              check_x2apic();
  
        /* How many end-of-memory variables you have, grandma! */
        /* need this before calling reserve_initrd */
index 0133a952d11f6163d1652113a4b57c2c8dc48f8b,7985c5b3f9162ba14c0817ce25f1297b34a87a5c..aa804c64b1677ffe6d7433de542c04c9c9e8470d
@@@ -88,7 -88,7 +88,7 @@@ static DEFINE_PER_CPU(struct task_struc
  #define get_idle_for_cpu(x)      (per_cpu(idle_thread_array, x))
  #define set_idle_for_cpu(x, p)   (per_cpu(idle_thread_array, x) = (p))
  #else
 -struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
 +static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
  #define get_idle_for_cpu(x)      (idle_thread_array[(x)])
  #define set_idle_for_cpu(x, p)   (idle_thread_array[(x)] = (p))
  #endif
@@@ -123,12 -123,13 +123,12 @@@ EXPORT_PER_CPU_SYMBOL(cpu_info)
  
  static atomic_t init_deasserted;
  
 -static int boot_cpu_logical_apicid;
  
  /* representing cpus for which sibling maps can be computed */
  static cpumask_t cpu_sibling_setup_map;
  
  /* Set if we find a B stepping CPU */
 -int __cpuinitdata smp_b_stepping;
 +static int __cpuinitdata smp_b_stepping;
  
  #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32)
  
@@@ -164,8 -165,6 +164,8 @@@ static void unmap_cpu_to_node(int cpu
  #endif
  
  #ifdef CONFIG_X86_32
 +static int boot_cpu_logical_apicid;
 +
  u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly =
                                        { [0 ... NR_CPUS-1] = BAD_APICID };
  
@@@ -211,7 -210,7 +211,7 @@@ static void __cpuinit smp_callin(void
        /*
         * (This works even if the APIC is not enabled.)
         */
 -      phys_id = GET_APIC_ID(read_apic_id());
 +      phys_id = read_apic_id();
        cpuid = smp_processor_id();
        if (cpu_isset(cpuid, cpu_callin_map)) {
                panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__,
@@@ -551,7 -550,8 +551,7 @@@ static inline void __inquire_remote_api
                        printk(KERN_CONT
                               "a previous APIC delivery may have failed\n");
  
 -              apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(apicid));
 -              apic_write(APIC_ICR, APIC_DM_REMRD | regs[i]);
 +              apic_icr_write(APIC_DM_REMRD | regs[i], apicid);
  
                timeout = 0;
                do {
@@@ -583,9 -583,11 +583,9 @@@ wakeup_secondary_cpu(int logical_apicid
        int maxlvt;
  
        /* Target chip */
 -      apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(logical_apicid));
 -
        /* Boot on the stack */
        /* Kick the second */
 -      apic_write(APIC_ICR, APIC_DM_NMI | APIC_DEST_LOGICAL);
 +      apic_icr_write(APIC_DM_NMI | APIC_DEST_LOGICAL, logical_apicid);
  
        pr_debug("Waiting for send to finish...\n");
        send_status = safe_apic_wait_icr_idle();
@@@ -638,11 -640,13 +638,11 @@@ wakeup_secondary_cpu(int phys_apicid, u
        /*
         * Turn INIT on target chip
         */
 -      apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid));
 -
        /*
         * Send IPI
         */
 -      apic_write(APIC_ICR,
 -                 APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT);
 +      apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT,
 +                     phys_apicid);
  
        pr_debug("Waiting for send to finish...\n");
        send_status = safe_apic_wait_icr_idle();
        pr_debug("Deasserting INIT.\n");
  
        /* Target chip */
 -      apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid));
 -
        /* Send IPI */
 -      apic_write(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT);
 +      apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid);
  
        pr_debug("Waiting for send to finish...\n");
        send_status = safe_apic_wait_icr_idle();
                 */
  
                /* Target chip */
 -              apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid));
 -
                /* Boot on the stack */
                /* Kick the second */
 -              apic_write(APIC_ICR, APIC_DM_STARTUP | (start_eip >> 12));
 +              apic_icr_write(APIC_DM_STARTUP | (start_eip >> 12),
 +                             phys_apicid);
  
                /*
                 * Give the other CPU some time to accept the IPI.
@@@ -749,6 -756,14 +749,14 @@@ static void __cpuinit do_fork_idle(stru
  }
  
  #ifdef CONFIG_X86_64
+ /* __ref because it's safe to call free_bootmem when after_bootmem == 0. */
+ static void __ref free_bootmem_pda(struct x8664_pda *oldpda)
+ {
+       if (!after_bootmem)
+               free_bootmem((unsigned long)oldpda, sizeof(*oldpda));
+ }
  /*
   * Allocate node local memory for the AP pda.
   *
@@@ -777,8 -792,7 +785,7 @@@ int __cpuinit get_local_pda(int cpu
  
        if (oldpda) {
                memcpy(newpda, oldpda, size);
-               if (!after_bootmem)
-                       free_bootmem((unsigned long)oldpda, size);
+               free_bootmem_pda(oldpda);
        }
  
        newpda->in_bootmem = 0;
@@@ -987,17 -1001,7 +994,7 @@@ int __cpuinit native_cpu_up(unsigned in
        flush_tlb_all();
        low_mappings = 1;
  
- #ifdef CONFIG_X86_PC
-       if (def_to_bigsmp && apicid > 8) {
-               printk(KERN_WARNING
-                       "More than 8 CPUs detected - skipping them.\n"
-                       "Use CONFIG_X86_GENERICARCH and CONFIG_X86_BIGSMP.\n");
-               err = -1;
-       } else
-               err = do_boot_cpu(apicid, cpu);
- #else
        err = do_boot_cpu(apicid, cpu);
- #endif
  
        zap_low_mappings();
        low_mappings = 0;
@@@ -1051,6 -1055,34 +1048,34 @@@ static __init void disable_smp(void
  static int __init smp_sanity_check(unsigned max_cpus)
  {
        preempt_disable();
+ #if defined(CONFIG_X86_PC) && defined(CONFIG_X86_32)
+       if (def_to_bigsmp && nr_cpu_ids > 8) {
+               unsigned int cpu;
+               unsigned nr;
+               printk(KERN_WARNING
+                      "More than 8 CPUs detected - skipping them.\n"
+                      "Use CONFIG_X86_GENERICARCH and CONFIG_X86_BIGSMP.\n");
+               nr = 0;
+               for_each_present_cpu(cpu) {
+                       if (nr >= 8)
+                               cpu_clear(cpu, cpu_present_map);
+                       nr++;
+               }
+               nr = 0;
+               for_each_possible_cpu(cpu) {
+                       if (nr >= 8)
+                               cpu_clear(cpu, cpu_possible_map);
+                       nr++;
+               }
+               nr_cpu_ids = 8;
+       }
+ #endif
        if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
                printk(KERN_WARNING "weird, boot CPU (#%d) not listed"
                                    "by the BIOS.\n", hard_smp_processor_id());
@@@ -1143,17 -1175,10 +1168,17 @@@ void __init native_smp_prepare_cpus(uns
         * Setup boot CPU information
         */
        smp_store_cpu_info(0); /* Final full version of the data */
 +#ifdef CONFIG_X86_32
        boot_cpu_logical_apicid = logical_smp_processor_id();
 +#endif
        current_thread_info()->cpu = 0;  /* needed? */
        set_cpu_sibling_map(0);
  
 +#ifdef CONFIG_X86_64
 +      enable_IR_x2apic();
 +      setup_apic_routing();
 +#endif
 +
        if (smp_sanity_check(max_cpus) < 0) {
                printk(KERN_INFO "SMP disabled\n");
                disable_smp();
        }
  
        preempt_disable();
 -      if (GET_APIC_ID(read_apic_id()) != boot_cpu_physical_apicid) {
 +      if (read_apic_id() != boot_cpu_physical_apicid) {
                panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
 -                   GET_APIC_ID(read_apic_id()), boot_cpu_physical_apicid);
 +                   read_apic_id(), boot_cpu_physical_apicid);
                /* Or can we switch back to PIC here? */
        }
        preempt_enable();
        printk(KERN_INFO "CPU%d: ", 0);
        print_cpu_info(&cpu_data(0));
        setup_boot_clock();
+       if (is_uv_system())
+               uv_system_init();
  out:
        preempt_enable();
  }
@@@ -1386,17 -1414,3 +1414,3 @@@ void __cpu_die(unsigned int cpu
        BUG();
  }
  #endif
- /*
-  * If the BIOS enumerates physical processors before logical,
-  * maxcpus=N at enumeration-time can be used to disable HT.
-  */
- static int __init parse_maxcpus(char *arg)
- {
-       extern unsigned int maxcpus;
-       if (arg)
-               maxcpus = simple_strtoul(arg, NULL, 0);
-       return 0;
- }
- early_param("maxcpus", parse_maxcpus);
diff --combined arch/x86/mm/ioremap.c
index fba57be9af682a69e4a6860adbd6798cdd89baa8,d4b6e6a29ae3597c45071805f734a502a12d6ab2..cac6da54203bfdee878d61c2debb71104ce4f0b6
@@@ -170,7 -170,7 +170,7 @@@ static void __iomem *__ioremap_caller(r
        phys_addr &= PAGE_MASK;
        size = PAGE_ALIGN(last_addr+1) - phys_addr;
  
-       retval = reserve_memtype(phys_addr, phys_addr + size,
+       retval = reserve_memtype(phys_addr, (u64)phys_addr + size,
                                                prot_val, &new_prot_val);
        if (retval) {
                pr_debug("Warning: reserve_memtype returned %d\n", retval);
@@@ -421,7 -421,7 +421,7 @@@ void unxlate_dev_mem_ptr(unsigned long 
        return;
  }
  
 -int __initdata early_ioremap_debug;
 +static int __initdata early_ioremap_debug;
  
  static int __init early_ioremap_debug_setup(char *str)
  {
@@@ -547,19 -547,17 +547,17 @@@ static inline void __init early_clear_f
  }
  
  
 -int __initdata early_ioremap_nested;
 +static int __initdata early_ioremap_nested;
  
  static int __init check_early_ioremap_leak(void)
  {
        if (!early_ioremap_nested)
                return 0;
-       printk(KERN_WARNING
+       WARN(1, KERN_WARNING
               "Debug warning: early ioremap leak of %d areas detected.\n",
-              early_ioremap_nested);
+               early_ioremap_nested);
        printk(KERN_WARNING
-              "please boot with early_ioremap_debug and report the dmesg.\n");
-       WARN_ON(1);
+               "please boot with early_ioremap_debug and report the dmesg.\n");
  
        return 1;
  }
index e6b4d5b083701e730b22fbe9e91142ad77ee4895,dcc812067394fd5e366810d0d57eb2dbf6f05d70..1ffa4e53c98931b670409c5b226bc23babfc4ef6
@@@ -17,8 -17,8 +17,8 @@@
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
   */
  
 -#ifndef __AMD_IOMMU_TYPES_H__
 -#define __AMD_IOMMU_TYPES_H__
 +#ifndef ASM_X86__AMD_IOMMU_TYPES_H
 +#define ASM_X86__AMD_IOMMU_TYPES_H
  
  #include <linux/types.h>
  #include <linux/list.h>
@@@ -31,9 -31,6 +31,6 @@@
  #define ALIAS_TABLE_ENTRY_SIZE                2
  #define RLOOKUP_TABLE_ENTRY_SIZE      (sizeof(void *))
  
- /* helper macros */
- #define LOW_U32(x) ((x) & ((1ULL << 32)-1))
  /* Length of the MMIO region for the AMD IOMMU */
  #define MMIO_REGION_LENGTH       0x4000
  
@@@ -69,6 -66,9 +66,9 @@@
  #define MMIO_EVT_TAIL_OFFSET  0x2018
  #define MMIO_STATUS_OFFSET    0x2020
  
+ /* MMIO status bits */
+ #define MMIO_STATUS_COM_WAIT_INT_MASK 0x04
  /* feature control bits */
  #define CONTROL_IOMMU_EN        0x00ULL
  #define CONTROL_HT_TUN_EN       0x01ULL
@@@ -89,6 -89,7 +89,7 @@@
  #define CMD_INV_IOMMU_PAGES     0x03
  
  #define CMD_COMPL_WAIT_STORE_MASK     0x01
+ #define CMD_COMPL_WAIT_INT_MASK               0x02
  #define CMD_INV_IOMMU_PAGES_SIZE_MASK 0x01
  #define CMD_INV_IOMMU_PAGES_PDE_MASK  0x02
  
  #define DEV_ENTRY_TRANSLATION   0x01
  #define DEV_ENTRY_IR            0x3d
  #define DEV_ENTRY_IW            0x3e
+ #define DEV_ENTRY_NO_PAGE_FAULT       0x62
  #define DEV_ENTRY_EX            0x67
  #define DEV_ENTRY_SYSMGT1       0x68
  #define DEV_ENTRY_SYSMGT2       0x69
@@@ -339,4 -341,4 +341,4 @@@ static inline u16 calc_devid(u8 bus, u
        return (((u16)bus) << 8) | devfn;
  }
  
 -#endif
 +#endif /* ASM_X86__AMD_IOMMU_TYPES_H */
index ebbc753af6ab5712177ed53b75875505ef06e1b1,91c7d03e65bcc077f4bbffe98cf662ee47bf33dc..2cb218c4a356ce332b2e887b88e8d146e602fe84
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef __ARCH_X86_64_ATOMIC__
 -#define __ARCH_X86_64_ATOMIC__
 +#ifndef ASM_X86__ATOMIC_64_H
 +#define ASM_X86__ATOMIC_64_H
  
  #include <asm/alternative.h>
  #include <asm/cmpxchg.h>
@@@ -228,7 -228,7 +228,7 @@@ static inline void atomic64_add(long i
  {
        asm volatile(LOCK_PREFIX "addq %1,%0"
                     : "=m" (v->counter)
-                    : "ir" (i), "m" (v->counter));
+                    : "er" (i), "m" (v->counter));
  }
  
  /**
@@@ -242,7 -242,7 +242,7 @@@ static inline void atomic64_sub(long i
  {
        asm volatile(LOCK_PREFIX "subq %1,%0"
                     : "=m" (v->counter)
-                    : "ir" (i), "m" (v->counter));
+                    : "er" (i), "m" (v->counter));
  }
  
  /**
@@@ -260,7 -260,7 +260,7 @@@ static inline int atomic64_sub_and_test
  
        asm volatile(LOCK_PREFIX "subq %2,%0; sete %1"
                     : "=m" (v->counter), "=qm" (c)
-                    : "ir" (i), "m" (v->counter) : "memory");
+                    : "er" (i), "m" (v->counter) : "memory");
        return c;
  }
  
@@@ -341,7 -341,7 +341,7 @@@ static inline int atomic64_add_negative
  
        asm volatile(LOCK_PREFIX "addq %2,%0; sets %1"
                     : "=m" (v->counter), "=qm" (c)
-                    : "ir" (i), "m" (v->counter) : "memory");
+                    : "er" (i), "m" (v->counter) : "memory");
        return c;
  }
  
@@@ -470,4 -470,4 +470,4 @@@ static inline void atomic_or_long(unsig
  #define smp_mb__after_atomic_inc()    barrier()
  
  #include <asm-generic/atomic.h>
 -#endif
 +#endif /* ASM_X86__ATOMIC_64_H */
diff --combined include/asm-x86/bugs.h
index 4761c461d23a62a4ba44e015c106bd5d5bdbd02c,00e4a0cd6f283568228fe9647cdc75fae292dfce..ae514c76a96fd09a9c3b65d6b9176c128e1428f2
@@@ -1,7 -1,12 +1,12 @@@
 -#ifndef _ASM_X86_BUGS_H
 -#define _ASM_X86_BUGS_H
 +#ifndef ASM_X86__BUGS_H
 +#define ASM_X86__BUGS_H
  
  extern void check_bugs(void);
+ #ifdef CONFIG_CPU_SUP_INTEL_32
  int ppro_with_ram_bug(void);
+ #else
+ static inline int ppro_with_ram_bug(void) { return 0; }
+ #endif
  
 -#endif /* _ASM_X86_BUGS_H */
 +#endif /* ASM_X86__BUGS_H */
index 42afe9ca3a37e40cb0d2b172245b042e6fcde05f,24d99d65741dd7820d8be604be7fa430fd8db13b..6dfa2b3f18c7d0b29040c37e3392585546cc8351
@@@ -1,20 -1,26 +1,26 @@@
  /*
   * Defines x86 CPU feature bits
   */
 -#ifndef _ASM_X86_CPUFEATURE_H
 -#define _ASM_X86_CPUFEATURE_H
 +#ifndef ASM_X86__CPUFEATURE_H
 +#define ASM_X86__CPUFEATURE_H
  
  #include <asm/required-features.h>
  
  #define NCAPINTS      8       /* N 32-bit words worth of info */
  
+ /*
+  * Note: If the comment begins with a quoted string, that string is used
+  * in /proc/cpuinfo instead of the macro name.  If the string is "",
+  * this feature bit is not displayed in /proc/cpuinfo at all.
+  */
  /* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
  #define X86_FEATURE_FPU               (0*32+ 0) /* Onboard FPU */
  #define X86_FEATURE_VME               (0*32+ 1) /* Virtual Mode Extensions */
  #define X86_FEATURE_DE                (0*32+ 2) /* Debugging Extensions */
  #define X86_FEATURE_PSE               (0*32+ 3) /* Page Size Extensions */
  #define X86_FEATURE_TSC               (0*32+ 4) /* Time Stamp Counter */
- #define X86_FEATURE_MSR               (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */
+ #define X86_FEATURE_MSR               (0*32+ 5) /* Model-Specific Registers */
  #define X86_FEATURE_PAE               (0*32+ 6) /* Physical Address Extensions */
  #define X86_FEATURE_MCE               (0*32+ 7) /* Machine Check Architecture */
  #define X86_FEATURE_CX8               (0*32+ 8) /* CMPXCHG8 instruction */
  #define X86_FEATURE_MTRR      (0*32+12) /* Memory Type Range Registers */
  #define X86_FEATURE_PGE               (0*32+13) /* Page Global Enable */
  #define X86_FEATURE_MCA               (0*32+14) /* Machine Check Architecture */
- #define X86_FEATURE_CMOV      (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
+ #define X86_FEATURE_CMOV      (0*32+15) /* CMOV instructions */
+                                         /* (plus FCMOVcc, FCOMI with FPU) */
  #define X86_FEATURE_PAT               (0*32+16) /* Page Attribute Table */
  #define X86_FEATURE_PSE36     (0*32+17) /* 36-bit PSEs */
  #define X86_FEATURE_PN                (0*32+18) /* Processor serial number */
- #define X86_FEATURE_CLFLSH    (0*32+19) /* Supports the CLFLUSH instruction */
- #define X86_FEATURE_DS                (0*32+21) /* Debug Store */
+ #define X86_FEATURE_CLFLSH    (0*32+19) /* "clflush" CLFLUSH instruction */
+ #define X86_FEATURE_DS                (0*32+21) /* "dts" Debug Store */
  #define X86_FEATURE_ACPI      (0*32+22) /* ACPI via MSR */
  #define X86_FEATURE_MMX               (0*32+23) /* Multimedia Extensions */
- #define X86_FEATURE_FXSR      (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */
-                                         /* of FPU context), and CR4.OSFXSR available */
- #define X86_FEATURE_XMM               (0*32+25) /* Streaming SIMD Extensions */
- #define X86_FEATURE_XMM2      (0*32+26) /* Streaming SIMD Extensions-2 */
- #define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */
+ #define X86_FEATURE_FXSR      (0*32+24) /* FXSAVE/FXRSTOR, CR4.OSFXSR */
+ #define X86_FEATURE_XMM               (0*32+25) /* "sse" */
+ #define X86_FEATURE_XMM2      (0*32+26) /* "sse2" */
+ #define X86_FEATURE_SELFSNOOP (0*32+27) /* "ss" CPU self snoop */
  #define X86_FEATURE_HT                (0*32+28) /* Hyper-Threading */
- #define X86_FEATURE_ACC               (0*32+29) /* Automatic clock control */
+ #define X86_FEATURE_ACC               (0*32+29) /* "tm" Automatic clock control */
  #define X86_FEATURE_IA64      (0*32+30) /* IA-64 processor */
+ #define X86_FEATURE_PBE               (0*32+31) /* Pending Break Enable */
  
  /* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
  /* Don't duplicate feature flags which are redundant with Intel! */
@@@ -46,7 -53,8 +53,8 @@@
  #define X86_FEATURE_MP                (1*32+19) /* MP Capable. */
  #define X86_FEATURE_NX                (1*32+20) /* Execute Disable */
  #define X86_FEATURE_MMXEXT    (1*32+22) /* AMD MMX extensions */
- #define X86_FEATURE_GBPAGES   (1*32+26) /* GB pages */
+ #define X86_FEATURE_FXSR_OPT  (1*32+25) /* FXSAVE/FXRSTOR optimizations */
+ #define X86_FEATURE_GBPAGES   (1*32+26) /* "pdpe1gb" GB pages */
  #define X86_FEATURE_RDTSCP    (1*32+27) /* RDTSCP */
  #define X86_FEATURE_LM                (1*32+29) /* Long Mode (x86-64) */
  #define X86_FEATURE_3DNOWEXT  (1*32+30) /* AMD 3DNow! extensions */
  #define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
  #define X86_FEATURE_CENTAUR_MCR       (3*32+ 3) /* Centaur MCRs (= MTRRs) */
  /* cpu types for specific tunings: */
- #define X86_FEATURE_K8                (3*32+ 4) /* Opteron, Athlon64 */
- #define X86_FEATURE_K7                (3*32+ 5) /* Athlon */
- #define X86_FEATURE_P3                (3*32+ 6) /* P3 */
- #define X86_FEATURE_P4                (3*32+ 7) /* P4 */
+ #define X86_FEATURE_K8                (3*32+ 4) /* "" Opteron, Athlon64 */
+ #define X86_FEATURE_K7                (3*32+ 5) /* "" Athlon */
+ #define X86_FEATURE_P3                (3*32+ 6) /* "" P3 */
+ #define X86_FEATURE_P4                (3*32+ 7) /* "" P4 */
  #define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
  #define X86_FEATURE_UP                (3*32+ 9) /* smp kernel running on up */
- #define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */
+ #define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* "" FXSAVE leaks FOP/FIP/FOP */
  #define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
- #define X86_FEATURE_PEBS      (3*32+12)  /* Precise-Event Based Sampling */
- #define X86_FEATURE_BTS               (3*32+13)  /* Branch Trace Store */
- #define X86_FEATURE_SYSCALL32 (3*32+14)  /* syscall in ia32 userspace */
- #define X86_FEATURE_SYSENTER32        (3*32+15)  /* sysenter in ia32 userspace */
- #define X86_FEATURE_REP_GOOD  (3*32+16) /* rep microcode works well on this CPU */
- #define X86_FEATURE_MFENCE_RDTSC (3*32+17) /* Mfence synchronizes RDTSC */
- #define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */
- #define X86_FEATURE_11AP      (3*32+19)  /* Bad local APIC aka 11AP */
+ #define X86_FEATURE_PEBS      (3*32+12) /* Precise-Event Based Sampling */
+ #define X86_FEATURE_BTS               (3*32+13) /* Branch Trace Store */
+ #define X86_FEATURE_SYSCALL32 (3*32+14) /* "" syscall in ia32 userspace */
+ #define X86_FEATURE_SYSENTER32        (3*32+15) /* "" sysenter in ia32 userspace */
+ #define X86_FEATURE_REP_GOOD  (3*32+16) /* rep microcode works well */
+ #define X86_FEATURE_MFENCE_RDTSC (3*32+17) /* "" Mfence synchronizes RDTSC */
+ #define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */
+ #define X86_FEATURE_11AP      (3*32+19) /* "" Bad local APIC aka 11AP */
+ #define X86_FEATURE_NOPL      (3*32+20) /* The NOPL (0F 1F) instructions */
  
  /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
- #define X86_FEATURE_XMM3      (4*32+ 0) /* Streaming SIMD Extensions-3 */
- #define X86_FEATURE_MWAIT     (4*32+ 3) /* Monitor/Mwait support */
- #define X86_FEATURE_DSCPL     (4*32+ 4) /* CPL Qualified Debug Store */
+ #define X86_FEATURE_XMM3      (4*32+ 0) /* "pni" SSE-3 */
+ #define X86_FEATURE_PCLMULQDQ (4*32+ 1) /* PCLMULQDQ instruction */
+ #define X86_FEATURE_DTES64    (4*32+ 2) /* 64-bit Debug Store */
+ #define X86_FEATURE_MWAIT     (4*32+ 3) /* "monitor" Monitor/Mwait support */
+ #define X86_FEATURE_DSCPL     (4*32+ 4) /* "ds_cpl" CPL Qual. Debug Store */
+ #define X86_FEATURE_VMX               (4*32+ 5) /* Hardware virtualization */
+ #define X86_FEATURE_SMX               (4*32+ 6) /* Safer mode */
  #define X86_FEATURE_EST               (4*32+ 7) /* Enhanced SpeedStep */
  #define X86_FEATURE_TM2               (4*32+ 8) /* Thermal Monitor 2 */
+ #define X86_FEATURE_SSSE3     (4*32+ 9) /* Supplemental SSE-3 */
  #define X86_FEATURE_CID               (4*32+10) /* Context ID */
+ #define X86_FEATURE_FMA               (4*32+12) /* Fused multiply-add */
  #define X86_FEATURE_CX16      (4*32+13) /* CMPXCHG16B */
  #define X86_FEATURE_XTPR      (4*32+14) /* Send Task Priority Messages */
+ #define X86_FEATURE_PDCM      (4*32+15) /* Performance Capabilities */
  #define X86_FEATURE_DCA               (4*32+18) /* Direct Cache Access */
+ #define X86_FEATURE_XMM4_1    (4*32+19) /* "sse4_1" SSE-4.1 */
+ #define X86_FEATURE_XMM4_2    (4*32+20) /* "sse4_2" SSE-4.2 */
  #define X86_FEATURE_X2APIC    (4*32+21) /* x2APIC */
+ #define X86_FEATURE_AES               (4*32+25) /* AES instructions */
+ #define X86_FEATURE_XSAVE     (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
+ #define X86_FEATURE_OSXSAVE   (4*32+27) /* "" XSAVE enabled in the OS */
+ #define X86_FEATURE_AVX               (4*32+28) /* Advanced Vector Extensions */
  
  /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
- #define X86_FEATURE_XSTORE    (5*32+ 2) /* on-CPU RNG present (xstore insn) */
- #define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */
- #define X86_FEATURE_XCRYPT    (5*32+ 6) /* on-CPU crypto (xcrypt insn) */
- #define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */
+ #define X86_FEATURE_XSTORE    (5*32+ 2) /* "rng" RNG present (xstore) */
+ #define X86_FEATURE_XSTORE_EN (5*32+ 3) /* "rng_en" RNG enabled */
+ #define X86_FEATURE_XCRYPT    (5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */
+ #define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* "ace_en" on-CPU crypto enabled */
  #define X86_FEATURE_ACE2      (5*32+ 8) /* Advanced Cryptography Engine v2 */
  #define X86_FEATURE_ACE2_EN   (5*32+ 9) /* ACE v2 enabled */
- #define X86_FEATURE_PHE               (5*32+ 10) /* PadLock Hash Engine */
- #define X86_FEATURE_PHE_EN    (5*32+ 11) /* PHE enabled */
- #define X86_FEATURE_PMM               (5*32+ 12) /* PadLock Montgomery Multiplier */
- #define X86_FEATURE_PMM_EN    (5*32+ 13) /* PMM enabled */
+ #define X86_FEATURE_PHE               (5*32+10) /* PadLock Hash Engine */
+ #define X86_FEATURE_PHE_EN    (5*32+11) /* PHE enabled */
+ #define X86_FEATURE_PMM               (5*32+12) /* PadLock Montgomery Multiplier */
+ #define X86_FEATURE_PMM_EN    (5*32+13) /* PMM enabled */
  
  /* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */
  #define X86_FEATURE_LAHF_LM   (6*32+ 0) /* LAHF/SAHF in long mode */
  #define X86_FEATURE_CMP_LEGACY        (6*32+ 1) /* If yes HyperThreading not valid */
- #define X86_FEATURE_IBS               (6*32+ 10) /* Instruction Based Sampling */
+ #define X86_FEATURE_SVM               (6*32+ 2) /* Secure virtual machine */
+ #define X86_FEATURE_EXTAPIC   (6*32+ 3) /* Extended APIC space */
+ #define X86_FEATURE_CR8_LEGACY        (6*32+ 4) /* CR8 in 32-bit mode */
+ #define X86_FEATURE_ABM               (6*32+ 5) /* Advanced bit manipulation */
+ #define X86_FEATURE_SSE4A     (6*32+ 6) /* SSE-4A */
+ #define X86_FEATURE_MISALIGNSSE (6*32+ 7) /* Misaligned SSE mode */
+ #define X86_FEATURE_3DNOWPREFETCH (6*32+ 8) /* 3DNow prefetch instructions */
+ #define X86_FEATURE_OSVW      (6*32+ 9) /* OS Visible Workaround */
+ #define X86_FEATURE_IBS               (6*32+10) /* Instruction Based Sampling */
+ #define X86_FEATURE_SSE5      (6*32+11) /* SSE-5 */
+ #define X86_FEATURE_SKINIT    (6*32+12) /* SKINIT/STGI instructions */
+ #define X86_FEATURE_WDT               (6*32+13) /* Watchdog timer */
  
  /*
   * Auxiliary flags: Linux defined - For features scattered in various
@@@ -149,7 -182,7 +182,7 @@@ extern const char * const x86_power_fla
  } while (0)
  #define setup_force_cpu_cap(bit) do { \
        set_cpu_cap(&boot_cpu_data, bit);       \
-       clear_bit(bit, (unsigned long *)cleared_cpu_caps);      \
+       clear_bit(bit, (unsigned long *)cleared_cpu_caps);      \
  } while (0)
  
  #define cpu_has_fpu           boot_cpu_has(X86_FEATURE_FPU)
  #define cpu_has_gbpages               boot_cpu_has(X86_FEATURE_GBPAGES)
  #define cpu_has_arch_perfmon  boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
  #define cpu_has_pat           boot_cpu_has(X86_FEATURE_PAT)
+ #define cpu_has_xmm4_1                boot_cpu_has(X86_FEATURE_XMM4_1)
+ #define cpu_has_xmm4_2                boot_cpu_has(X86_FEATURE_XMM4_2)
  #define cpu_has_x2apic                boot_cpu_has(X86_FEATURE_X2APIC)
+ #define cpu_has_xsave         boot_cpu_has(X86_FEATURE_XSAVE)
  
  #if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
  # define cpu_has_invlpg               1
  
  #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
  
 -#endif /* _ASM_X86_CPUFEATURE_H */
 +#endif /* ASM_X86__CPUFEATURE_H */
index 4904c672e4f61cada1b855e14d208f9e93fb4a24,754d635f90ffc9514a1daae0ed560eed9d629cd9..34280f027664a57267d915bda709183b745ea9a5
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_GENAPIC_H
 -#define _ASM_GENAPIC_H 1
 +#ifndef ASM_X86__GENAPIC_32_H
 +#define ASM_X86__GENAPIC_32_H
  
  #include <asm/mpspec.h>
  
@@@ -118,6 -118,7 +118,7 @@@ enum uv_system_type {UV_NONE, UV_LEGACY
  #define get_uv_system_type()          UV_NONE
  #define is_uv_system()                        0
  #define uv_wakeup_secondary(a, b)     1
+ #define uv_system_init()              do {} while (0)
  
  
 -#endif
 +#endif /* ASM_X86__GENAPIC_32_H */
index 128b9ec2d6f2ce77f7a2fe449cbb7ff83b796d00,a47d6312913596fbd0a8a77c54ed8b45937a5a90..ed6a4886c0827ed44406f6eb2df2a0592afe5a62
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_GENAPIC_H
 -#define _ASM_GENAPIC_H 1
 +#ifndef ASM_X86__GENAPIC_64_H
 +#define ASM_X86__GENAPIC_64_H
  
  /*
   * Copyright 2004 James Cleverdon, IBM.
@@@ -14,7 -14,6 +14,7 @@@
  
  struct genapic {
        char *name;
 +      int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
        u32 int_delivery_mode;
        u32 int_dest_mode;
        int (*apic_id_registered)(void);
        void (*send_IPI_mask)(cpumask_t mask, int vector);
        void (*send_IPI_allbutself)(int vector);
        void (*send_IPI_all)(int vector);
 +      void (*send_IPI_self)(int vector);
        /* */
        unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
        unsigned int (*phys_pkg_id)(int index_msb);
 +      unsigned int (*get_apic_id)(unsigned long x);
 +      unsigned long (*set_apic_id)(unsigned int id);
 +      unsigned long apic_id_mask;
  };
  
  extern struct genapic *genapic;
  
  extern struct genapic apic_flat;
  extern struct genapic apic_physflat;
 +extern struct genapic apic_x2apic_cluster;
 +extern struct genapic apic_x2apic_phys;
  extern int acpi_madt_oem_check(char *, char *);
  
 +extern void apic_send_IPI_self(int vector);
  enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
  extern enum uv_system_type get_uv_system_type(void);
  extern int is_uv_system(void);
@@@ -50,8 -42,9 +50,9 @@@
  extern struct genapic apic_x2apic_uv_x;
  DECLARE_PER_CPU(int, x2apic_extra_bits);
  extern void uv_cpu_init(void);
+ extern void uv_system_init(void);
  extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip);
  
  extern void setup_apic_routing(void);
  
 -#endif
 +#endif /* ASM_X86__GENAPIC_64_H */
diff --combined include/asm-x86/geode.h
index 1ef738e01a0696de4d3f294aab2959559935e927,2c1cda0b8a860502aac60502b59fd4f9c9a9a895..3f3444be2638f7205d17dc432d723e5b58fcb3f1
@@@ -7,8 -7,8 +7,8 @@@
   * as published by the Free Software Foundation.
   */
  
 -#ifndef _ASM_GEODE_H_
 -#define _ASM_GEODE_H_
 +#ifndef ASM_X86__GEODE_H
 +#define ASM_X86__GEODE_H
  
  #include <asm/processor.h>
  #include <linux/io.h>
@@@ -50,6 -50,7 +50,7 @@@ extern int geode_get_dev_base(unsigned 
  #define MSR_PIC_YSEL_HIGH     0x51400021
  #define MSR_PIC_ZSEL_LOW      0x51400022
  #define MSR_PIC_ZSEL_HIGH     0x51400023
+ #define MSR_PIC_IRQM_LPC      0x51400025
  
  #define MSR_MFGPT_IRQ         0x51400028
  #define MSR_MFGPT_NR          0x51400029
@@@ -237,7 -238,7 +238,7 @@@ static inline u16 geode_mfgpt_read(int 
  }
  
  extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable);
- extern int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable);
+ extern int geode_mfgpt_set_irq(int timer, int cmp, int *irq, int enable);
  extern int geode_mfgpt_alloc_timer(int timer, int domain);
  
  #define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1)
@@@ -249,4 -250,4 +250,4 @@@ extern int __init mfgpt_timer_setup(voi
  static inline int mfgpt_timer_setup(void) { return 0; }
  #endif
  
 -#endif
 +#endif /* ASM_X86__GEODE_H */
diff --combined include/asm-x86/io.h
index 25417d6c5c6216efc406f41cc625a2137db17f60,0f954dc89cb3c537ebb444e402987616b0a9714b..72b7719523bfa9f26efc333ed0efb160ad37d997
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_X86_IO_H
 -#define _ASM_X86_IO_H
 +#ifndef ASM_X86__IO_H
 +#define ASM_X86__IO_H
  
  #define ARCH_HAS_IOREMAP_WC
  
@@@ -21,7 -21,7 +21,7 @@@ extern void __iomem *fix_ioremap(unsign
  
  #define build_mmio_read(name, size, type, reg, barrier) \
  static inline type name(const volatile void __iomem *addr) \
- { type ret; asm volatile("mov" size " %1,%0":"=" reg (ret) \
+ { type ret; asm volatile("mov" size " %1,%0":reg (ret) \
  :"m" (*(volatile type __force *)addr) barrier); return ret; }
  
  #define build_mmio_write(name, size, type, reg, barrier) \
@@@ -29,13 -29,13 +29,13 @@@ static inline void name(type val, volat
  { asm volatile("mov" size " %0,%1": :reg (val), \
  "m" (*(volatile type __force *)addr) barrier); }
  
- build_mmio_read(readb, "b", unsigned char, "q", :"memory")
- build_mmio_read(readw, "w", unsigned short, "r", :"memory")
- build_mmio_read(readl, "l", unsigned int, "r", :"memory")
+ build_mmio_read(readb, "b", unsigned char, "=q", :"memory")
+ build_mmio_read(readw, "w", unsigned short, "=r", :"memory")
+ build_mmio_read(readl, "l", unsigned int, "=r", :"memory")
  
- build_mmio_read(__readb, "b", unsigned char, "q", )
- build_mmio_read(__readw, "w", unsigned short, "r", )
- build_mmio_read(__readl, "l", unsigned int, "r", )
+ build_mmio_read(__readb, "b", unsigned char, "=q", )
+ build_mmio_read(__readw, "w", unsigned short, "=r", )
+ build_mmio_read(__readl, "l", unsigned int, "=r", )
  
  build_mmio_write(writeb, "b", unsigned char, "q", :"memory")
  build_mmio_write(writew, "w", unsigned short, "r", :"memory")
@@@ -59,8 -59,8 +59,8 @@@ build_mmio_write(__writel, "l", unsigne
  #define mmiowb() barrier()
  
  #ifdef CONFIG_X86_64
- build_mmio_read(readq, "q", unsigned long, "r", :"memory")
- build_mmio_read(__readq, "q", unsigned long, "r", )
+ build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
+ build_mmio_read(__readq, "q", unsigned long, "=r", )
  build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
  build_mmio_write(__writeq, "q", unsigned long, "r", )
  
@@@ -73,8 -73,6 +73,8 @@@
  #define writeq writeq
  #endif
  
 +extern int iommu_bio_merge;
 +
  #ifdef CONFIG_X86_32
  # include "io_32.h"
  #else
@@@ -101,4 -99,4 +101,4 @@@ extern void early_iounmap(void *addr, u
  extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
  
  
 -#endif /* _ASM_X86_IO_H */
 +#endif /* ASM_X86__IO_H */
index 3f4b1b6be88c35437c6da045f08c61655af8c788,a48c7f2dbdc04b32f010fbc6267b7a479f37e578..c5d2d767a1f356366e7ee57716ffd057ff3deb4a
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_IRQ_VECTORS_H
 -#define _ASM_IRQ_VECTORS_H
 +#ifndef ASM_X86__IRQ_VECTORS_H
 +#define ASM_X86__IRQ_VECTORS_H
  
  #include <linux/threads.h>
  
@@@ -76,6 -76,7 +76,7 @@@
  #define CALL_FUNCTION_SINGLE_VECTOR   0xfb
  #define THERMAL_APIC_VECTOR           0xfa
  #define THRESHOLD_APIC_VECTOR         0xf9
+ #define UV_BAU_MESSAGE                        0xf8
  #define INVALIDATE_TLB_VECTOR_END     0xf7
  #define INVALIDATE_TLB_VECTOR_START   0xf0    /* f0-f7 used for TLB flush */
  
  #define VIC_CPU_BOOT_ERRATA_CPI               (VIC_CPI_LEVEL0 + 8)
  
  
 -#endif /* _ASM_IRQ_VECTORS_H */
 +#endif /* ASM_X86__IRQ_VECTORS_H */
diff --combined include/asm-x86/kexec.h
index 17bde9552a8898dd0255d954f2fa08d23fb1b28c,4246ab7dc9887b58e898569a6173eeb15d3437a9..ea09600d6129543392b09936962a873e4e2ac622
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _KEXEC_H
 -#define _KEXEC_H
 +#ifndef ASM_X86__KEXEC_H
 +#define ASM_X86__KEXEC_H
  
  #ifdef CONFIG_X86_32
  # define PA_CONTROL_PAGE      0
  # define PAGES_NR             17
  #endif
  
+ #ifdef CONFIG_X86_32
+ # define KEXEC_CONTROL_CODE_MAX_SIZE  2048
+ #endif
  #ifndef __ASSEMBLY__
  
  #include <linux/string.h>
@@@ -63,7 -67,7 +67,7 @@@
  /* Maximum address we can use for the control code buffer */
  # define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
  
- # define KEXEC_CONTROL_CODE_SIZE      4096
+ # define KEXEC_CONTROL_PAGE_SIZE      4096
  
  /* The native architecture */
  # define KEXEC_ARCH KEXEC_ARCH_386
@@@ -79,7 -83,7 +83,7 @@@
  # define KEXEC_CONTROL_MEMORY_LIMIT     (0xFFFFFFFFFFUL)
  
  /* Allocate one page for the pdp and the second for the code */
- # define KEXEC_CONTROL_CODE_SIZE  (4096UL + 4096UL)
+ # define KEXEC_CONTROL_PAGE_SIZE  (4096UL + 4096UL)
  
  /* The native architecture */
  # define KEXEC_ARCH KEXEC_ARCH_X86_64
@@@ -168,4 -172,4 +172,4 @@@ relocate_kernel(unsigned long indirecti
  
  #endif /* __ASSEMBLY__ */
  
 -#endif /* _KEXEC_H */
 +#endif /* ASM_X86__KEXEC_H */
diff --combined include/asm-x86/mce.h
index 6a580f24d4a4bb9049c7b2834bfeb6a3ce52246f,531eaa587455a90c2274ef5f5491e8214dd51ccf..036133eaf7448e4625a713bab4b9ff3f53e98bb2
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_X86_MCE_H
 -#define _ASM_X86_MCE_H
 +#ifndef ASM_X86__MCE_H
 +#define ASM_X86__MCE_H
  
  #ifdef __x86_64__
  
@@@ -92,6 -92,7 +92,7 @@@ extern int mce_disabled
  
  void mce_log(struct mce *m);
  DECLARE_PER_CPU(struct sys_device, device_mce);
+ extern void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
  
  #ifdef CONFIG_X86_MCE_INTEL
  void mce_intel_feature_init(struct cpuinfo_x86 *c);
@@@ -126,4 -127,4 +127,4 @@@ extern void restart_mce(void)
  
  #endif /* __KERNEL__ */
  
 -#endif
 +#endif /* ASM_X86__MCE_H */
diff --combined include/asm-x86/mman.h
index b6b41aa1cbc837cefde500498e7e4d164865b4a5,90bc4108a4fdf917fc243502bd7fcf833f482a55..4ef28e6de3837e38db2bd98a2af0116c67dd464b
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_X86_MMAN_H
 -#define _ASM_X86_MMAN_H
 +#ifndef ASM_X86__MMAN_H
 +#define ASM_X86__MMAN_H
  
  #include <asm-generic/mman.h>
  
@@@ -12,8 -12,9 +12,9 @@@
  #define MAP_NORESERVE 0x4000          /* don't check for reservations */
  #define MAP_POPULATE  0x8000          /* populate (prefault) pagetables */
  #define MAP_NONBLOCK  0x10000         /* do not block on IO */
+ #define MAP_STACK     0x20000         /* give out an address that is best suited for process/thread stacks */
  
  #define MCL_CURRENT   1               /* lock all current mappings */
  #define MCL_FUTURE    2               /* lock all future mappings */
  
 -#endif /* _ASM_X86_MMAN_H */
 +#endif /* ASM_X86__MMAN_H */
index 8689f1e7bc01d6a8d629911c16000ea11e46a71d,e293ab81e85017b21dbd0f534ba41692748795ec..fb79b1cf5d07bdcd24360a776a10cdca2d213274
@@@ -1,12 -1,12 +1,12 @@@
 -#ifndef _ASM_MMCONFIG_H
 -#define _ASM_MMCONFIG_H
 +#ifndef ASM_X86__MMCONFIG_H
 +#define ASM_X86__MMCONFIG_H
  
  #ifdef CONFIG_PCI_MMCONFIG
  extern void __cpuinit fam10h_check_enable_mmcfg(void);
- extern void __init check_enable_amd_mmconf_dmi(void);
+ extern void __cpuinit check_enable_amd_mmconf_dmi(void);
  #else
  static inline void fam10h_check_enable_mmcfg(void) { }
  static inline void check_enable_amd_mmconf_dmi(void) { }
  #endif
  
 -#endif
 +#endif /* ASM_X86__MMCONFIG_H */
index b98590fdc9ea0388bdb2f7e4c66560f7cd86c4d8,5862e6460658d29fc8be6b2a9b2a26389522eb1f..121b65d61d868ca09a4a2c81d61a2c36154fbc52
@@@ -3,8 -3,8 +3,8 @@@
   *
   */
  
 -#ifndef _ASM_MMZONE_H_
 -#define _ASM_MMZONE_H_
 +#ifndef ASM_X86__MMZONE_32_H
 +#define ASM_X86__MMZONE_32_H
  
  #include <asm/smp.h>
  
@@@ -97,10 -97,16 +97,16 @@@ static inline int pfn_valid(int pfn
        reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags))
  #define alloc_bootmem(x) \
        __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
+ #define alloc_bootmem_nopanic(x) \
+       __alloc_bootmem_node_nopanic(NODE_DATA(0), (x), SMP_CACHE_BYTES, \
+                               __pa(MAX_DMA_ADDRESS))
  #define alloc_bootmem_low(x) \
        __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0)
  #define alloc_bootmem_pages(x) \
        __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
+ #define alloc_bootmem_pages_nopanic(x) \
+       __alloc_bootmem_node_nopanic(NODE_DATA(0), (x), PAGE_SIZE, \
+                               __pa(MAX_DMA_ADDRESS))
  #define alloc_bootmem_low_pages(x) \
        __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0)
  #define alloc_bootmem_node(pgdat, x)                                  \
  })
  #endif /* CONFIG_NEED_MULTIPLE_NODES */
  
 -#endif /* _ASM_MMZONE_H_ */
 +#endif /* ASM_X86__MMZONE_32_H */
diff --combined include/asm-x86/msr.h
index 032992035bd9f73fabecce20f957b1dff051c717,2362cfda1fbcfe08ebdc173b87b6a7818892a5f7..eee83f783f6d1244fd81673b3db71e98309c3266
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef __ASM_X86_MSR_H_
 -#define __ASM_X86_MSR_H_
 +#ifndef ASM_X86__MSR_H
 +#define ASM_X86__MSR_H
  
  #include <asm/msr-index.h>
  
@@@ -52,14 -52,14 +52,14 @@@ static inline unsigned long long native
  {
        DECLARE_ARGS(val, low, high);
  
-       asm volatile("2: rdmsr ; xor %0,%0\n"
+       asm volatile("2: rdmsr ; xor %[err],%[err]\n"
                     "1:\n\t"
                     ".section .fixup,\"ax\"\n\t"
-                    "3:  mov %3,%0 ; jmp 1b\n\t"
+                    "3:  mov %[fault],%[err] ; jmp 1b\n\t"
                     ".previous\n\t"
                     _ASM_EXTABLE(2b, 3b)
-                    : "=r" (*err), EAX_EDX_RET(val, low, high)
-                    : "c" (msr), "i" (-EFAULT));
+                    : [err] "=r" (*err), EAX_EDX_RET(val, low, high)
+                    : "c" (msr), [fault] "i" (-EFAULT));
        return EAX_EDX_VAL(val, low, high);
  }
  
@@@ -73,15 -73,15 +73,15 @@@ static inline int native_write_msr_safe
                                        unsigned low, unsigned high)
  {
        int err;
-       asm volatile("2: wrmsr ; xor %0,%0\n"
+       asm volatile("2: wrmsr ; xor %[err],%[err]\n"
                     "1:\n\t"
                     ".section .fixup,\"ax\"\n\t"
-                    "3:  mov %4,%0 ; jmp 1b\n\t"
+                    "3:  mov %[fault],%[err] ; jmp 1b\n\t"
                     ".previous\n\t"
                     _ASM_EXTABLE(2b, 3b)
-                    : "=a" (err)
+                    : [err] "=a" (err)
                     : "c" (msr), "0" (low), "d" (high),
-                      "i" (-EFAULT)
+                      [fault] "i" (-EFAULT)
                     : "memory");
        return err;
  }
@@@ -192,19 -192,20 +192,20 @@@ do 
  #define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0)
  
  #ifdef CONFIG_SMP
void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
  int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
  int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
  #else  /*  CONFIG_SMP  */
- static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
+ static inline int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
  {
        rdmsr(msr_no, *l, *h);
+       return 0;
  }
- static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
+ static inline int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
  {
        wrmsr(msr_no, l, h);
+       return 0;
  }
  static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no,
                                    u32 *l, u32 *h)
@@@ -220,4 -221,4 +221,4 @@@ static inline int wrmsr_safe_on_cpu(uns
  #endif /* __KERNEL__ */
  
  
 -#endif
 +#endif /* ASM_X86__MSR_H */
diff --combined include/asm-x86/percpu.h
index 0afc8324807eb0248047ab5261fc36b966b55db2,f643a3a92da08b3789efde09f883850f0e85b0ac..e10a1d0678cfaa014ad702e1169e5d7417240f52
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_X86_PERCPU_H_
 -#define _ASM_X86_PERCPU_H_
 +#ifndef ASM_X86__PERCPU_H
 +#define ASM_X86__PERCPU_H
  
  #ifdef CONFIG_X86_64
  #include <linux/compiler.h>
@@@ -182,7 -182,7 +182,7 @@@ do {                                                       
        DEFINE_PER_CPU(_type, _name) = _initvalue;                      \
        __typeof__(_type) _name##_early_map[NR_CPUS] __initdata =       \
                                { [0 ... NR_CPUS-1] = _initvalue };     \
-       __typeof__(_type) *_name##_early_ptr = _name##_early_map
+       __typeof__(_type) *_name##_early_ptr __refdata = _name##_early_map
  
  #define EXPORT_EARLY_PER_CPU_SYMBOL(_name)                    \
        EXPORT_PER_CPU_SYMBOL(_name)
  
  #endif        /* !CONFIG_SMP */
  
 -#endif /* _ASM_X86_PERCPU_H_ */
 +#endif /* ASM_X86__PERCPU_H */
index 609c24975c663d85b168f36748443b15df1b260d,549144d03d99e7972ec2d4806b1763c2c41c933f..e3dcf7a08a0bc5566dcbb4a4dcf32e3dd55d0380
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _X86_64_PGTABLE_H
 -#define _X86_64_PGTABLE_H
 +#ifndef ASM_X86__PGTABLE_64_H
 +#define ASM_X86__PGTABLE_64_H
  
  #include <linux/const.h>
  #ifndef __ASSEMBLY__
@@@ -151,7 -151,7 +151,7 @@@ static inline void native_pgd_clear(pgd
  #define VMALLOC_END      _AC(0xffffe1ffffffffff, UL)
  #define VMEMMAP_START  _AC(0xffffe20000000000, UL)
  #define MODULES_VADDR    _AC(0xffffffffa0000000, UL)
- #define MODULES_END      _AC(0xfffffffffff00000, UL)
+ #define MODULES_END      _AC(0xffffffffff000000, UL)
  #define MODULES_LEN   (MODULES_END - MODULES_VADDR)
  
  #ifndef __ASSEMBLY__
@@@ -284,4 -284,4 +284,4 @@@ extern void cleanup_highmap(void)
  #define __HAVE_ARCH_PTE_SAME
  #endif /* !__ASSEMBLY__ */
  
 -#endif /* _X86_64_PGTABLE_H */
 +#endif /* ASM_X86__PGTABLE_64_H */
index 6d5648945ebf86fff45e85b5fe3cf64c6a65697e,4df3e2f6fb563f2039cbc90aa4016dce9cf9274c..10471cfab145a82012ac7e32abdda0752db371df
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef __ASM_X86_PROCESSOR_H
 -#define __ASM_X86_PROCESSOR_H
 +#ifndef ASM_X86__PROCESSOR_H
 +#define ASM_X86__PROCESSOR_H
  
  #include <asm/processor-flags.h>
  
@@@ -140,8 -140,6 +140,8 @@@ DECLARE_PER_CPU(struct cpuinfo_x86, cpu
  #define current_cpu_data      boot_cpu_data
  #endif
  
 +extern const struct seq_operations cpuinfo_op;
 +
  static inline int hlt_works(int cpu)
  {
  #ifdef CONFIG_X86_32
  
  extern void cpu_detect(struct cpuinfo_x86 *c);
  
 +extern struct pt_regs *idle_regs(struct pt_regs *);
 +
  extern void early_cpu_init(void);
  extern void identify_boot_cpu(void);
  extern void identify_secondary_cpu(struct cpuinfo_x86 *);
@@@ -732,6 -728,29 +732,29 @@@ extern unsigned long             boot_option_idle_
  extern unsigned long          idle_halt;
  extern unsigned long          idle_nomwait;
  
+ /*
+  * on systems with caches, caches must be flashed as the absolute
+  * last instruction before going into a suspended halt.  Otherwise,
+  * dirty data can linger in the cache and become stale on resume,
+  * leading to strange errors.
+  *
+  * perform a variety of operations to guarantee that the compiler
+  * will not reorder instructions.  wbinvd itself is serializing
+  * so the processor will not reorder.
+  *
+  * Systems without cache can just go into halt.
+  */
+ static inline void wbinvd_halt(void)
+ {
+       mb();
+       /* check for clflush to determine if wbinvd is legal */
+       if (cpu_has_clflush)
+               asm volatile("cli; wbinvd; 1: hlt; jmp 1b" : : : "memory");
+       else
+               while (1)
+                       halt();
+ }
  extern void enable_sep_cpu(void);
  extern int sysenter_setup(void);
  
@@@ -924,4 -943,4 +947,4 @@@ extern void start_thread(struct pt_reg
  extern int get_tsc_mode(unsigned long adr);
  extern int set_tsc_mode(unsigned int val);
  
 -#endif
 +#endif /* ASM_X86__PROCESSOR_H */
index d6822e099c57a1b519df6dfd239c6465f200a585,5c2ff4bc2980b0c21d4973f52c123ab1cca45e7f..a01c4e376331ab48f65df1cd979439022fbd7cde
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _ASM_REQUIRED_FEATURES_H
 -#define _ASM_REQUIRED_FEATURES_H 1
 +#ifndef ASM_X86__REQUIRED_FEATURES_H
 +#define ASM_X86__REQUIRED_FEATURES_H
  
  /* Define minimum CPUID feature set for kernel These bits are checked
     really early to actually display a visible error message before the
  # define NEED_3DNOW   0
  #endif
  
+ #if defined(CONFIG_X86_P6_NOP) || defined(CONFIG_X86_64)
+ # define NEED_NOPL    (1<<(X86_FEATURE_NOPL & 31))
+ #else
+ # define NEED_NOPL    0
+ #endif
  #ifdef CONFIG_X86_64
  #define NEED_PSE      0
  #define NEED_MSR      (1<<(X86_FEATURE_MSR & 31))
  #define REQUIRED_MASK1        (NEED_LM|NEED_3DNOW)
  
  #define REQUIRED_MASK2        0
- #define REQUIRED_MASK3        0
+ #define REQUIRED_MASK3        (NEED_NOPL)
  #define REQUIRED_MASK4        0
  #define REQUIRED_MASK5        0
  #define REQUIRED_MASK6        0
  #define REQUIRED_MASK7        0
  
 -#endif
 +#endif /* ASM_X86__REQUIRED_FEATURES_H */
index cbe01086ba640e4af05ad1b32a8f2bad2ae3699e,e39c790dbfd2be789d812a6cdd89efc3d39cb5ec..5d08fa280fdf3f4f27594b6a2d78ebe702d31731
@@@ -1,5 -1,5 +1,5 @@@
 -#ifndef _X86_SPINLOCK_H_
 -#define _X86_SPINLOCK_H_
 +#ifndef ASM_X86__SPINLOCK_H
 +#define ASM_X86__SPINLOCK_H
  
  #include <asm/atomic.h>
  #include <asm/rwlock.h>
@@@ -65,7 -65,7 +65,7 @@@ static inline int __ticket_spin_is_cont
  {
        int tmp = ACCESS_ONCE(lock->slock);
  
-       return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1;
+       return (((tmp >> 8) - tmp) & 0xff) > 1;
  }
  
  static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
@@@ -127,7 -127,7 +127,7 @@@ static inline int __ticket_spin_is_cont
  {
        int tmp = ACCESS_ONCE(lock->slock);
  
-       return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1;
+       return (((tmp >> 16) - tmp) & 0xffff) > 1;
  }
  
  static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
@@@ -366,4 -366,4 +366,4 @@@ static inline void __raw_write_unlock(r
  #define _raw_read_relax(lock) cpu_relax()
  #define _raw_write_relax(lock)        cpu_relax()
  
 -#endif
 +#endif /* ASM_X86__SPINLOCK_H */
index 0950239acaf61014f2564f4887c269ed3c011476,610b6b308e93a005ff98753ea3d8586b131202ab..77153fb18f5e085c5b518cdee6e27a587d01a938
@@@ -8,8 -8,8 +8,8 @@@
   * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
   */
  
 -#ifndef __ASM_X86_UV_BAU__
 -#define __ASM_X86_UV_BAU__
 +#ifndef ASM_X86__UV__UV_BAU_H
 +#define ASM_X86__UV__UV_BAU_H
  
  #include <linux/bitmap.h>
  #define BITSPERBYTE 8
  #define UV_ACTIVATION_DESCRIPTOR_SIZE 32
  #define UV_DISTRIBUTION_SIZE          256
  #define UV_SW_ACK_NPENDING            8
- #define UV_BAU_MESSAGE                        200
- /*
-  * Messaging irq; see irq_64.h and include/asm-x86/hw_irq_64.h
-  * To be dynamically allocated in the future
-  */
  #define UV_NET_ENDPOINT_INTD          0x38
  #define UV_DESC_BASE_PNODE_SHIFT      49
  #define UV_PAYLOADQ_PNODE_SHIFT               49
@@@ -334,4 -329,4 +329,4 @@@ extern int uv_flush_tlb_others(cpumask_
  extern void uv_bau_message_intr1(void);
  extern void uv_bau_timeout_intr1(void);
  
 -#endif /* __ASM_X86_UV_BAU__ */
 +#endif /* ASM_X86__UV__UV_BAU_H */
index 06c350452c500f48060f087cd0bd206fafb9a9b0,04ee0610014ab69e14b602487a197e5536fa9813..0ef3a88b869df8c67ec6ec64021b664d5aec71a7
   * IN THE SOFTWARE.
   */
  
 -#ifndef __HYPERVISOR_H__
 -#define __HYPERVISOR_H__
 +#ifndef ASM_X86__XEN__HYPERVISOR_H
 +#define ASM_X86__XEN__HYPERVISOR_H
  
  #include <linux/types.h>
  #include <linux/kernel.h>
- #include <linux/version.h>
  
  #include <xen/interface/xen.h>
  #include <xen/interface/version.h>
@@@ -70,4 -69,4 +69,4 @@@ u64 jiffies_to_st(unsigned long jiffies
  
  #define is_running_on_xen()   (xen_start_info ? 1 : 0)
  
 -#endif /* __HYPERVISOR_H__ */
 +#endif /* ASM_X86__XEN__HYPERVISOR_H */