x86, realmode: don't copy real_mode_header
[cascardo/linux.git] / arch / x86 / kernel / smpboot.c
index 5104a2b..b8c0661 100644 (file)
 #include <linux/tboot.h>
 #include <linux/stackprotector.h>
 #include <linux/gfp.h>
+#include <linux/cpuidle.h>
 
 #include <asm/acpi.h>
 #include <asm/desc.h>
 #include <asm/nmi.h>
 #include <asm/irq.h>
 #include <asm/idle.h>
-#include <asm/trampoline.h>
+#include <asm/realmode.h>
 #include <asm/cpu.h>
 #include <asm/numa.h>
 #include <asm/pgtable.h>
@@ -72,6 +73,8 @@
 #include <asm/smpboot_hooks.h>
 #include <asm/i8259.h>
 
+#include <asm/realmode.h>
+
 /* State of each CPU */
 DEFINE_PER_CPU(int, cpu_state) = { 0 };
 
@@ -219,14 +222,9 @@ static void __cpuinit smp_callin(void)
         * Update loops_per_jiffy in cpu_data. Previous call to
         * smp_store_cpu_info() stored a value that is close but not as
         * accurate as the value just calculated.
-        *
-        * Need to enable IRQs because it can take longer and then
-        * the NMI watchdog might kill us.
         */
-       local_irq_enable();
        calibrate_delay();
        cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy;
-       local_irq_disable();
        pr_debug("Stack at about %p\n", &cpuid);
 
        /*
@@ -666,8 +664,12 @@ static void __cpuinit announce_cpu(int cpu, int apicid)
  */
 static int __cpuinit do_boot_cpu(int apicid, int cpu)
 {
+       volatile u32 *trampoline_status =
+               (volatile u32 *) __va(real_mode_header->trampoline_status);
+       /* start_ip had better be page-aligned! */
+       unsigned long start_ip = real_mode_header->trampoline_data;
+
        unsigned long boot_error = 0;
-       unsigned long start_ip;
        int timeout;
        struct create_idle c_idle = {
                .cpu    = cpu,
@@ -717,9 +719,6 @@ do_rest:
        initial_code = (unsigned long)start_secondary;
        stack_start  = c_idle.idle->thread.sp;
 
-       /* start_ip had better be page-aligned! */
-       start_ip = trampoline_address();
-
        /* So we see what's up */
        announce_cpu(cpu, apicid);
 
@@ -782,8 +781,7 @@ do_rest:
                        pr_debug("CPU%d: has booted.\n", cpu);
                } else {
                        boot_error = 1;
-                       if (*(volatile u32 *)TRAMPOLINE_SYM(trampoline_status)
-                           == 0xA5A5A5A5)
+                       if (*trampoline_status == 0xA5A5A5A5)
                                /* trampoline started but...? */
                                pr_err("CPU%d: Stuck ??\n", cpu);
                        else
@@ -809,7 +807,7 @@ do_rest:
        }
 
        /* mark "stuck" area as not stuck */
-       *(volatile u32 *)TRAMPOLINE_SYM(trampoline_status) = 0;
+       *trampoline_status = 0;
 
        if (get_uv_system_type() != UV_NON_UNIQUE_APIC) {
                /*
@@ -1409,7 +1407,8 @@ void native_play_dead(void)
        tboot_shutdown(TB_SHUTDOWN_WFS);
 
        mwait_play_dead();      /* Only returns on failure */
-       hlt_play_dead();
+       if (cpuidle_play_dead())
+               hlt_play_dead();
 }
 
 #else /* ... !CONFIG_HOTPLUG_CPU */