ia64/xen-unstable

changeset 12318:1d4fc7396c41

[VMX] Check INTR_TYPE is NMI before doing physical NMI processing.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Nov 08 15:10:21 2006 +0000 (2006-11-08)
parents 4e3ddf1288fb
children 6555ca56d844
files xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vmx/vmx.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Nov 07 18:14:16 2006 -0700
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Nov 08 15:10:21 2006 +0000
     1.3 @@ -2112,17 +2112,19 @@ asmlinkage void vmx_vmexit_handler(struc
     1.4           * (1) We can get an exception (e.g. #PG) in the guest, or
     1.5           * (2) NMI
     1.6           */
     1.7 -        unsigned int vector;
     1.8 +        unsigned int intr_info, vector;
     1.9  
    1.10 -        if ( __vmread(VM_EXIT_INTR_INFO, &vector) ||
    1.11 -             !(vector & INTR_INFO_VALID_MASK) )
    1.12 -            domain_crash_synchronous();
    1.13 -        vector &= INTR_INFO_VECTOR_MASK;
    1.14 +        if ( __vmread(VM_EXIT_INTR_INFO, &intr_info) ||
    1.15 +             !(intr_info & INTR_INFO_VALID_MASK) )
    1.16 +            __hvm_bug(regs);
    1.17 +
    1.18 +        vector = intr_info & INTR_INFO_VECTOR_MASK;
    1.19  
    1.20          TRACE_VMEXIT(1, vector);
    1.21          perfc_incra(cause_vector, vector);
    1.22  
    1.23 -        switch ( vector ) {
    1.24 +        switch ( vector )
    1.25 +        {
    1.26  #ifdef XEN_DEBUGGER
    1.27          case TRAP_debug:
    1.28          {
    1.29 @@ -2198,7 +2200,10 @@ asmlinkage void vmx_vmexit_handler(struc
    1.30              break;
    1.31          }
    1.32          case TRAP_nmi:
    1.33 -            do_nmi(regs);
    1.34 +            if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI )
    1.35 +                do_nmi(regs); /* Real NMI, vector 2: normal processing. */
    1.36 +            else
    1.37 +                vmx_reflect_exception(v);
    1.38              break;
    1.39          default:
    1.40              vmx_reflect_exception(v);
     2.1 --- a/xen/include/asm-x86/hvm/vmx/vmx.h	Tue Nov 07 18:14:16 2006 -0700
     2.2 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Wed Nov 08 15:10:21 2006 +0000
     2.3 @@ -93,6 +93,7 @@ extern unsigned int cpu_rev;
     2.4  #define INTR_INFO_VALID_MASK            0x80000000      /* 31 */
     2.5  
     2.6  #define INTR_TYPE_EXT_INTR              (0 << 8)    /* external interrupt */
     2.7 +#define INTR_TYPE_NMI                   (2 << 8)    /* NMI                */
     2.8  #define INTR_TYPE_HW_EXCEPTION          (3 << 8)    /* hardware exception */
     2.9  #define INTR_TYPE_SW_EXCEPTION          (6 << 8)    /* software exception */
    2.10