Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8e5393a authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar
Browse files

x86: page.h: make pte_t a union to always include



Make sure pte_t, whatever its definition, has a pte element with type
pteval_t.  This allows common code to access it without needing to be
specifically parameterised on what pagetable mode we're compiling for.
For 32-bit, this means that pte_t becomes a union with "pte" and "{
pte_low, pte_high }" (PAE) or just "pte_low" (non-PAE).

Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent b7fff536
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -244,9 +244,7 @@ pte_t xen_make_pte(unsigned long long pte)
	if (pte & 1)
		pte = phys_to_machine(XPADDR(pte)).maddr;

	pte &= ~_PAGE_PCD;

	return (pte_t){ pte, pte >> 32 };
	return (pte_t){ .pte = pte };
}

pmd_t xen_make_pmd(unsigned long long pmd)
+10 −0
Original line number Diff line number Diff line
@@ -108,6 +108,16 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
#include <asm-generic/pgtable-nopmd.h>
#endif	/* PAGETABLE_LEVELS >= 3 */

static inline pte_t native_make_pte(pteval_t val)
{
	return (pte_t) { .pte = val };
}

static inline pteval_t native_pte_val(pte_t pte)
{
	return pte.pte;
}

#define pgprot_val(x)	((x).pgprot)
#define __pgprot(x)	((pgprot_t) { (x) } )

+7 −23
Original line number Diff line number Diff line
@@ -26,18 +26,12 @@ typedef u64 pgdval_t;
typedef u64	pgprotval_t;
typedef u64	phys_addr_t;

typedef struct { unsigned long pte_low, pte_high; } pte_t;

static inline unsigned long long native_pte_val(pte_t pte)
{
	return pte.pte_low | ((unsigned long long)pte.pte_high << 32);
}

static inline pte_t native_make_pte(unsigned long long val)
{
	return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ;
}

typedef union {
	struct {
		unsigned long pte_low, pte_high;
	};
	pteval_t pte;
} pte_t;
#endif	/* __ASSEMBLY__
 */
#else  /* !CONFIG_X86_PAE */
@@ -53,19 +47,9 @@ typedef unsigned long pgdval_t;
typedef unsigned long	pgprotval_t;
typedef unsigned long	phys_addr_t;

typedef struct { pteval_t pte_low; } pte_t;
typedef union { pteval_t pte, pte_low; } pte_t;
typedef pte_t boot_pte_t;

static inline unsigned long native_pte_val(pte_t pte)
{
	return pte.pte_low;
}

static inline pte_t native_make_pte(unsigned long val)
{
	return (pte_t) { .pte_low = val };
}

#endif	/* __ASSEMBLY__ */
#endif	/* CONFIG_X86_PAE */

+0 −3
Original line number Diff line number Diff line
@@ -70,9 +70,6 @@ typedef unsigned long phys_addr_t;

typedef struct { pteval_t pte; } pte_t;

#define native_pte_val(x)	((x).pte)
#define native_make_pte(x) ((pte_t) { (x) } )

#define vmemmap ((struct page *)VMEMMAP_START)

#endif	/* !__ASSEMBLY__ */
+1 −1
Original line number Diff line number Diff line
@@ -922,7 +922,7 @@ static inline pte_t __pte(unsigned long long val)
	unsigned long long ret = PVOP_CALL2(unsigned long long,
					    pv_mmu_ops.make_pte,
					    val, val >> 32);
	return (pte_t) { ret, ret >> 32 };
	return (pte_t) { .pte = ret };
}

static inline pmd_t __pmd(unsigned long long val)
Loading