Commit | Line | Data |
---|---|---|
047ea784 PM |
1 | #ifndef _ASM_POWERPC_PGALLOC_H |
2 | #define _ASM_POWERPC_PGALLOC_H | |
88ced031 | 3 | #ifdef __KERNEL__ |
047ea784 | 4 | |
0186f47e KG |
5 | #include <linux/mm.h> |
6 | ||
c7cc58a1 BH |
7 | #ifdef CONFIG_PPC_BOOK3E |
8 | extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address); | |
9 | #else /* CONFIG_PPC_BOOK3E */ | |
10 | static inline void tlb_flush_pgtable(struct mmu_gather *tlb, | |
11 | unsigned long address) | |
12 | { | |
13 | } | |
14 | #endif /* !CONFIG_PPC_BOOK3E */ | |
15 | ||
0186f47e KG |
16 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
17 | { | |
18 | free_page((unsigned long)pte); | |
19 | } | |
20 | ||
21 | static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) | |
22 | { | |
23 | pgtable_page_dtor(ptepage); | |
24 | __free_page(ptepage); | |
25 | } | |
26 | ||
f88df14b DG |
27 | #ifdef CONFIG_PPC64 |
28 | #include <asm/pgalloc-64.h> | |
047ea784 | 29 | #else |
f88df14b | 30 | #include <asm/pgalloc-32.h> |
3c726f8d | 31 | #endif |
1da177e4 | 32 | |
0186f47e | 33 | #ifdef CONFIG_SMP |
26723911 PZ |
34 | struct mmu_gather; |
35 | extern void tlb_remove_table(struct mmu_gather *, void *); | |
36 | ||
37 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift) | |
38 | { | |
39 | unsigned long pgf = (unsigned long)table; | |
40 | BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE); | |
41 | pgf |= shift; | |
42 | tlb_remove_table(tlb, (void *)pgf); | |
43 | } | |
44 | ||
45 | static inline void __tlb_remove_table(void *_table) | |
46 | { | |
47 | void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE); | |
48 | unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE; | |
49 | ||
50 | pgtable_free(table, shift); | |
51 | } | |
c7cc58a1 | 52 | #else /* CONFIG_SMP */ |
a0668cdc | 53 | static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift) |
c7cc58a1 | 54 | { |
a0668cdc | 55 | pgtable_free(table, shift); |
c7cc58a1 | 56 | } |
c7cc58a1 | 57 | #endif /* !CONFIG_SMP */ |
0186f47e | 58 | |
c7cc58a1 BH |
59 | static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, |
60 | unsigned long address) | |
61 | { | |
c7cc58a1 BH |
62 | tlb_flush_pgtable(tlb, address); |
63 | pgtable_page_dtor(ptepage); | |
a0668cdc | 64 | pgtable_free_tlb(tlb, page_address(ptepage), 0); |
c7cc58a1 | 65 | } |
0186f47e | 66 | |
88ced031 | 67 | #endif /* __KERNEL__ */ |
047ea784 | 68 | #endif /* _ASM_POWERPC_PGALLOC_H */ |