x86: move pte types into pgtable*.h
pgtable*.h is intended for definitions relating to actual pagetables and their entries, so move all the definitions for (pte|pmd|pud|pgd)(val)?_t to the appropriate pgtable*.h headers. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
This commit is contained in:
parent
e2f5bda941
commit
54321d947a
|
@ -31,28 +31,6 @@ static inline void copy_user_page(void *to, void *from, unsigned long vaddr,
|
|||
alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
|
||||
#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
|
||||
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#include <asm/paravirt.h>
|
||||
#else /* !CONFIG_PARAVIRT */
|
||||
|
||||
#define pgd_val(x) native_pgd_val(x)
|
||||
#define __pgd(x) native_make_pgd(x)
|
||||
|
||||
#ifndef __PAGETABLE_PUD_FOLDED
|
||||
#define pud_val(x) native_pud_val(x)
|
||||
#define __pud(x) native_make_pud(x)
|
||||
#endif
|
||||
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
#define pmd_val(x) native_pmd_val(x)
|
||||
#define __pmd(x) native_make_pmd(x)
|
||||
#endif
|
||||
|
||||
#define pte_val(x) native_pte_val(x)
|
||||
#define __pte(x) native_make_pte(x)
|
||||
|
||||
#endif /* CONFIG_PARAVIRT */
|
||||
|
||||
#define __pa(x) __phys_addr((unsigned long)(x))
|
||||
#define __pa_nodebug(x) __phys_addr_nodebug((unsigned long)(x))
|
||||
/* __pa_symbol should be used for C visible symbols.
|
||||
|
|
|
@ -43,36 +43,6 @@
|
|||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifdef CONFIG_X86_PAE
|
||||
typedef u64 pteval_t;
|
||||
typedef u64 pmdval_t;
|
||||
typedef u64 pudval_t;
|
||||
typedef u64 pgdval_t;
|
||||
typedef u64 pgprotval_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
unsigned long pte_low, pte_high;
|
||||
};
|
||||
pteval_t pte;
|
||||
} pte_t;
|
||||
#else /* !CONFIG_X86_PAE */
|
||||
typedef unsigned long pteval_t;
|
||||
typedef unsigned long pmdval_t;
|
||||
typedef unsigned long pudval_t;
|
||||
typedef unsigned long pgdval_t;
|
||||
typedef unsigned long pgprotval_t;
|
||||
|
||||
typedef union {
|
||||
pteval_t pte;
|
||||
pteval_t pte_low;
|
||||
} pte_t;
|
||||
#endif /* CONFIG_X86_PAE */
|
||||
|
||||
extern int nx_enabled;
|
||||
|
||||
/*
|
||||
* This much address space is reserved for vmalloc() and iomap()
|
||||
* as well as fixmap mappings.
|
||||
|
|
|
@ -71,17 +71,6 @@ extern unsigned long phys_base;
|
|||
extern unsigned long __phys_addr(unsigned long);
|
||||
#define __phys_reloc_hide(x) (x)
|
||||
|
||||
/*
|
||||
* These are used to make use of C type-checking..
|
||||
*/
|
||||
typedef unsigned long pteval_t;
|
||||
typedef unsigned long pmdval_t;
|
||||
typedef unsigned long pudval_t;
|
||||
typedef unsigned long pgdval_t;
|
||||
typedef unsigned long pgprotval_t;
|
||||
|
||||
typedef struct { pteval_t pte; } pte_t;
|
||||
|
||||
#define vmemmap ((struct page *)VMEMMAP_START)
|
||||
|
||||
extern unsigned long init_memory_mapping(unsigned long start,
|
||||
|
|
|
@ -46,106 +46,15 @@
|
|||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef struct { pgdval_t pgd; } pgd_t;
|
||||
typedef struct { pgprotval_t pgprot; } pgprot_t;
|
||||
|
||||
static inline pgd_t native_make_pgd(pgdval_t val)
|
||||
{
|
||||
return (pgd_t) { val };
|
||||
}
|
||||
|
||||
static inline pgdval_t native_pgd_val(pgd_t pgd)
|
||||
{
|
||||
return pgd.pgd;
|
||||
}
|
||||
|
||||
static inline pgdval_t pgd_flags(pgd_t pgd)
|
||||
{
|
||||
return native_pgd_val(pgd) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
#if PAGETABLE_LEVELS > 3
|
||||
typedef struct { pudval_t pud; } pud_t;
|
||||
|
||||
static inline pud_t native_make_pud(pmdval_t val)
|
||||
{
|
||||
return (pud_t) { val };
|
||||
}
|
||||
|
||||
static inline pudval_t native_pud_val(pud_t pud)
|
||||
{
|
||||
return pud.pud;
|
||||
}
|
||||
#else
|
||||
#include <asm-generic/pgtable-nopud.h>
|
||||
|
||||
static inline pudval_t native_pud_val(pud_t pud)
|
||||
{
|
||||
return native_pgd_val(pud.pgd);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PAGETABLE_LEVELS > 2
|
||||
typedef struct { pmdval_t pmd; } pmd_t;
|
||||
|
||||
static inline pmd_t native_make_pmd(pmdval_t val)
|
||||
{
|
||||
return (pmd_t) { val };
|
||||
}
|
||||
|
||||
static inline pmdval_t native_pmd_val(pmd_t pmd)
|
||||
{
|
||||
return pmd.pmd;
|
||||
}
|
||||
#else
|
||||
#include <asm-generic/pgtable-nopmd.h>
|
||||
|
||||
static inline pmdval_t native_pmd_val(pmd_t pmd)
|
||||
{
|
||||
return native_pgd_val(pmd.pud.pgd);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline pudval_t pud_flags(pud_t pud)
|
||||
{
|
||||
return native_pud_val(pud) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
static inline pmdval_t pmd_flags(pmd_t pmd)
|
||||
{
|
||||
return native_pmd_val(pmd) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static inline pteval_t pte_flags(pte_t pte)
|
||||
{
|
||||
return native_pte_val(pte) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
#define pgprot_val(x) ((x).pgprot)
|
||||
#define __pgprot(x) ((pgprot_t) { (x) } )
|
||||
|
||||
|
||||
typedef struct page *pgtable_t;
|
||||
struct pgprot;
|
||||
|
||||
extern int page_is_ram(unsigned long pagenr);
|
||||
extern int pagerange_is_ram(unsigned long start, unsigned long end);
|
||||
extern int devmem_is_allowed(unsigned long pagenr);
|
||||
extern void map_devmem(unsigned long pfn, unsigned long size,
|
||||
pgprot_t vma_prot);
|
||||
struct pgprot vma_prot);
|
||||
extern void unmap_devmem(unsigned long pfn, unsigned long size,
|
||||
pgprot_t vma_prot);
|
||||
struct pgprot vma_prot);
|
||||
|
||||
extern unsigned long max_low_pfn_mapped;
|
||||
extern unsigned long max_pfn_mapped;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* para-virtualization: those hooks are defined here. */
|
||||
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#include <asm/page_types.h>
|
||||
#include <asm/pgtable_types.h>
|
||||
#include <asm/asm.h>
|
||||
|
||||
/* Bitmask of what can be clobbered: usually at least eax. */
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
#ifndef _ASM_X86_PGTABLE_2LEVEL_DEFS_H
|
||||
#define _ASM_X86_PGTABLE_2LEVEL_DEFS_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef unsigned long pteval_t;
|
||||
typedef unsigned long pmdval_t;
|
||||
typedef unsigned long pudval_t;
|
||||
typedef unsigned long pgdval_t;
|
||||
typedef unsigned long pgprotval_t;
|
||||
|
||||
typedef union {
|
||||
pteval_t pte;
|
||||
pteval_t pte_low;
|
||||
} pte_t;
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#define SHARED_KERNEL_PMD 0
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
#ifndef _ASM_X86_PGTABLE_3LEVEL_DEFS_H
|
||||
#define _ASM_X86_PGTABLE_3LEVEL_DEFS_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef u64 pteval_t;
|
||||
typedef u64 pmdval_t;
|
||||
typedef u64 pudval_t;
|
||||
typedef u64 pgdval_t;
|
||||
typedef u64 pgprotval_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
unsigned long pte_low, pte_high;
|
||||
};
|
||||
pteval_t pte;
|
||||
} pte_t;
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd)
|
||||
#else
|
||||
|
@ -25,4 +42,5 @@
|
|||
*/
|
||||
#define PTRS_PER_PTE 512
|
||||
|
||||
|
||||
#endif /* _ASM_X86_PGTABLE_3LEVEL_DEFS_H */
|
||||
|
|
|
@ -25,6 +25,66 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
|
|||
extern spinlock_t pgd_lock;
|
||||
extern struct list_head pgd_list;
|
||||
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#include <asm/paravirt.h>
|
||||
#else /* !CONFIG_PARAVIRT */
|
||||
#define set_pte(ptep, pte) native_set_pte(ptep, pte)
|
||||
#define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
|
||||
|
||||
#define set_pte_present(mm, addr, ptep, pte) \
|
||||
native_set_pte_present(mm, addr, ptep, pte)
|
||||
#define set_pte_atomic(ptep, pte) \
|
||||
native_set_pte_atomic(ptep, pte)
|
||||
|
||||
#define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd)
|
||||
|
||||
#ifndef __PAGETABLE_PUD_FOLDED
|
||||
#define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd)
|
||||
#define pgd_clear(pgd) native_pgd_clear(pgd)
|
||||
#endif
|
||||
|
||||
#ifndef set_pud
|
||||
# define set_pud(pudp, pud) native_set_pud(pudp, pud)
|
||||
#endif
|
||||
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
#define pud_clear(pud) native_pud_clear(pud)
|
||||
#endif
|
||||
|
||||
#define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep)
|
||||
#define pmd_clear(pmd) native_pmd_clear(pmd)
|
||||
|
||||
#define pte_update(mm, addr, ptep) do { } while (0)
|
||||
#define pte_update_defer(mm, addr, ptep) do { } while (0)
|
||||
|
||||
static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
|
||||
{
|
||||
native_pagetable_setup_start(base);
|
||||
}
|
||||
|
||||
static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
|
||||
{
|
||||
native_pagetable_setup_done(base);
|
||||
}
|
||||
|
||||
#define pgd_val(x) native_pgd_val(x)
|
||||
#define __pgd(x) native_make_pgd(x)
|
||||
|
||||
#ifndef __PAGETABLE_PUD_FOLDED
|
||||
#define pud_val(x) native_pud_val(x)
|
||||
#define __pud(x) native_make_pud(x)
|
||||
#endif
|
||||
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
#define pmd_val(x) native_pmd_val(x)
|
||||
#define __pmd(x) native_make_pmd(x)
|
||||
#endif
|
||||
|
||||
#define pte_val(x) native_pte_val(x)
|
||||
#define __pte(x) native_make_pte(x)
|
||||
|
||||
#endif /* CONFIG_PARAVIRT */
|
||||
|
||||
/*
|
||||
* The following only work if pte_present() is true.
|
||||
* Undefined behaviour if not..
|
||||
|
@ -214,49 +274,6 @@ static inline int is_new_memtype_allowed(unsigned long flags,
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#include <asm/paravirt.h>
|
||||
#else /* !CONFIG_PARAVIRT */
|
||||
#define set_pte(ptep, pte) native_set_pte(ptep, pte)
|
||||
#define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
|
||||
|
||||
#define set_pte_present(mm, addr, ptep, pte) \
|
||||
native_set_pte_present(mm, addr, ptep, pte)
|
||||
#define set_pte_atomic(ptep, pte) \
|
||||
native_set_pte_atomic(ptep, pte)
|
||||
|
||||
#define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd)
|
||||
|
||||
#ifndef __PAGETABLE_PUD_FOLDED
|
||||
#define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd)
|
||||
#define pgd_clear(pgd) native_pgd_clear(pgd)
|
||||
#endif
|
||||
|
||||
#ifndef set_pud
|
||||
# define set_pud(pudp, pud) native_set_pud(pudp, pud)
|
||||
#endif
|
||||
|
||||
#ifndef __PAGETABLE_PMD_FOLDED
|
||||
#define pud_clear(pud) native_pud_clear(pud)
|
||||
#endif
|
||||
|
||||
#define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep)
|
||||
#define pmd_clear(pmd) native_pmd_clear(pmd)
|
||||
|
||||
#define pte_update(mm, addr, ptep) do { } while (0)
|
||||
#define pte_update_defer(mm, addr, ptep) do { } while (0)
|
||||
|
||||
static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
|
||||
{
|
||||
native_pagetable_setup_start(base);
|
||||
}
|
||||
|
||||
static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
|
||||
{
|
||||
native_pagetable_setup_done(base);
|
||||
}
|
||||
#endif /* CONFIG_PARAVIRT */
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
#ifndef _ASM_X86_PGTABLE_64_DEFS_H
|
||||
#define _ASM_X86_PGTABLE_64_DEFS_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* These are used to make use of C type-checking..
|
||||
*/
|
||||
typedef unsigned long pteval_t;
|
||||
typedef unsigned long pmdval_t;
|
||||
typedef unsigned long pudval_t;
|
||||
typedef unsigned long pgdval_t;
|
||||
typedef unsigned long pgprotval_t;
|
||||
|
||||
typedef struct { pteval_t pte; } pte_t;
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#define SHARED_KERNEL_PMD 0
|
||||
|
||||
/*
|
||||
|
|
|
@ -162,9 +162,110 @@
|
|||
#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
# include "pgtable_32_types.h"
|
||||
#else
|
||||
# include "pgtable_64_types.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;
|
||||
|
||||
typedef struct { pgdval_t pgd; } pgd_t;
|
||||
|
||||
static inline pgd_t native_make_pgd(pgdval_t val)
|
||||
{
|
||||
return (pgd_t) { val };
|
||||
}
|
||||
|
||||
static inline pgdval_t native_pgd_val(pgd_t pgd)
|
||||
{
|
||||
return pgd.pgd;
|
||||
}
|
||||
|
||||
static inline pgdval_t pgd_flags(pgd_t pgd)
|
||||
{
|
||||
return native_pgd_val(pgd) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
#if PAGETABLE_LEVELS > 3
|
||||
typedef struct { pudval_t pud; } pud_t;
|
||||
|
||||
static inline pud_t native_make_pud(pmdval_t val)
|
||||
{
|
||||
return (pud_t) { val };
|
||||
}
|
||||
|
||||
static inline pudval_t native_pud_val(pud_t pud)
|
||||
{
|
||||
return pud.pud;
|
||||
}
|
||||
#else
|
||||
#include <asm-generic/pgtable-nopud.h>
|
||||
|
||||
static inline pudval_t native_pud_val(pud_t pud)
|
||||
{
|
||||
return native_pgd_val(pud.pgd);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PAGETABLE_LEVELS > 2
|
||||
typedef struct { pmdval_t pmd; } pmd_t;
|
||||
|
||||
static inline pmd_t native_make_pmd(pmdval_t val)
|
||||
{
|
||||
return (pmd_t) { val };
|
||||
}
|
||||
|
||||
static inline pmdval_t native_pmd_val(pmd_t pmd)
|
||||
{
|
||||
return pmd.pmd;
|
||||
}
|
||||
#else
|
||||
#include <asm-generic/pgtable-nopmd.h>
|
||||
|
||||
static inline pmdval_t native_pmd_val(pmd_t pmd)
|
||||
{
|
||||
return native_pgd_val(pmd.pud.pgd);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline pudval_t pud_flags(pud_t pud)
|
||||
{
|
||||
return native_pud_val(pud) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
static inline pmdval_t pmd_flags(pmd_t pmd)
|
||||
{
|
||||
return native_pmd_val(pmd) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static inline pteval_t pte_flags(pte_t pte)
|
||||
{
|
||||
return native_pte_val(pte) & PTE_FLAGS_MASK;
|
||||
}
|
||||
|
||||
#define pgprot_val(x) ((x).pgprot)
|
||||
#define __pgprot(x) ((pgprot_t) { (x) } )
|
||||
|
||||
|
||||
typedef struct page *pgtable_t;
|
||||
|
||||
extern pteval_t __supported_pte_mask;
|
||||
extern int nx_enabled;
|
||||
|
||||
#define pgprot_writecombine pgprot_writecombine
|
||||
extern pgprot_t pgprot_writecombine(pgprot_t prot);
|
||||
|
@ -217,10 +318,4 @@ extern pte_t *lookup_address(unsigned long address, unsigned int *level);
|
|||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
# include "pgtable_32_types.h"
|
||||
#else
|
||||
# include "pgtable_64_types.h"
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_X86_PGTABLE_DEFS_H */
|
||||
|
|
|
@ -16,6 +16,7 @@ struct mm_struct;
|
|||
#include <asm/cpufeature.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable_types.h>
|
||||
#include <asm/percpu.h>
|
||||
#include <asm/msr.h>
|
||||
#include <asm/desc_defs.h>
|
||||
|
|
Loading…
Reference in New Issue