X86: Add a delay between INIT & SIPIs for tboot AP bring-up in X2APIC case
authorGang Wei <gang.wei@intel.com>
Thu, 29 Dec 2011 10:07:54 +0000 (10:07 +0000)
committerGang Wei <gang.wei@intel.com>
Thu, 29 Dec 2011 10:07:54 +0000 (10:07 +0000)
Without this delay, Xen could not bring APs up while working with
TXT/tboot, because tboot needs some time in APs to handle INIT before
becoming ready for receiving SIPIs (this delay was removed as part of
c/s 23724 by Tim Deegan).

Signed-off-by: Gang Wei <gang.wei@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/smpboot.c

index ebcd2c754df80ea4d759922b58f3c23ac10ba723..748932366b5571bce9d614f25a11b0bde7c8fab5 100644 (file)
@@ -42,6 +42,7 @@
 #include <asm/msr.h>
 #include <asm/mtrr.h>
 #include <asm/time.h>
+#include <asm/tboot.h>
 #include <mach_apic.h>
 #include <mach_wakecpu.h>
 #include <smpboot_hooks.h>
@@ -463,6 +464,18 @@ static int wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
             send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
         } while ( send_status && (timeout++ < 1000) );
     }
+    else if ( tboot_in_measured_env() )
+    {
+        /*
+         * With tboot AP is actually spinning in a mini-guest before 
+         * receiving INIT. Upon receiving INIT ipi, AP need time to VMExit, 
+         * update VMCS to tracking SIPIs and VMResume.
+         *
+         * While AP is in root mode handling the INIT the CPU will drop
+         * any SIPIs
+         */
+        udelay(10);
+    }
 
     /*
      * Should we send STARTUP IPIs ?