]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86/boot: enable NMIs after traps init
authorSergey Dyasli <sergey.dyasli@citrix.com>
Tue, 23 Oct 2018 10:59:12 +0000 (11:59 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 23 Oct 2018 11:33:54 +0000 (12:33 +0100)
In certain scenarios, NMIs might be disabled during Xen boot process.
Such situation will cause alternative_instructions() to:

    panic("Timed out waiting for alternatives self-NMI to hit\n");

This bug was originally seen when using Tboot to boot Xen 4.11

To prevent this from happening, enable NMIs during cpu_init() and
during __start_xen() for BSP.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/cpu/common.c
xen/arch/x86/setup.c

index 057859ab146e38a9101f3a055f800a49843b93e3..9af2f307ad06ae2dcd6625381672e4142866a1d8 100644 (file)
@@ -819,6 +819,9 @@ void cpu_init(void)
 #define CD(register) asm volatile ( "mov %0,%%db" #register : : "r"(0UL) );
        CD(0); CD(1); CD(2); CD(3); /* no db4 and db5 */; CD(6); CD(7);
 #undef CD
+
+       /* Enable NMIs.  Our loader (e.g. Tboot) may have left them disabled. */
+       enable_nmis();
 }
 
 void cpu_uninit(unsigned int cpu)
index 93b79c7c0cd2c09e76b1c2332a6284f30740d2f2..55a288f332b511d71860f83f5ef2b57c4f76ed3b 100644 (file)
@@ -708,6 +708,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     /* Full exception support from here on in. */
 
+    /* Enable NMIs.  Our loader (e.g. Tboot) may have left them disabled. */
+    enable_nmis();
+
     if ( pvh_boot )
     {
         /*