direct-io.hg

changeset 14696:8cf85d3f4f5f

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@xensource.com>
author kfraser@localhost.localdomain
date Mon Apr 02 16:59:00 2007 +0100 (2007-04-02)
parents e9986e48ebe1
children 870133a06f43
files xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/support.h xen/include/asm-x86/hvm/vmx/vmcs.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Mon Apr 02 16:51:52 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Mon Apr 02 16:59:00 2007 +0100
     1.3 @@ -59,9 +59,6 @@ struct hvm_function_table hvm_funcs __re
     1.4  /* I/O permission bitmap is globally shared by all HVM guests. */
     1.5  char __attribute__ ((__section__ (".bss.page_aligned")))
     1.6      hvm_io_bitmap[3*PAGE_SIZE];
     1.7 -/* MSR permission bitmap is globally shared by all HVM guests. */
     1.8 -char __attribute__ ((__section__ (".bss.page_aligned")))
     1.9 -    hvm_msr_bitmap[PAGE_SIZE];
    1.10  
    1.11  void hvm_enable(struct hvm_function_table *fns)
    1.12  {
    1.13 @@ -75,9 +72,6 @@ void hvm_enable(struct hvm_function_tabl
    1.14      memset(hvm_io_bitmap, ~0, sizeof(hvm_io_bitmap));
    1.15      clear_bit(0x80, hvm_io_bitmap);
    1.16  
    1.17 -    /* All MSR accesses are intercepted by default. */
    1.18 -    memset(hvm_msr_bitmap, ~0, sizeof(hvm_msr_bitmap));
    1.19 -
    1.20      hvm_funcs   = *fns;
    1.21      hvm_enabled = 1;
    1.22  }
     2.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Mon Apr 02 16:51:52 2007 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Mon Apr 02 16:59:00 2007 +0100
     2.3 @@ -289,7 +289,7 @@ static void construct_vmcs(struct vcpu *
     2.4      v->arch.hvm_vcpu.u.vmx.exec_control = vmx_cpu_based_exec_control;
     2.5  
     2.6      if ( cpu_has_vmx_msr_bitmap )
     2.7 -        __vmwrite(MSR_BITMAP, virt_to_maddr(hvm_msr_bitmap));
     2.8 +        __vmwrite(MSR_BITMAP, virt_to_maddr(vmx_msr_bitmap));
     2.9  
    2.10      /* I/O access bitmap. */
    2.11      __vmwrite(IO_BITMAP_A, virt_to_maddr(hvm_io_bitmap));
     3.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Apr 02 16:51:52 2007 +0100
     3.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Apr 02 16:59:00 2007 +0100
     3.3 @@ -51,6 +51,8 @@
     3.4  #include <public/hvm/save.h>
     3.5  #include <asm/hvm/trace.h>
     3.6  
     3.7 +char *vmx_msr_bitmap;
     3.8 +
     3.9  static void vmx_ctxt_switch_from(struct vcpu *v);
    3.10  static void vmx_ctxt_switch_to(struct vcpu *v);
    3.11  
    3.12 @@ -1005,14 +1007,14 @@ static void disable_intercept_for_msr(u3
    3.13       */
    3.14      if ( msr <= 0x1fff )
    3.15      {
    3.16 -        __clear_bit(msr, hvm_msr_bitmap + 0x000); /* read-low */
    3.17 -        __clear_bit(msr, hvm_msr_bitmap + 0x800); /* write-low */
    3.18 +        __clear_bit(msr, vmx_msr_bitmap + 0x000); /* read-low */
    3.19 +        __clear_bit(msr, vmx_msr_bitmap + 0x800); /* write-low */
    3.20      }
    3.21      else if ( (msr >= 0xc0000000) && (msr <= 0xc0001fff) )
    3.22      {
    3.23          msr &= 0x1fff;
    3.24 -        __clear_bit(msr, hvm_msr_bitmap + 0x400); /* read-high */
    3.25 -        __clear_bit(msr, hvm_msr_bitmap + 0xc00); /* write-high */
    3.26 +        __clear_bit(msr, vmx_msr_bitmap + 0x400); /* read-high */
    3.27 +        __clear_bit(msr, vmx_msr_bitmap + 0xc00); /* write-high */
    3.28      }
    3.29  }
    3.30  
    3.31 @@ -1105,6 +1107,9 @@ int start_vmx(void)
    3.32      if ( cpu_has_vmx_msr_bitmap )
    3.33      {
    3.34          printk("VMX: MSR intercept bitmap enabled\n");
    3.35 +        vmx_msr_bitmap = alloc_xenheap_page();
    3.36 +        BUG_ON(vmx_msr_bitmap == NULL);
    3.37 +        memset(vmx_msr_bitmap, ~0, PAGE_SIZE);
    3.38          disable_intercept_for_msr(MSR_FS_BASE);
    3.39          disable_intercept_for_msr(MSR_GS_BASE);
    3.40      }
     4.1 --- a/xen/include/asm-x86/hvm/support.h	Mon Apr 02 16:51:52 2007 +0100
     4.2 +++ b/xen/include/asm-x86/hvm/support.h	Mon Apr 02 16:59:00 2007 +0100
     4.3 @@ -215,7 +215,6 @@ int hvm_load(struct domain *d, hvm_domai
     4.4  /* End of save/restore */
     4.5  
     4.6  extern char hvm_io_bitmap[];
     4.7 -extern char hvm_msr_bitmap[];
     4.8  extern int hvm_enabled;
     4.9  
    4.10  void hvm_enable(struct hvm_function_table *);
     5.1 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h	Mon Apr 02 16:51:52 2007 +0100
     5.2 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h	Mon Apr 02 16:59:00 2007 +0100
     5.3 @@ -121,6 +121,7 @@ extern u32 vmx_vmentry_control;
     5.4  
     5.5  #define cpu_has_vmx_msr_bitmap \
     5.6      (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
     5.7 +extern char *vmx_msr_bitmap;
     5.8  
     5.9  /* VMCS Encordings */
    5.10  enum vmcs_field {