[PATCH] i386: SMP boot hook for paravirt
authorZachary Amsden <zach@vmware.com>
Tue, 13 Feb 2007 12:26:21 +0000 (13:26 +0100)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 13 Feb 2007 12:26:21 +0000 (13:26 +0100)
Add VMI SMP boot hook.  We emulate a regular boot sequence and use the same
APIC IPI initiation, we just poke magic values to load into the CPU state when
the startup IPI is received, rather than having to jump through a real mode
trampoline.

This is all that was needed to get SMP to work.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
arch/i386/kernel/paravirt.c
arch/i386/kernel/smpboot.c
include/asm-i386/paravirt.h
include/asm-i386/smp.h

index 4dfdac4550dd2b92793d223c071b342a925bdea5..5bf81059a7e618a647b960e95d3e20e160e2f949 100644 (file)
@@ -572,6 +572,8 @@ struct paravirt_ops paravirt_ops = {
 
        .irq_enable_sysexit = native_irq_enable_sysexit,
        .iret = native_iret,
+
+       .startup_ipi_hook = (void *)native_nop,
 };
 
 /*
index 8c6c8c52b95c0b574b837c279f84647d3b4ba867..1908afa265b983dec0e22a51eeaeba4307b78fb3 100644 (file)
@@ -834,6 +834,13 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
        else
                num_starts = 0;
 
+       /*
+        * Paravirt / VMI wants a startup IPI hook here to set up the
+        * target processor state.
+        */
+       startup_ipi_hook(phys_apicid, (unsigned long) start_secondary,
+                        (unsigned long) stack_start.esp);
+
        /*
         * Run STARTUP IPI loop.
         */
index 38e5164bd0e70451de85dd66e92f6208c7dffb14..6ccf36499b2a853f043f0f7b78d90a8901d05caf 100644 (file)
@@ -151,6 +151,8 @@ struct paravirt_ops
        /* These two are jmp to, not actually called. */
        void (fastcall *irq_enable_sysexit)(void);
        void (fastcall *iret)(void);
+
+       void (fastcall *startup_ipi_hook)(int phys_apicid, unsigned long start_eip, unsigned long start_esp);
 };
 
 /* Mark a paravirt probe function. */
@@ -323,6 +325,13 @@ static inline unsigned long apic_read(unsigned long reg)
 }
 #endif
 
+#ifdef CONFIG_SMP
+static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
+                                   unsigned long start_esp)
+{
+       return paravirt_ops.startup_ipi_hook(phys_apicid, start_eip, start_esp);
+}
+#endif
 
 #define __flush_tlb() paravirt_ops.flush_tlb_user()
 #define __flush_tlb_global() paravirt_ops.flush_tlb_kernel()
index 64fe624c02caa5ed80838428a5366aa385924888..6bf0033a301cee618101682b53e0677d7ce36ac0 100644 (file)
@@ -52,6 +52,11 @@ extern void cpu_exit_clear(void);
 extern void cpu_uninit(void);
 #endif
 
+#ifndef CONFIG_PARAVIRT
+#define startup_ipi_hook(phys_apicid, start_eip, start_esp)            \
+do { } while (0)
+#endif
+
 /*
  * This function is needed by all SMP systems. It must _always_ be valid
  * from the initial startup. We map APIC_BASE very early in page_setup(),