ia64/xen-unstable

changeset 8753:ad0c3fa46c76

Fix up the new non-paging direct_map shadow pagetable mode
for SVM. Rename a vmx_ function in HVM-generic code to
hvm_.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Feb 03 12:47:38 2006 +0100 (2006-02-03)
parents 0e7bdd973e17
children a3f4357a9e16
files xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Fri Feb 03 12:02:30 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Fri Feb 03 12:47:38 2006 +0100
     1.3 @@ -53,7 +53,7 @@ integer_param("hvm_debug", opt_hvm_debug
     1.4  
     1.5  struct hvm_function_table hvm_funcs;
     1.6  
     1.7 -static void vmx_zap_mmio_range(
     1.8 +static void hvm_zap_mmio_range(
     1.9      struct domain *d, unsigned long pfn, unsigned long nr_pfn)
    1.10  {
    1.11      unsigned long i, val = INVALID_MFN;
    1.12 @@ -95,12 +95,10 @@ static void hvm_map_io_shared_page(struc
    1.13  
    1.14      for ( i = 0; i < e820_map_nr; i++ )
    1.15      {
    1.16 -        if (e820entry[i].type == E820_SHARED_PAGE)
    1.17 -        {
    1.18 +        if ( e820entry[i].type == E820_SHARED_PAGE )
    1.19              gpfn = (e820entry[i].addr >> PAGE_SHIFT);
    1.20 -        }
    1.21          if ( e820entry[i].type == E820_IO )
    1.22 -            vmx_zap_mmio_range(
    1.23 +            hvm_zap_mmio_range(
    1.24                  d, 
    1.25                  e820entry[i].addr >> PAGE_SHIFT,
    1.26                  e820entry[i].size >> PAGE_SHIFT);
     2.1 --- a/xen/arch/x86/hvm/svm/svm.c	Fri Feb 03 12:02:30 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Fri Feb 03 12:47:38 2006 +0100
     2.3 @@ -833,8 +833,11 @@ static int svm_do_page_fault(unsigned lo
     2.4              va, eip, (unsigned long)regs->error_code);
     2.5  //#endif
     2.6  
     2.7 -    if (!svm_paging_enabled(v)) 
     2.8 +    if ( !svm_paging_enabled(v) )
     2.9      {
    2.10 +        if ( shadow_direct_map_fault(va, regs) ) 
    2.11 +            return 1;
    2.12 +
    2.13          handle_mmio(va, va);
    2.14          TRACE_VMEXIT(2,2);
    2.15          return 1;
    2.16 @@ -1438,6 +1441,9 @@ static int svm_set_cr0(unsigned long val
    2.17                  put_page(mfn_to_page(old_base_mfn));
    2.18  	}
    2.19  #endif
    2.20 +#if CONFIG_PAGING_LEVELS == 2
    2.21 +        shadow_direct_map_clean(v);
    2.22 +#endif
    2.23          /* Now arch.guest_table points to machine physical. */
    2.24          v->arch.guest_table = mk_pagetable(mfn << PAGE_SHIFT);
    2.25          update_pagetables(v);
    2.26 @@ -2272,10 +2278,8 @@ void walk_shadow_and_guest_pt(unsigned l
    2.27  
    2.28      gpa = gva_to_gpa( gva );
    2.29      printk( "gva = %lx, gpa=%lx, gCR3=%x\n", gva, gpa, (u32)vmcb->cr3 );
    2.30 -    if( !svm_paging_enabled(v) || mmio_space( gpa ) )
    2.31 -    {
    2.32 +    if( !svm_paging_enabled(v) || mmio_space(gpa) )
    2.33         return;
    2.34 -    }
    2.35  
    2.36      /* let's dump the guest and shadow page info */
    2.37  
     3.1 --- a/xen/arch/x86/hvm/svm/vmcb.c	Fri Feb 03 12:02:30 2006 +0100
     3.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c	Fri Feb 03 12:47:38 2006 +0100
     3.3 @@ -417,9 +417,8 @@ void svm_do_launch(struct vcpu *v)
     3.4      /* current core is the one we will perform the vmrun on */
     3.5      v->arch.hvm_svm.core = core;
     3.6      clear_bit(ARCH_SVM_VMCB_ASSIGN_ASID, &v->arch.hvm_svm.flags);
     3.7 -    if(!asidpool_assign_next(vmcb, 0, core, core)) {
     3.8 +    if ( !asidpool_assign_next(vmcb, 0, core, core) )
     3.9          BUG();
    3.10 -    }
    3.11  
    3.12      if (v->vcpu_id == 0)
    3.13          hvm_setup_platform(v->domain);
    3.14 @@ -446,15 +445,13 @@ void svm_do_launch(struct vcpu *v)
    3.15          pt = pagetable_get_paddr(v->domain->arch.phys_table);
    3.16          printk("%s: phys_table   = %lx\n", __func__, pt);
    3.17      }
    3.18 -    
    3.19 -    if (svm_paging_enabled(v))
    3.20 -    {
    3.21 +
    3.22 +    shadow_direct_map_init(v);
    3.23 +
    3.24 +    if ( svm_paging_enabled(v) )
    3.25          vmcb->cr3 = pagetable_get_paddr(v->arch.guest_table);
    3.26 -    }
    3.27      else
    3.28 -    {
    3.29          vmcb->cr3 = pagetable_get_paddr(v->domain->arch.phys_table);
    3.30 -    }
    3.31  
    3.32      if (svm_dbg_on) 
    3.33      {