ia64/xen-unstable

changeset 17195:6225df3ff209

[IA64] Remove GPFN_INV_MASK

This slightly simplify code and frees a pte bit.

Signed-off-by: Tristan Gingold <tgingold@free.fr>
author Alex Williamson <alex.williamson@hp.com>
date Fri Mar 07 13:09:47 2008 -0700 (2008-03-07)
parents d5bcf03596cc
children 43a87df9a11e
files xen/arch/ia64/vmx/sioemu.c xen/arch/ia64/xen/mm.c xen/include/asm-ia64/linux-xen/asm/pgtable.h xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/sioemu.c	Fri Mar 07 12:44:26 2008 -0700
     1.2 +++ b/xen/arch/ia64/vmx/sioemu.c	Fri Mar 07 13:09:47 2008 -0700
     1.3 @@ -166,8 +166,7 @@ sioemu_add_io_physmap (struct domain *d,
     1.4  
     1.5      /* Check area is currently unassigned.  */
     1.6      for (i = start; i < start + size; i += PAGE_SIZE) {
     1.7 -        unsigned long mpa = ____lookup_domain_mpa(d, i);
     1.8 -        if (mpa != GPFN_INV_MASK && mpa != INVALID_MFN)
     1.9 +        if (____lookup_domain_mpa(d, i) != INVALID_MFN)
    1.10              return -EBUSY;
    1.11      }
    1.12  
     2.1 --- a/xen/arch/ia64/xen/mm.c	Fri Mar 07 12:44:26 2008 -0700
     2.2 +++ b/xen/arch/ia64/xen/mm.c	Fri Mar 07 13:09:47 2008 -0700
     2.3 @@ -726,8 +726,6 @@ unsigned long
     2.4  
     2.5      if (pte_present(*pte))
     2.6          return (pte->pte & _PFN_MASK);
     2.7 -    else if (VMX_DOMAIN(d->vcpu[0]))
     2.8 -        return GPFN_INV_MASK;
     2.9      return INVALID_MFN;
    2.10  }
    2.11  
    2.12 @@ -742,8 +740,8 @@ unsigned long lookup_domain_mpa(struct d
    2.13              if (entry != NULL)
    2.14                  p2m_entry_set(entry, pte, tmp_pte);
    2.15              return pte_val(tmp_pte);
    2.16 -        } else if (VMX_DOMAIN(d->vcpu[0]))
    2.17 -            return GPFN_INV_MASK;
    2.18 +        } else if (is_hvm_domain(d))
    2.19 +            return INVALID_MFN;
    2.20      }
    2.21  
    2.22      if (mpaddr < d->arch.convmem_end && !d->is_dying) {
    2.23 @@ -2797,7 +2795,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
    2.24          }
    2.25  
    2.26          /* This hypercall is used for VT-i domain only */
    2.27 -        if (!VMX_DOMAIN(d->vcpu[0])) {
    2.28 +        if (!is_hvm_domain(d)) {
    2.29              rcu_unlock_domain(d);
    2.30              return -ENOSYS;
    2.31          }
     3.1 --- a/xen/include/asm-ia64/linux-xen/asm/pgtable.h	Fri Mar 07 12:44:26 2008 -0700
     3.2 +++ b/xen/include/asm-ia64/linux-xen/asm/pgtable.h	Fri Mar 07 13:09:47 2008 -0700
     3.3 @@ -108,7 +108,6 @@
     3.4  #define GPFN_HIGH_MMIO		(7UL << 60)	/* High MMIO range */
     3.5  
     3.6  #define GPFN_IO_MASK		(7UL << 60)	/* Guest pfn is I/O type */
     3.7 -#define GPFN_INV_MASK		(1UL << 63)	/* Guest pfn is invalid */
     3.8  
     3.9  #else
    3.10  #define _PAGE_PROTNONE		(__IA64_UL(1) << 63)
    3.11 @@ -342,8 +341,7 @@ set_pte_rel(volatile pte_t* ptep, pte_t 
    3.12  #define pte_file(pte)		((pte_val(pte) & _PAGE_FILE) != 0)
    3.13  #ifdef XEN
    3.14  #define pte_pgc_allocated(pte)	((pte_val(pte) & _PAGE_PGC_ALLOCATED) != 0)
    3.15 -#define pte_mem(pte) \
    3.16 -	(!(pte_val(pte) & (GPFN_IO_MASK | GPFN_INV_MASK)) && !pte_none(pte))
    3.17 +#define pte_mem(pte)	(!(pte_val(pte) & GPFN_IO_MASK) && !pte_none(pte))
    3.18  #endif
    3.19  /*
    3.20   * Note: we convert AR_RWX to AR_RX and AR_RW to AR_R by clearing the 2nd bit in the
     4.1 --- a/xen/include/asm-ia64/mm.h	Fri Mar 07 12:44:26 2008 -0700
     4.2 +++ b/xen/include/asm-ia64/mm.h	Fri Mar 07 13:09:47 2008 -0700
     4.3 @@ -479,7 +479,7 @@ extern u64 translate_domain_pte(u64 ptev
     4.4      gmfn_to_mfn_foreign((_d), (gpfn))
     4.5  
     4.6  #define __gpfn_invalid(_d, gpfn)			\
     4.7 -	(lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT), NULL) & GPFN_INV_MASK)
     4.8 +	(lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT), NULL) == INVALID_MFN)
     4.9  
    4.10  #define __gmfn_valid(_d, gpfn)	!__gpfn_invalid(_d, gpfn)
    4.11  
    4.12 @@ -488,8 +488,7 @@ extern u64 translate_domain_pte(u64 ptev
    4.13  ({                                          \
    4.14      u64 pte, ret=0;                                \
    4.15      pte = lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT), NULL);	\
    4.16 -    if(!(pte&GPFN_INV_MASK))        \
    4.17 -        ret = pte & GPFN_IO_MASK;        \
    4.18 +    ret = (pte != INVALID_MFN) ? pte & GPFN_IO_MASK : 0;        \
    4.19      ret;                \
    4.20  })
    4.21  
    4.22 @@ -497,8 +496,7 @@ extern u64 translate_domain_pte(u64 ptev
    4.23  ({                                          \
    4.24      u64 pte, ret=0;                                \
    4.25      pte = lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT), NULL);		   \
    4.26 -    if((!(pte&GPFN_INV_MASK))&&((pte & GPFN_IO_MASK)==GPFN_MEM))   \
    4.27 -        ret = 1;             \
    4.28 +    ret = (pte != INVALID_MFN) && (pte & GPFN_IO_MASK) == GPFN_MEM;        \
    4.29      ret;                \
    4.30  })
    4.31