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

[Xen-changelog] [xen-unstable] hvm vmx: VMX MSR bitmap format and size is VMX-specific, so move its



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175529540 -3600
# Node ID 8cf85d3f4f5f82433f5d4ed84525be37f17ccdf0
# Parent  e9986e48ebe1af8fda2a41858e2ea4b59478c4b3
hvm vmx: VMX MSR bitmap format and size is VMX-specific, so move its
allocation and initialisation into VMX-specific code.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c             |    6 ------
 xen/arch/x86/hvm/vmx/vmcs.c        |    2 +-
 xen/arch/x86/hvm/vmx/vmx.c         |   13 +++++++++----
 xen/include/asm-x86/hvm/support.h  |    1 -
 xen/include/asm-x86/hvm/vmx/vmcs.h |    1 +
 5 files changed, 11 insertions(+), 12 deletions(-)

diff -r e9986e48ebe1 -r 8cf85d3f4f5f xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Mon Apr 02 16:51:52 2007 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Mon Apr 02 16:59:00 2007 +0100
@@ -59,9 +59,6 @@ struct hvm_function_table hvm_funcs __re
 /* I/O permission bitmap is globally shared by all HVM guests. */
 char __attribute__ ((__section__ (".bss.page_aligned")))
     hvm_io_bitmap[3*PAGE_SIZE];
-/* MSR permission bitmap is globally shared by all HVM guests. */
-char __attribute__ ((__section__ (".bss.page_aligned")))
-    hvm_msr_bitmap[PAGE_SIZE];
 
 void hvm_enable(struct hvm_function_table *fns)
 {
@@ -74,9 +71,6 @@ void hvm_enable(struct hvm_function_tabl
      */
     memset(hvm_io_bitmap, ~0, sizeof(hvm_io_bitmap));
     clear_bit(0x80, hvm_io_bitmap);
-
-    /* All MSR accesses are intercepted by default. */
-    memset(hvm_msr_bitmap, ~0, sizeof(hvm_msr_bitmap));
 
     hvm_funcs   = *fns;
     hvm_enabled = 1;
diff -r e9986e48ebe1 -r 8cf85d3f4f5f xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Mon Apr 02 16:51:52 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Mon Apr 02 16:59:00 2007 +0100
@@ -289,7 +289,7 @@ static void construct_vmcs(struct vcpu *
     v->arch.hvm_vcpu.u.vmx.exec_control = vmx_cpu_based_exec_control;
 
     if ( cpu_has_vmx_msr_bitmap )
-        __vmwrite(MSR_BITMAP, virt_to_maddr(hvm_msr_bitmap));
+        __vmwrite(MSR_BITMAP, virt_to_maddr(vmx_msr_bitmap));
 
     /* I/O access bitmap. */
     __vmwrite(IO_BITMAP_A, virt_to_maddr(hvm_io_bitmap));
diff -r e9986e48ebe1 -r 8cf85d3f4f5f xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Mon Apr 02 16:51:52 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Mon Apr 02 16:59:00 2007 +0100
@@ -51,6 +51,8 @@
 #include <public/hvm/save.h>
 #include <asm/hvm/trace.h>
 
+char *vmx_msr_bitmap;
+
 static void vmx_ctxt_switch_from(struct vcpu *v);
 static void vmx_ctxt_switch_to(struct vcpu *v);
 
@@ -1005,14 +1007,14 @@ static void disable_intercept_for_msr(u3
      */
     if ( msr <= 0x1fff )
     {
-        __clear_bit(msr, hvm_msr_bitmap + 0x000); /* read-low */
-        __clear_bit(msr, hvm_msr_bitmap + 0x800); /* write-low */
+        __clear_bit(msr, vmx_msr_bitmap + 0x000); /* read-low */
+        __clear_bit(msr, vmx_msr_bitmap + 0x800); /* write-low */
     }
     else if ( (msr >= 0xc0000000) && (msr <= 0xc0001fff) )
     {
         msr &= 0x1fff;
-        __clear_bit(msr, hvm_msr_bitmap + 0x400); /* read-high */
-        __clear_bit(msr, hvm_msr_bitmap + 0xc00); /* write-high */
+        __clear_bit(msr, vmx_msr_bitmap + 0x400); /* read-high */
+        __clear_bit(msr, vmx_msr_bitmap + 0xc00); /* write-high */
     }
 }
 
@@ -1105,6 +1107,9 @@ int start_vmx(void)
     if ( cpu_has_vmx_msr_bitmap )
     {
         printk("VMX: MSR intercept bitmap enabled\n");
+        vmx_msr_bitmap = alloc_xenheap_page();
+        BUG_ON(vmx_msr_bitmap == NULL);
+        memset(vmx_msr_bitmap, ~0, PAGE_SIZE);
         disable_intercept_for_msr(MSR_FS_BASE);
         disable_intercept_for_msr(MSR_GS_BASE);
     }
diff -r e9986e48ebe1 -r 8cf85d3f4f5f xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h Mon Apr 02 16:51:52 2007 +0100
+++ b/xen/include/asm-x86/hvm/support.h Mon Apr 02 16:59:00 2007 +0100
@@ -215,7 +215,6 @@ int hvm_load(struct domain *d, hvm_domai
 /* End of save/restore */
 
 extern char hvm_io_bitmap[];
-extern char hvm_msr_bitmap[];
 extern int hvm_enabled;
 
 void hvm_enable(struct hvm_function_table *);
diff -r e9986e48ebe1 -r 8cf85d3f4f5f xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h        Mon Apr 02 16:51:52 2007 +0100
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h        Mon Apr 02 16:59:00 2007 +0100
@@ -121,6 +121,7 @@ extern u32 vmx_vmentry_control;
 
 #define cpu_has_vmx_msr_bitmap \
     (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
+extern char *vmx_msr_bitmap;
 
 /* VMCS Encordings */
 enum vmcs_field {

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