ia64/xen-unstable

changeset 15211:6a4af9502b4d

linux/x86: consolidate pte_val/p[mug]d_val replacements

- replace incomplete pXX_val_ma() set with complete __pXX_val() set
- use __pXX_val() instead of pXX_val() when only flags are accessed or
the frame number is only compared against zero

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Thu May 24 15:13:13 2007 +0100 (2007-05-24)
parents 1fde9ebb8019
children 3ef4a4d82130
files linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Thu May 24 15:12:31 2007 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Thu May 24 15:13:13 2007 +0100
     1.3 @@ -43,22 +43,11 @@
     1.4  #include <linux/percpu.h>
     1.5  #include <asm/tlbflush.h>
     1.6  
     1.7 -#ifdef CONFIG_X86_64
     1.8 -#define pmd_val_ma(v) (v).pmd
     1.9 -#else
    1.10 -#ifdef CONFIG_X86_PAE
    1.11 -# define pmd_val_ma(v) ((v).pmd)
    1.12 -# define pud_val_ma(v) ((v).pgd.pgd)
    1.13 -#else
    1.14 -# define pmd_val_ma(v) ((v).pud.pgd.pgd)
    1.15 -#endif
    1.16 -#endif
    1.17 -
    1.18  void xen_l1_entry_update(pte_t *ptr, pte_t val)
    1.19  {
    1.20  	mmu_update_t u;
    1.21  	u.ptr = virt_to_machine(ptr);
    1.22 -	u.val = pte_val_ma(val);
    1.23 +	u.val = __pte_val(val);
    1.24  	BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    1.25  }
    1.26  
    1.27 @@ -66,34 +55,26 @@ void xen_l2_entry_update(pmd_t *ptr, pmd
    1.28  {
    1.29  	mmu_update_t u;
    1.30  	u.ptr = virt_to_machine(ptr);
    1.31 -	u.val = pmd_val_ma(val);
    1.32 +	u.val = __pmd_val(val);
    1.33  	BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    1.34  }
    1.35  
    1.36 -#ifdef CONFIG_X86_PAE
    1.37 +#if defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
    1.38  void xen_l3_entry_update(pud_t *ptr, pud_t val)
    1.39  {
    1.40  	mmu_update_t u;
    1.41  	u.ptr = virt_to_machine(ptr);
    1.42 -	u.val = pud_val_ma(val);
    1.43 +	u.val = __pud_val(val);
    1.44  	BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    1.45  }
    1.46  #endif
    1.47  
    1.48  #ifdef CONFIG_X86_64
    1.49 -void xen_l3_entry_update(pud_t *ptr, pud_t val)
    1.50 -{
    1.51 -	mmu_update_t u;
    1.52 -	u.ptr = virt_to_machine(ptr);
    1.53 -	u.val = val.pud;
    1.54 -	BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    1.55 -}
    1.56 -
    1.57  void xen_l4_entry_update(pgd_t *ptr, pgd_t val)
    1.58  {
    1.59  	mmu_update_t u;
    1.60  	u.ptr = virt_to_machine(ptr);
    1.61 -	u.val = val.pgd;
    1.62 +	u.val = __pgd_val(val);
    1.63  	BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    1.64  }
    1.65  #endif /* CONFIG_X86_64 */
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c	Thu May 24 15:12:31 2007 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c	Thu May 24 15:13:13 2007 +0100
     2.3 @@ -76,7 +76,7 @@ static int __direct_remap_pfn_range(stru
     2.4  		 * Fill in the machine address: PTE ptr is done later by
     2.5  		 * __direct_remap_area_pages(). 
     2.6  		 */
     2.7 -		v->val = pte_val_ma(pfn_pte_ma(mfn, prot));
     2.8 +		v->val = __pte_val(pfn_pte_ma(mfn, prot));
     2.9  
    2.10  		mfn++;
    2.11  		address += PAGE_SIZE; 
     3.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h	Thu May 24 15:12:31 2007 +0100
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h	Thu May 24 15:13:13 2007 +0100
     3.3 @@ -89,19 +89,20 @@ typedef struct { unsigned long long pgpr
     3.4      (pgd_t) {((_x) & _PAGE_PRESENT) ? pte_phys_to_machine(_x) : (_x)}; })
     3.5  #define __pmd(x) ({ unsigned long long _x = (x); \
     3.6      (pmd_t) {((_x) & _PAGE_PRESENT) ? pte_phys_to_machine(_x) : (_x)}; })
     3.7 -static inline unsigned long long pte_val_ma(pte_t x)
     3.8 +static inline unsigned long long __pte_val(pte_t x)
     3.9  {
    3.10  	return ((unsigned long long)x.pte_high << 32) | x.pte_low;
    3.11  }
    3.12  static inline unsigned long long pte_val(pte_t x)
    3.13  {
    3.14 -	unsigned long long ret = pte_val_ma(x);
    3.15 +	unsigned long long ret = __pte_val(x);
    3.16  	if (x.pte_low & _PAGE_PRESENT) ret = pte_machine_to_phys(ret);
    3.17  	return ret;
    3.18  }
    3.19 +#define __pmd_val(x) ((x).pmd)
    3.20  static inline unsigned long long pmd_val(pmd_t x)
    3.21  {
    3.22 -	unsigned long long ret = x.pmd;
    3.23 +	unsigned long long ret = __pmd_val(x);
    3.24  #if CONFIG_XEN_COMPAT <= 0x030002
    3.25  	if (ret) ret = pte_machine_to_phys(ret) | _PAGE_PRESENT;
    3.26  #else
    3.27 @@ -109,9 +110,11 @@ static inline unsigned long long pmd_val
    3.28  #endif
    3.29  	return ret;
    3.30  }
    3.31 +#define __pud_val(x) __pgd_val((x).pgd)
    3.32 +#define __pgd_val(x) ((x).pgd)
    3.33  static inline unsigned long long pgd_val(pgd_t x)
    3.34  {
    3.35 -	unsigned long long ret = x.pgd;
    3.36 +	unsigned long long ret = __pgd_val(x);
    3.37  	if (ret & _PAGE_PRESENT) ret = pte_machine_to_phys(ret);
    3.38  	return ret;
    3.39  }
    3.40 @@ -123,17 +126,20 @@ typedef struct { unsigned long pgprot; }
    3.41  #define pgprot_val(x)	((x).pgprot)
    3.42  #include <asm/maddr.h>
    3.43  #define boot_pte_t pte_t /* or would you rather have a typedef */
    3.44 -#define pte_val(x)	(((x).pte_low & _PAGE_PRESENT) ? \
    3.45 -			 machine_to_phys((x).pte_low) : \
    3.46 -			 (x).pte_low)
    3.47 -#define pte_val_ma(x)	((x).pte_low)
    3.48 +#define __pte_val(x) ((x).pte_low)
    3.49 +#define pte_val(x) (__pte_val(x) & _PAGE_PRESENT ? \
    3.50 +                    machine_to_phys(__pte_val(x)) : \
    3.51 +                    __pte_val(x))
    3.52  #define __pte(x) ({ unsigned long _x = (x); \
    3.53      (pte_t) {((_x) & _PAGE_PRESENT) ? phys_to_machine(_x) : (_x)}; })
    3.54 +#define __pmd_val(x) __pud_val((x).pud)
    3.55 +#define __pud_val(x) __pgd_val((x).pgd)
    3.56  #define __pgd(x) ({ unsigned long _x = (x); \
    3.57      (pgd_t) {((_x) & _PAGE_PRESENT) ? phys_to_machine(_x) : (_x)}; })
    3.58 +#define __pgd_val(x) ((x).pgd)
    3.59  static inline unsigned long pgd_val(pgd_t x)
    3.60  {
    3.61 -	unsigned long ret = x.pgd;
    3.62 +	unsigned long ret = __pgd_val(x);
    3.63  #if CONFIG_XEN_COMPAT <= 0x030002
    3.64  	if (ret) ret = machine_to_phys(ret) | _PAGE_PRESENT;
    3.65  #else
     4.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h	Thu May 24 15:12:31 2007 +0100
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h	Thu May 24 15:13:13 2007 +0100
     4.3 @@ -4,9 +4,11 @@
     4.4  #include <asm-generic/pgtable-nopmd.h>
     4.5  
     4.6  #define pte_ERROR(e) \
     4.7 -	printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
     4.8 +	printk("%s:%d: bad pte %08lx (pfn %05lx).\n", __FILE__, __LINE__, \
     4.9 +	       __pte_val(e), pte_pfn(e))
    4.10  #define pgd_ERROR(e) \
    4.11 -	printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
    4.12 +	printk("%s:%d: bad pgd %08lx (pfn %05lx).\n", __FILE__, __LINE__, \
    4.13 +	       __pgd_val(e), pgd_val(e) >> PAGE_SHIFT)
    4.14  
    4.15  /*
    4.16   * Certain architectures need to do special things when PTEs
     5.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h	Thu May 24 15:12:31 2007 +0100
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level.h	Thu May 24 15:13:13 2007 +0100
     5.3 @@ -11,11 +11,14 @@
     5.4   */
     5.5  
     5.6  #define pte_ERROR(e) \
     5.7 -	printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, &(e), (e).pte_high, (e).pte_low)
     5.8 +	printk("%s:%d: bad pte %p(%016Lx pfn %08lx).\n", __FILE__, __LINE__, \
     5.9 +	       &(e), __pte_val(e), pte_pfn(e))
    5.10  #define pmd_ERROR(e) \
    5.11 -	printk("%s:%d: bad pmd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pmd_val(e))
    5.12 +	printk("%s:%d: bad pmd %p(%016Lx pfn %08Lx).\n", __FILE__, __LINE__, \
    5.13 +	       &(e), __pmd_val(e), (pmd_val(e) & PTE_MASK) >> PAGE_SHIFT)
    5.14  #define pgd_ERROR(e) \
    5.15 -	printk("%s:%d: bad pgd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
    5.16 +	printk("%s:%d: bad pgd %p(%016Lx pfn %08Lx).\n", __FILE__, __LINE__, \
    5.17 +	       &(e), __pgd_val(e), (pgd_val(e) & PTE_MASK) >> PAGE_SHIFT)
    5.18  
    5.19  #define pud_none(pud)				0
    5.20  #define pud_bad(pud)				0
    5.21 @@ -26,7 +29,7 @@
    5.22   */
    5.23  static inline int pte_x(pte_t pte)
    5.24  {
    5.25 -	return !(pte_val(pte) & _PAGE_NX);
    5.26 +	return !(__pte_val(pte) & _PAGE_NX);
    5.27  }
    5.28  
    5.29  /*
    5.30 @@ -59,7 +62,7 @@ static inline void set_pte(pte_t *ptep, 
    5.31  	ptep->pte_low = pte.pte_low;
    5.32  }
    5.33  #define set_pte_atomic(pteptr,pteval) \
    5.34 -		set_64bit((unsigned long long *)(pteptr),pte_val_ma(pteval))
    5.35 +		set_64bit((unsigned long long *)(pteptr),__pte_val(pteval))
    5.36  
    5.37  #define set_pte_at(_mm,addr,ptep,pteval) do {				\
    5.38  	if (((_mm) != current->mm && (_mm) != &init_mm) ||		\
    5.39 @@ -126,7 +129,7 @@ static inline pte_t ptep_get_and_clear(s
    5.40  	pte_t pte = *ptep;
    5.41  	if (!pte_none(pte)) {
    5.42  		if (mm != &init_mm) {
    5.43 -			uint64_t val = pte_val_ma(pte);
    5.44 +			uint64_t val = __pte_val(pte);
    5.45  			if (__cmpxchg64(ptep, val, 0) != val) {
    5.46  				/* xchg acts as a barrier before the setting of the high bits */
    5.47  				pte.pte_low = xchg(&ptep->pte_low, 0);
     6.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h	Thu May 24 15:12:31 2007 +0100
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h	Thu May 24 15:13:13 2007 +0100
     6.3 @@ -209,15 +209,16 @@ extern unsigned long pg0[];
     6.4  #define pte_present(x)	((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
     6.5  
     6.6  /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
     6.7 -#define pmd_none(x)	(!(unsigned long)pmd_val(x))
     6.8 +#define pmd_none(x)	(!(unsigned long)__pmd_val(x))
     6.9  #if CONFIG_XEN_COMPAT <= 0x030002
    6.10  /* pmd_present doesn't just test the _PAGE_PRESENT bit since wr.p.t.
    6.11     can temporarily clear it. */
    6.12 -#define pmd_present(x)	(pmd_val(x))
    6.13 +#define pmd_present(x)	(__pmd_val(x))
    6.14 +#define pmd_bad(x)	((__pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER & ~_PAGE_PRESENT)) != (_KERNPG_TABLE & ~_PAGE_PRESENT))
    6.15  #else
    6.16 -#define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)
    6.17 +#define pmd_present(x)	(__pmd_val(x) & _PAGE_PRESENT)
    6.18 +#define pmd_bad(x)	((__pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
    6.19  #endif
    6.20 -#define pmd_bad(x)	((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER & ~_PAGE_PRESENT)) != (_KERNPG_TABLE & ~_PAGE_PRESENT))
    6.21  
    6.22  
    6.23  #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
    6.24 @@ -346,7 +347,7 @@ static inline pte_t pte_modify(pte_t pte
    6.25  }
    6.26  
    6.27  #define pmd_large(pmd) \
    6.28 -((pmd_val(pmd) & (_PAGE_PSE|_PAGE_PRESENT)) == (_PAGE_PSE|_PAGE_PRESENT))
    6.29 +((__pmd_val(pmd) & (_PAGE_PSE|_PAGE_PRESENT)) == (_PAGE_PSE|_PAGE_PRESENT))
    6.30  
    6.31  /*
    6.32   * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
     7.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h	Thu May 24 15:12:31 2007 +0100
     7.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h	Thu May 24 15:13:13 2007 +0100
     7.3 @@ -96,14 +96,15 @@ typedef struct { unsigned long pgd; } pg
     7.4  
     7.5  typedef struct { unsigned long pgprot; } pgprot_t;
     7.6  
     7.7 -#define pte_val(x)	(((x).pte & _PAGE_PRESENT) ? \
     7.8 -			 pte_machine_to_phys((x).pte) : \
     7.9 -			 (x).pte)
    7.10 -#define pte_val_ma(x)	((x).pte)
    7.11 +#define __pte_val(x) ((x).pte)
    7.12 +#define pte_val(x) ((__pte_val(x) & _PAGE_PRESENT) ? \
    7.13 +                    pte_machine_to_phys(__pte_val(x)) : \
    7.14 +                    __pte_val(x))
    7.15  
    7.16 +#define __pmd_val(x) ((x).pmd)
    7.17  static inline unsigned long pmd_val(pmd_t x)
    7.18  {
    7.19 -	unsigned long ret = x.pmd;
    7.20 +	unsigned long ret = __pmd_val(x);
    7.21  #if CONFIG_XEN_COMPAT <= 0x030002
    7.22  	if (ret) ret = pte_machine_to_phys(ret) | _PAGE_PRESENT;
    7.23  #else
    7.24 @@ -112,16 +113,18 @@ static inline unsigned long pmd_val(pmd_
    7.25  	return ret;
    7.26  }
    7.27  
    7.28 +#define __pud_val(x) ((x).pud)
    7.29  static inline unsigned long pud_val(pud_t x)
    7.30  {
    7.31 -	unsigned long ret = x.pud;
    7.32 +	unsigned long ret = __pud_val(x);
    7.33  	if (ret & _PAGE_PRESENT) ret = pte_machine_to_phys(ret);
    7.34  	return ret;
    7.35  }
    7.36  
    7.37 +#define __pgd_val(x) ((x).pgd)
    7.38  static inline unsigned long pgd_val(pgd_t x)
    7.39  {
    7.40 -	unsigned long ret = x.pgd;
    7.41 +	unsigned long ret = __pgd_val(x);
    7.42  	if (ret & _PAGE_PRESENT) ret = pte_machine_to_phys(ret);
    7.43  	return ret;
    7.44  }
     8.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h	Thu May 24 15:12:31 2007 +0100
     8.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h	Thu May 24 15:13:13 2007 +0100
     8.3 @@ -82,16 +82,20 @@ extern unsigned long empty_zero_page[PAG
     8.4  #define PTRS_PER_PTE	512
     8.5  
     8.6  #define pte_ERROR(e) \
     8.7 -	printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), pte_val(e))
     8.8 +	printk("%s:%d: bad pte %p(%016lx pfn %010lx).\n", __FILE__, __LINE__, \
     8.9 +	       &(e), __pte_val(e), pte_pfn(e))
    8.10  #define pmd_ERROR(e) \
    8.11 -	printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), pmd_val(e))
    8.12 +	printk("%s:%d: bad pmd %p(%016lx pfn %010lx).\n", __FILE__, __LINE__, \
    8.13 +	       &(e), __pmd_val(e), pmd_pfn(e))
    8.14  #define pud_ERROR(e) \
    8.15 -	printk("%s:%d: bad pud %p(%016lx).\n", __FILE__, __LINE__, &(e), pud_val(e))
    8.16 +	printk("%s:%d: bad pud %p(%016lx pfn %010lx).\n", __FILE__, __LINE__, \
    8.17 +	       &(e), __pud_val(e), (pud_val(e) & __PHYSICAL_MASK) >> PAGE_SHIFT)
    8.18  #define pgd_ERROR(e) \
    8.19 -	printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
    8.20 +	printk("%s:%d: bad pgd %p(%016lx pfn %010lx).\n", __FILE__, __LINE__, \
    8.21 +	       &(e), __pgd_val(e), (pgd_val(e) & __PHYSICAL_MASK) >> PAGE_SHIFT)
    8.22  
    8.23 -#define pgd_none(x)	(!pgd_val(x))
    8.24 -#define pud_none(x)	(!pud_val(x))
    8.25 +#define pgd_none(x)	(!__pgd_val(x))
    8.26 +#define pud_none(x)	(!__pud_val(x))
    8.27  
    8.28  static inline void set_pte(pte_t *dst, pte_t val)
    8.29  {
    8.30 @@ -236,7 +240,7 @@ extern unsigned int __kernel_page_user;
    8.31  
    8.32  static inline unsigned long pgd_bad(pgd_t pgd)
    8.33  {
    8.34 -       unsigned long val = pgd_val(pgd);
    8.35 +       unsigned long val = __pgd_val(pgd);
    8.36         val &= ~PTE_MASK;
    8.37         val &= ~(_PAGE_USER | _PAGE_DIRTY);
    8.38         return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED);
    8.39 @@ -244,7 +248,7 @@ static inline unsigned long pgd_bad(pgd_
    8.40  
    8.41  static inline unsigned long pud_bad(pud_t pud) 
    8.42  { 
    8.43 -       unsigned long val = pud_val(pud);
    8.44 +       unsigned long val = __pud_val(pud);
    8.45         val &= ~PTE_MASK; 
    8.46         val &= ~(_PAGE_USER | _PAGE_DIRTY); 
    8.47         return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED);      
    8.48 @@ -322,8 +326,6 @@ static inline pte_t ptep_get_and_clear_f
    8.49   * The following only work if pte_present() is true.
    8.50   * Undefined behaviour if not..
    8.51   */
    8.52 -#define __pte_val(x)	((x).pte)
    8.53 -
    8.54  #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
    8.55  static inline int pte_user(pte_t pte)		{ return __pte_val(pte) & _PAGE_USER; }
    8.56  static inline int pte_read(pte_t pte)		{ return __pte_val(pte) & _PAGE_USER; }
    8.57 @@ -377,7 +379,7 @@ static inline void ptep_set_wrprotect(st
    8.58  #define pgprot_noncached(prot)	(__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT))
    8.59  
    8.60  static inline int pmd_large(pmd_t pte) { 
    8.61 -	return (pmd_val(pte) & __LARGE_PTE) == __LARGE_PTE; 
    8.62 +	return (__pmd_val(pte) & __LARGE_PTE) == __LARGE_PTE;
    8.63  } 	
    8.64  
    8.65  
    8.66 @@ -394,14 +396,14 @@ static inline int pmd_large(pmd_t pte) {
    8.67  #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
    8.68  #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
    8.69  #define pgd_offset_k(address) (pgd_t *)(init_level4_pgt + pgd_index(address))
    8.70 -#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT)
    8.71 +#define pgd_present(pgd) (__pgd_val(pgd) & _PAGE_PRESENT)
    8.72  #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
    8.73  
    8.74  /* PUD - Level3 access */
    8.75  /* to find an entry in a page-table-directory. */
    8.76  #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
    8.77  #define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address))
    8.78 -#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT)
    8.79 +#define pud_present(pud) (__pud_val(pud) & _PAGE_PRESENT)
    8.80  
    8.81  /* PMD  - Level 2 access */
    8.82  #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))
    8.83 @@ -410,21 +412,21 @@ static inline int pmd_large(pmd_t pte) {
    8.84  #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
    8.85  #define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \
    8.86                                    pmd_index(address))
    8.87 -#define pmd_none(x)	(!pmd_val(x))
    8.88 +#define pmd_none(x)	(!__pmd_val(x))
    8.89  #if CONFIG_XEN_COMPAT <= 0x030002
    8.90  /* pmd_present doesn't just test the _PAGE_PRESENT bit since wr.p.t.
    8.91     can temporarily clear it. */
    8.92 -#define pmd_present(x)	(pmd_val(x))
    8.93 +#define pmd_present(x)	(__pmd_val(x))
    8.94  #else
    8.95 -#define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)
    8.96 +#define pmd_present(x)	(__pmd_val(x) & _PAGE_PRESENT)
    8.97  #endif
    8.98  #define pmd_clear(xp)	do { set_pmd(xp, __pmd(0)); } while (0)
    8.99 -#define pmd_bad(x) ((pmd_val(x) & ~(PTE_MASK | _PAGE_USER | _PAGE_PRESENT)) \
   8.100 +#define pmd_bad(x) ((__pmd_val(x) & ~(PTE_MASK | _PAGE_USER | _PAGE_PRESENT)) \
   8.101  		    != (_KERNPG_TABLE & ~(_PAGE_USER | _PAGE_PRESENT)))
   8.102  #define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot)))
   8.103  #define pmd_pfn(x)  ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT)
   8.104  
   8.105 -#define pte_to_pgoff(pte) ((pte_val(pte) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
   8.106 +#define pte_to_pgoff(pte) ((__pte_val(pte) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
   8.107  #define pgoff_to_pte(off) ((pte_t) { ((off) << PAGE_SHIFT) | _PAGE_FILE })
   8.108  #define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT
   8.109  
   8.110 @@ -432,7 +434,7 @@ static inline int pmd_large(pmd_t pte) {
   8.111  
   8.112  /* page, protection -> pte */
   8.113  #define mk_pte(page, pgprot)	pfn_pte(page_to_pfn(page), (pgprot))
   8.114 -#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE)
   8.115 +#define mk_pte_huge(entry) (__pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE)
   8.116   
   8.117  /* physical address -> PTE */
   8.118  static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)