diff options
Diffstat (limited to 'arch/powerpc/include/asm/pgalloc.h')
-rw-r--r-- | arch/powerpc/include/asm/pgalloc.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h index e11f03007b57..2b2c60a1a66d 100644 --- a/arch/powerpc/include/asm/pgalloc.h +++ b/arch/powerpc/include/asm/pgalloc.h | |||
@@ -20,10 +20,61 @@ static inline gfp_t pgtable_gfp_flags(struct mm_struct *mm, gfp_t gfp) | |||
20 | 20 | ||
21 | #define PGALLOC_GFP (GFP_KERNEL | __GFP_ZERO) | 21 | #define PGALLOC_GFP (GFP_KERNEL | __GFP_ZERO) |
22 | 22 | ||
23 | pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel); | ||
24 | |||
25 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) | ||
26 | { | ||
27 | return (pte_t *)pte_fragment_alloc(mm, 1); | ||
28 | } | ||
29 | |||
30 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm) | ||
31 | { | ||
32 | return (pgtable_t)pte_fragment_alloc(mm, 0); | ||
33 | } | ||
34 | |||
35 | void pte_frag_destroy(void *pte_frag); | ||
36 | void pte_fragment_free(unsigned long *table, int kernel); | ||
37 | |||
38 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
39 | { | ||
40 | pte_fragment_free((unsigned long *)pte, 1); | ||
41 | } | ||
42 | |||
43 | static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) | ||
44 | { | ||
45 | pte_fragment_free((unsigned long *)ptepage, 0); | ||
46 | } | ||
47 | |||
48 | /* | ||
49 | * Functions that deal with pagetables that could be at any level of | ||
50 | * the table need to be passed an "index_size" so they know how to | ||
51 | * handle allocation. For PTE pages, the allocation size will be | ||
52 | * (2^index_size * sizeof(pointer)) and allocations are drawn from | ||
53 | * the kmem_cache in PGT_CACHE(index_size). | ||
54 | * | ||
55 | * The maximum index size needs to be big enough to allow any | ||
56 | * pagetable sizes we need, but small enough to fit in the low bits of | ||
57 | * any page table pointer. In other words all pagetables, even tiny | ||
58 | * ones, must be aligned to allow at least enough low 0 bits to | ||
59 | * contain this value. This value is also used as a mask, so it must | ||
60 | * be one less than a power of two. | ||
61 | */ | ||
62 | #define MAX_PGTABLE_INDEX_SIZE 0xf | ||
63 | |||
64 | extern struct kmem_cache *pgtable_cache[]; | ||
65 | #define PGT_CACHE(shift) pgtable_cache[shift] | ||
66 | |||
67 | static inline void check_pgt_cache(void) { } | ||
68 | |||
23 | #ifdef CONFIG_PPC_BOOK3S | 69 | #ifdef CONFIG_PPC_BOOK3S |
24 | #include <asm/book3s/pgalloc.h> | 70 | #include <asm/book3s/pgalloc.h> |
25 | #else | 71 | #else |
26 | #include <asm/nohash/pgalloc.h> | 72 | #include <asm/nohash/pgalloc.h> |
27 | #endif | 73 | #endif |
28 | 74 | ||
75 | static inline pgtable_t pmd_pgtable(pmd_t pmd) | ||
76 | { | ||
77 | return (pgtable_t)pmd_page_vaddr(pmd); | ||
78 | } | ||
79 | |||
29 | #endif /* _ASM_POWERPC_PGALLOC_H */ | 80 | #endif /* _ASM_POWERPC_PGALLOC_H */ |