.. | .. |
---|
20 | 20 | #include <asm/nohash/pgtable.h> |
---|
21 | 21 | #endif /* !CONFIG_PPC_BOOK3S */ |
---|
22 | 22 | |
---|
| 23 | +/* Note due to the way vm flags are laid out, the bits are XWR */ |
---|
| 24 | +#define __P000 PAGE_NONE |
---|
| 25 | +#define __P001 PAGE_READONLY |
---|
| 26 | +#define __P010 PAGE_COPY |
---|
| 27 | +#define __P011 PAGE_COPY |
---|
| 28 | +#define __P100 PAGE_READONLY_X |
---|
| 29 | +#define __P101 PAGE_READONLY_X |
---|
| 30 | +#define __P110 PAGE_COPY_X |
---|
| 31 | +#define __P111 PAGE_COPY_X |
---|
| 32 | + |
---|
| 33 | +#define __S000 PAGE_NONE |
---|
| 34 | +#define __S001 PAGE_READONLY |
---|
| 35 | +#define __S010 PAGE_SHARED |
---|
| 36 | +#define __S011 PAGE_SHARED |
---|
| 37 | +#define __S100 PAGE_READONLY_X |
---|
| 38 | +#define __S101 PAGE_READONLY_X |
---|
| 39 | +#define __S110 PAGE_SHARED_X |
---|
| 40 | +#define __S111 PAGE_SHARED_X |
---|
| 41 | + |
---|
23 | 42 | #ifndef __ASSEMBLY__ |
---|
24 | 43 | |
---|
25 | 44 | #include <asm/tlbflush.h> |
---|
.. | .. |
---|
27 | 46 | /* Keep these as a macros to avoid include dependency mess */ |
---|
28 | 47 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
---|
29 | 48 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) |
---|
| 49 | +/* |
---|
| 50 | + * Select all bits except the pfn |
---|
| 51 | + */ |
---|
| 52 | +static inline pgprot_t pte_pgprot(pte_t pte) |
---|
| 53 | +{ |
---|
| 54 | + unsigned long pte_flags; |
---|
30 | 55 | |
---|
| 56 | + pte_flags = pte_val(pte) & ~PTE_RPN_MASK; |
---|
| 57 | + return __pgprot(pte_flags); |
---|
| 58 | +} |
---|
| 59 | + |
---|
| 60 | +#ifndef pmd_page_vaddr |
---|
| 61 | +static inline unsigned long pmd_page_vaddr(pmd_t pmd) |
---|
| 62 | +{ |
---|
| 63 | + return ((unsigned long)__va(pmd_val(pmd) & ~PMD_MASKED_BITS)); |
---|
| 64 | +} |
---|
| 65 | +#define pmd_page_vaddr pmd_page_vaddr |
---|
| 66 | +#endif |
---|
31 | 67 | /* |
---|
32 | 68 | * ZERO_PAGE is a global shared page that is always zero: used |
---|
33 | 69 | * for zero-mapped memory areas etc.. |
---|
.. | .. |
---|
37 | 73 | |
---|
38 | 74 | extern pgd_t swapper_pg_dir[]; |
---|
39 | 75 | |
---|
40 | | -void limit_zone_pfn(enum zone_type zone, unsigned long max_pfn); |
---|
41 | | -int dma_pfn_limit_to_zone(u64 pfn_limit); |
---|
42 | 76 | extern void paging_init(void); |
---|
| 77 | + |
---|
| 78 | +extern unsigned long ioremap_bot; |
---|
43 | 79 | |
---|
44 | 80 | /* |
---|
45 | 81 | * kern_addr_valid is intended to indicate whether an address is a valid |
---|
.. | .. |
---|
48 | 84 | */ |
---|
49 | 85 | #define kern_addr_valid(addr) (1) |
---|
50 | 86 | |
---|
51 | | -#include <asm-generic/pgtable.h> |
---|
52 | | - |
---|
53 | | - |
---|
54 | | -/* |
---|
55 | | - * This gets called at the end of handling a page fault, when |
---|
56 | | - * the kernel has put a new PTE into the page table for the process. |
---|
57 | | - * We use it to ensure coherency between the i-cache and d-cache |
---|
58 | | - * for the page which has just been mapped in. |
---|
59 | | - * On machines which use an MMU hash table, we use this to put a |
---|
60 | | - * corresponding HPTE into the hash table ahead of time, instead of |
---|
61 | | - * waiting for the inevitable extra hash-table miss exception. |
---|
62 | | - */ |
---|
63 | | -extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); |
---|
64 | | - |
---|
65 | | -extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, |
---|
66 | | - unsigned long end, int write, |
---|
67 | | - struct page **pages, int *nr); |
---|
68 | 87 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE |
---|
69 | 88 | #define pmd_large(pmd) 0 |
---|
70 | 89 | #endif |
---|
.. | .. |
---|
72 | 91 | /* can we use this in kvm */ |
---|
73 | 92 | unsigned long vmalloc_to_phys(void *vmalloc_addr); |
---|
74 | 93 | |
---|
75 | | -void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); |
---|
76 | | -void pgtable_cache_init(void); |
---|
| 94 | +void pgtable_cache_add(unsigned int shift); |
---|
| 95 | + |
---|
| 96 | +pte_t *early_pte_alloc_kernel(pmd_t *pmdp, unsigned long va); |
---|
77 | 97 | |
---|
78 | 98 | #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_PPC32) |
---|
79 | 99 | void mark_initmem_nx(void); |
---|
.. | .. |
---|
81 | 101 | static inline void mark_initmem_nx(void) { } |
---|
82 | 102 | #endif |
---|
83 | 103 | |
---|
| 104 | +/* |
---|
| 105 | + * When used, PTE_FRAG_NR is defined in subarch pgtable.h |
---|
| 106 | + * so we are sure it is included when arriving here. |
---|
| 107 | + */ |
---|
| 108 | +#ifdef PTE_FRAG_NR |
---|
| 109 | +static inline void *pte_frag_get(mm_context_t *ctx) |
---|
| 110 | +{ |
---|
| 111 | + return ctx->pte_frag; |
---|
| 112 | +} |
---|
| 113 | + |
---|
| 114 | +static inline void pte_frag_set(mm_context_t *ctx, void *p) |
---|
| 115 | +{ |
---|
| 116 | + ctx->pte_frag = p; |
---|
| 117 | +} |
---|
| 118 | +#else |
---|
| 119 | +#define PTE_FRAG_NR 1 |
---|
| 120 | +#define PTE_FRAG_SIZE_SHIFT PAGE_SHIFT |
---|
| 121 | +#define PTE_FRAG_SIZE (1UL << PTE_FRAG_SIZE_SHIFT) |
---|
| 122 | + |
---|
| 123 | +static inline void *pte_frag_get(mm_context_t *ctx) |
---|
| 124 | +{ |
---|
| 125 | + return NULL; |
---|
| 126 | +} |
---|
| 127 | + |
---|
| 128 | +static inline void pte_frag_set(mm_context_t *ctx, void *p) |
---|
| 129 | +{ |
---|
| 130 | +} |
---|
| 131 | +#endif |
---|
| 132 | + |
---|
| 133 | +#ifndef pmd_is_leaf |
---|
| 134 | +#define pmd_is_leaf pmd_is_leaf |
---|
| 135 | +static inline bool pmd_is_leaf(pmd_t pmd) |
---|
| 136 | +{ |
---|
| 137 | + return false; |
---|
| 138 | +} |
---|
| 139 | +#endif |
---|
| 140 | + |
---|
| 141 | +#ifndef pud_is_leaf |
---|
| 142 | +#define pud_is_leaf pud_is_leaf |
---|
| 143 | +static inline bool pud_is_leaf(pud_t pud) |
---|
| 144 | +{ |
---|
| 145 | + return false; |
---|
| 146 | +} |
---|
| 147 | +#endif |
---|
| 148 | + |
---|
| 149 | +#ifndef p4d_is_leaf |
---|
| 150 | +#define p4d_is_leaf p4d_is_leaf |
---|
| 151 | +static inline bool p4d_is_leaf(p4d_t p4d) |
---|
| 152 | +{ |
---|
| 153 | + return false; |
---|
| 154 | +} |
---|
| 155 | +#endif |
---|
| 156 | + |
---|
| 157 | +#ifdef CONFIG_PPC64 |
---|
| 158 | +#define is_ioremap_addr is_ioremap_addr |
---|
| 159 | +static inline bool is_ioremap_addr(const void *x) |
---|
| 160 | +{ |
---|
| 161 | + unsigned long addr = (unsigned long)x; |
---|
| 162 | + |
---|
| 163 | + return addr >= IOREMAP_BASE && addr < IOREMAP_END; |
---|
| 164 | +} |
---|
| 165 | +#endif /* CONFIG_PPC64 */ |
---|
| 166 | + |
---|
84 | 167 | #endif /* __ASSEMBLY__ */ |
---|
85 | 168 | |
---|
86 | 169 | #endif /* _ASM_POWERPC_PGTABLE_H */ |
---|