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

[Xen-changelog] [xen-unstable] vmx: Enable WBINVD intercepts to avoid real WBINVD for non-vtd guests.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1194613198 0
# Node ID 8d8d179b9b05d46c0b0f7b745306269800b1e83a
# Parent  837f83225153547109480d63b3386cb8f65b5274
vmx: Enable WBINVD intercepts to avoid real WBINVD for non-vtd guests.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmcs.c        |    3 ++-
 xen/arch/x86/hvm/vmx/vmx.c         |   14 ++++++++++++--
 xen/include/asm-x86/hvm/vmx/vmcs.h |    1 +
 xen/include/asm-x86/hvm/vmx/vmx.h  |    5 +----
 4 files changed, 16 insertions(+), 7 deletions(-)

diff -r 837f83225153 -r 8d8d179b9b05 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Fri Nov 09 12:08:37 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Fri Nov 09 12:59:58 2007 +0000
@@ -106,7 +106,8 @@ static void vmx_init_vmcs_config(void)
     if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
     {
         min = 0;
-        opt = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+        opt = (SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
+               SECONDARY_EXEC_WBINVD_EXITING);
         _vmx_secondary_exec_control = adjust_vmx_controls(
             min, opt, MSR_IA32_VMX_PROCBASED_CTLS2);
     }
diff -r 837f83225153 -r 8d8d179b9b05 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Nov 09 12:08:37 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Fri Nov 09 12:59:58 2007 +0000
@@ -2909,11 +2909,21 @@ asmlinkage void vmx_vmexit_handler(struc
     }
 
     case EXIT_REASON_INVD:
-    {
-        inst_len = __get_instruction_length(); /* Safe: INVD */
+    case EXIT_REASON_WBINVD:
+    {
+        inst_len = __get_instruction_length(); /* Safe: INVD, WBINVD */
         __update_guest_eip(inst_len);
         if ( !list_empty(&(domain_hvm_iommu(v->domain)->pdev_list)) )
+        {
             wbinvd();
+            /* Disable further WBINVD intercepts. */
+            if ( (exit_reason == EXIT_REASON_WBINVD) &&
+                 (vmx_cpu_based_exec_control &
+                  CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) )
+                __vmwrite(SECONDARY_VM_EXEC_CONTROL,
+                          vmx_secondary_exec_control &
+                          ~SECONDARY_EXEC_WBINVD_EXITING);
+        }
         break;
     }
 
diff -r 837f83225153 -r 8d8d179b9b05 xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h        Fri Nov 09 12:08:37 2007 +0000
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h        Fri Nov 09 12:59:58 2007 +0000
@@ -131,6 +131,7 @@ extern u32 vmx_vmentry_control;
 extern u32 vmx_vmentry_control;
 
 #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
+#define SECONDARY_EXEC_WBINVD_EXITING           0x00000040
 extern u32 vmx_secondary_exec_control;
 
 extern bool_t cpu_has_vmx_ins_outs_instr_info;
diff -r 837f83225153 -r 8d8d179b9b05 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Fri Nov 09 12:08:37 2007 +0000
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Fri Nov 09 12:59:58 2007 +0000
@@ -71,18 +71,15 @@ void vmx_vlapic_msr_changed(struct vcpu 
 #define EXIT_REASON_IO_INSTRUCTION      30
 #define EXIT_REASON_MSR_READ            31
 #define EXIT_REASON_MSR_WRITE           32
-
 #define EXIT_REASON_INVALID_GUEST_STATE 33
 #define EXIT_REASON_MSR_LOADING         34
-
 #define EXIT_REASON_MWAIT_INSTRUCTION   36
 #define EXIT_REASON_MONITOR_INSTRUCTION 39
 #define EXIT_REASON_PAUSE_INSTRUCTION   40
-
 #define EXIT_REASON_MACHINE_CHECK       41
-
 #define EXIT_REASON_TPR_BELOW_THRESHOLD 43
 #define EXIT_REASON_APIC_ACCESS         44
+#define EXIT_REASON_WBINVD              54
 
 /*
  * Interruption-information format

_______________________________________________
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®.