[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm: Define common (across VMX and SVM) set of event types.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1185873107 -3600
# Node ID 66147ca8f9c45a89676a8b7dd42f1ea590e840f1
# Parent  9174a8cfb57851a0def9e7d61adb4b2846120355
hvm: Define common (across VMX and SVM) set of event types.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/intr.c        |    4 ++--
 xen/arch/x86/hvm/svm/svm.c         |    6 +++---
 xen/arch/x86/hvm/vmx/intr.c        |    3 ++-
 xen/arch/x86/hvm/vmx/vmx.c         |    3 ++-
 xen/include/asm-x86/hvm/hvm.h      |   11 +++++++++++
 xen/include/asm-x86/hvm/svm/vmcb.h |    8 --------
 xen/include/asm-x86/hvm/vmx/vmx.h  |   13 ++++---------
 7 files changed, 24 insertions(+), 24 deletions(-)

diff -r 9174a8cfb578 -r 66147ca8f9c4 xen/arch/x86/hvm/svm/intr.c
--- a/xen/arch/x86/hvm/svm/intr.c       Tue Jul 31 09:47:11 2007 +0100
+++ b/xen/arch/x86/hvm/svm/intr.c       Tue Jul 31 10:11:47 2007 +0100
@@ -58,7 +58,7 @@ static void svm_inject_nmi(struct vcpu *
 
     event.bytes = 0;
     event.fields.v = 1;
-    event.fields.type = EVENTTYPE_NMI;
+    event.fields.type = X86_EVENTTYPE_NMI;
     event.fields.vector = 2;
 
     ASSERT(vmcb->eventinj.fields.v == 0);
@@ -72,7 +72,7 @@ static void svm_inject_extint(struct vcp
 
     event.bytes = 0;
     event.fields.v = 1;
-    event.fields.type = EVENTTYPE_INTR;
+    event.fields.type = X86_EVENTTYPE_EXT_INTR;
     event.fields.vector = vector;
 
     ASSERT(vmcb->eventinj.fields.v == 0);
diff -r 9174a8cfb578 -r 66147ca8f9c4 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Tue Jul 31 09:47:11 2007 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Tue Jul 31 10:11:47 2007 +0100
@@ -71,8 +71,8 @@ static void *root_vmcb[NR_CPUS] __read_m
 /* hardware assisted paging bits */
 extern int opt_hap_enabled;
 
-static void svm_inject_exception(struct vcpu *v, int trap, 
-                                        int ev, int error_code)
+static void svm_inject_exception(
+    struct vcpu *v, int trap, int ev, int error_code)
 {
     eventinj_t event;
     struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
@@ -84,7 +84,7 @@ static void svm_inject_exception(struct 
 
     event.bytes = 0;            
     event.fields.v = 1;
-    event.fields.type = EVENTTYPE_EXCEPTION;
+    event.fields.type = X86_EVENTTYPE_HW_EXCEPTION;
     event.fields.vector = trap;
     event.fields.ev = ev;
     event.fields.errorcode = error_code;
diff -r 9174a8cfb578 -r 66147ca8f9c4 xen/arch/x86/hvm/vmx/intr.c
--- a/xen/arch/x86/hvm/vmx/intr.c       Tue Jul 31 09:47:11 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/intr.c       Tue Jul 31 10:11:47 2007 +0100
@@ -175,7 +175,8 @@ asmlinkage void vmx_intr_assist(void)
              * Clear NMI-blocking interruptibility info if an NMI delivery
              * faulted. Re-delivery will re-set it (see SDM 3B 25.7.1.2).
              */
-            if ( (idtv_info_field&INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI )
+            if ( (idtv_info_field&INTR_INFO_INTR_TYPE_MASK) ==
+                 (X86_EVENTTYPE_NMI << 8) )
                 __vmwrite(GUEST_INTERRUPTIBILITY_INFO,
                           __vmread(GUEST_INTERRUPTIBILITY_INFO) &
                           ~VMX_INTR_SHADOW_NMI);
diff -r 9174a8cfb578 -r 66147ca8f9c4 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue Jul 31 09:47:11 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Jul 31 10:11:47 2007 +0100
@@ -2965,7 +2965,8 @@ asmlinkage void vmx_vmexit_handler(struc
             vmx_inject_hw_exception(v, TRAP_page_fault, regs->error_code);
             break;
         case TRAP_nmi:
-            if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) != INTR_TYPE_NMI )
+            if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) !=
+                 (X86_EVENTTYPE_NMI << 8) )
                 goto exit_and_crash;
             HVMTRACE_0D(NMI, v);
             vmx_store_cpu_guest_regs(v, regs, NULL);
diff -r 9174a8cfb578 -r 66147ca8f9c4 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Tue Jul 31 09:47:11 2007 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Tue Jul 31 10:11:47 2007 +0100
@@ -323,6 +323,17 @@ static inline int hvm_event_injection_fa
 /* These exceptions must always be intercepted. */
 #define HVM_TRAP_MASK (1U << TRAP_machine_check)
 
+/*
+ * x86 event types. This enumeration is valid for:
+ *  Intel VMX: {VM_ENTRY,VM_EXIT,IDT_VECTORING}_INTR_INFO[10:8]
+ *  AMD SVM: eventinj[10:8] and exitintinfo[10:8] (types 0-4 only)
+ */
+#define X86_EVENTTYPE_EXT_INTR              0    /* external interrupt */
+#define X86_EVENTTYPE_NMI                   2    /* NMI                */
+#define X86_EVENTTYPE_HW_EXCEPTION          3    /* hardware exception */
+#define X86_EVENTTYPE_SW_INTERRUPT          4    /* software interrupt */
+#define X86_EVENTTYPE_SW_EXCEPTION          6    /* software exception */
+
 static inline int hvm_cpu_up(void)
 {
     if ( hvm_funcs.cpu_up )
diff -r 9174a8cfb578 -r 66147ca8f9c4 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h        Tue Jul 31 09:47:11 2007 +0100
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h        Tue Jul 31 10:11:47 2007 +0100
@@ -319,14 +319,6 @@ typedef union
         u64 errorcode:32;
     } fields;
 } __attribute__ ((packed)) eventinj_t;
-
-enum EVENTTYPES
-{
-    EVENTTYPE_INTR = 0,
-    EVENTTYPE_NMI = 2,
-    EVENTTYPE_EXCEPTION = 3,
-    EVENTTYPE_SWINT = 4,
-};
 
 typedef union 
 {
diff -r 9174a8cfb578 -r 66147ca8f9c4 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Tue Jul 31 09:47:11 2007 +0100
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Tue Jul 31 10:11:47 2007 +0100
@@ -94,11 +94,6 @@ void vmx_vlapic_msr_changed(struct vcpu 
 #define INTR_INFO_VALID_MASK            0x80000000      /* 31 */
 #define INTR_INFO_RESVD_BITS_MASK       0x7ffff000
 
-#define INTR_TYPE_EXT_INTR              (0 << 8)    /* external interrupt */
-#define INTR_TYPE_NMI                   (2 << 8)    /* NMI                */
-#define INTR_TYPE_HW_EXCEPTION          (3 << 8)    /* hardware exception */
-#define INTR_TYPE_SW_EXCEPTION          (6 << 8)    /* software exception */
-
 /*
  * Exit Qualifications for MOV for Control Register Access
  */
@@ -276,7 +271,7 @@ static inline void __vmx_inject_exceptio
      *   VM entry]", PRM Vol. 3, 22.6.1 (Interruptibility State).
      */
 
-    intr_fields = (INTR_INFO_VALID_MASK | type | trap);
+    intr_fields = (INTR_INFO_VALID_MASK | (type<<8) | trap);
     if ( error_code != VMX_DELIVER_NO_ERROR_CODE ) {
         __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
         intr_fields |= INTR_INFO_DELIVER_CODE_MASK;
@@ -294,18 +289,18 @@ static inline void vmx_inject_hw_excepti
     struct vcpu *v, int trap, int error_code)
 {
     v->arch.hvm_vmx.vector_injected = 1;
-    __vmx_inject_exception(v, trap, INTR_TYPE_HW_EXCEPTION, error_code);
+    __vmx_inject_exception(v, trap, X86_EVENTTYPE_HW_EXCEPTION, error_code);
 }
 
 static inline void vmx_inject_extint(struct vcpu *v, int trap)
 {
-    __vmx_inject_exception(v, trap, INTR_TYPE_EXT_INTR,
+    __vmx_inject_exception(v, trap, X86_EVENTTYPE_EXT_INTR,
                            VMX_DELIVER_NO_ERROR_CODE);
 }
 
 static inline void vmx_inject_nmi(struct vcpu *v)
 {
-    __vmx_inject_exception(v, 2, INTR_TYPE_NMI,
+    __vmx_inject_exception(v, 2, X86_EVENTTYPE_NMI,
                            VMX_DELIVER_NO_ERROR_CODE);
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.