ia64/xen-unstable

changeset 12599:93e657836d07

[XEN] Remove VALID_MFN(); replace uses with mfn_valid().
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Nov 27 17:48:24 2006 +0000 (2006-11-27)
parents 445db3980f61
children 9d6bc06919e0
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/mm.c xen/include/asm-x86/mm.h xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Mon Nov 27 14:52:41 2006 +0000
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Mon Nov 27 17:48:24 2006 +0000
     1.3 @@ -1457,7 +1457,7 @@ static int svm_set_cr0(unsigned long val
     1.4      {
     1.5          /* The guest CR3 must be pointing to the guest physical. */
     1.6          mfn = get_mfn_from_gpfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT);
     1.7 -        if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain))
     1.8 +        if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain))
     1.9          {
    1.10              gdprintk(XENLOG_ERR, "Invalid CR3 value = %lx (mfn=%lx)\n", 
    1.11                       v->arch.hvm_svm.cpu_cr3, mfn);
    1.12 @@ -1642,7 +1642,7 @@ static int mov_to_cr(int gpreg, int cr, 
    1.13               */
    1.14              HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
    1.15              mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
    1.16 -            if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain))
    1.17 +            if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain))
    1.18                  goto bad_cr3;
    1.19  
    1.20              old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
    1.21 @@ -1672,7 +1672,7 @@ static int mov_to_cr(int gpreg, int cr, 
    1.22  #if CONFIG_PAGING_LEVELS >= 3
    1.23                  unsigned long mfn, old_base_mfn;
    1.24                  mfn = get_mfn_from_gpfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT);
    1.25 -                if ( !VALID_MFN(mfn) || 
    1.26 +                if ( !mfn_valid(mfn) || 
    1.27                       !get_page(mfn_to_page(mfn), v->domain) )
    1.28                      goto bad_cr3;
    1.29  
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Nov 27 14:52:41 2006 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Nov 27 17:48:24 2006 +0000
     2.3 @@ -1203,7 +1203,7 @@ static int vmx_world_restore(struct vcpu
     2.4           */
     2.5          HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 c->cr3 = %x", c->cr3);
     2.6          mfn = get_mfn_from_gpfn(c->cr3 >> PAGE_SHIFT);
     2.7 -        if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
     2.8 +        if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
     2.9              goto bad_cr3;
    2.10          old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
    2.11          v->arch.guest_table = pagetable_from_pfn(mfn);
    2.12 @@ -1389,7 +1389,7 @@ static int vmx_set_cr0(unsigned long val
    2.13           * The guest CR3 must be pointing to the guest physical.
    2.14           */
    2.15          mfn = get_mfn_from_gpfn(v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT);
    2.16 -        if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
    2.17 +        if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
    2.18          {
    2.19              gdprintk(XENLOG_ERR, "Invalid CR3 value = %lx (mfn=%lx)\n",
    2.20                       v->arch.hvm_vmx.cpu_cr3, mfn);
    2.21 @@ -1599,7 +1599,7 @@ static int mov_to_cr(int gp, int cr, str
    2.22               */
    2.23              HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
    2.24              mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
    2.25 -            if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
    2.26 +            if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
    2.27                  goto bad_cr3;
    2.28              old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
    2.29              v->arch.guest_table = pagetable_from_pfn(mfn);
    2.30 @@ -1627,7 +1627,7 @@ static int mov_to_cr(int gp, int cr, str
    2.31  #if CONFIG_PAGING_LEVELS >= 3
    2.32                  unsigned long mfn, old_base_mfn;
    2.33                  mfn = get_mfn_from_gpfn(v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT);
    2.34 -                if ( !VALID_MFN(mfn) ||
    2.35 +                if ( !mfn_valid(mfn) ||
    2.36                       !get_page(mfn_to_page(mfn), v->domain) )
    2.37                      goto bad_cr3;
    2.38  
     3.1 --- a/xen/arch/x86/mm.c	Mon Nov 27 14:52:41 2006 +0000
     3.2 +++ b/xen/arch/x86/mm.c	Mon Nov 27 17:48:24 2006 +0000
     3.3 @@ -431,7 +431,7 @@ int map_ldt_shadow_page(unsigned int off
     3.4  
     3.5      gmfn = l1e_get_pfn(l1e);
     3.6      mfn = gmfn_to_mfn(d, gmfn);
     3.7 -    if ( unlikely(!VALID_MFN(mfn)) )
     3.8 +    if ( unlikely(!mfn_valid(mfn)) )
     3.9          return 0;
    3.10  
    3.11      okay = get_page_and_type(mfn_to_page(mfn), d, PGT_ldt_page);
    3.12 @@ -2847,8 +2847,8 @@ long do_update_descriptor(u64 pa, u64 de
    3.13  
    3.14      LOCK_BIGLOCK(dom);
    3.15  
    3.16 -    if ( !VALID_MFN(mfn = gmfn_to_mfn(dom, gmfn)) ||
    3.17 -         (((unsigned int)pa % sizeof(struct desc_struct)) != 0) ||
    3.18 +    mfn = gmfn_to_mfn(dom, gmfn);
    3.19 +    if ( (((unsigned int)pa % sizeof(struct desc_struct)) != 0) ||
    3.20           !mfn_valid(mfn) ||
    3.21           !check_descriptor(&d) )
    3.22      {
     4.1 --- a/xen/include/asm-x86/mm.h	Mon Nov 27 14:52:41 2006 +0000
     4.2 +++ b/xen/include/asm-x86/mm.h	Mon Nov 27 17:48:24 2006 +0000
     4.3 @@ -269,8 +269,6 @@ int check_descriptor(struct desc_struct 
     4.4  #define gmfn_to_mfn(_d, gpfn)  mfn_x(sh_gfn_to_mfn(_d, gpfn))
     4.5  
     4.6  #define INVALID_MFN             (~0UL)
     4.7 -#define VALID_MFN(_mfn)         (!((_mfn) & (1U<<31)))
     4.8 -
     4.9  
    4.10  #ifdef MEMORY_GUARD
    4.11  void memguard_init(void);
     5.1 --- a/xen/include/asm-x86/shadow.h	Mon Nov 27 14:52:41 2006 +0000
     5.2 +++ b/xen/include/asm-x86/shadow.h	Mon Nov 27 17:48:24 2006 +0000
     5.3 @@ -218,7 +218,7 @@ TYPE_SAFE(unsigned long,mfn)
     5.4  static inline int
     5.5  valid_mfn(mfn_t m)
     5.6  {
     5.7 -    return VALID_MFN(mfn_x(m));
     5.8 +    return mfn_valid(mfn_x(m));
     5.9  }
    5.10  
    5.11  static inline mfn_t
    5.12 @@ -665,7 +665,7 @@ static inline int
    5.13  mmio_space(paddr_t gpa)
    5.14  {
    5.15      unsigned long gfn = gpa >> PAGE_SHIFT;    
    5.16 -    return !VALID_MFN(mfn_x(sh_gfn_to_mfn_current(gfn)));
    5.17 +    return !mfn_valid(mfn_x(sh_gfn_to_mfn_current(gfn)));
    5.18  }
    5.19  
    5.20  static inline l1_pgentry_t