aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/pgalloc.h
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2013-04-28 05:37:32 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-04-30 02:00:04 -0400
commitd614bb041209fd7cb5e4b35e11a7b2f6ee8f62b8 (patch)
treef3ec5a71345b507db2b8c8d461c869741d015514 /arch/powerpc/include/asm/pgalloc.h
parent419df06eea5bfa815e3a78e0aad6cfb320c1654f (diff)
powerpc: Move the pte free routines from common header
Acked-by: Paul Mackerras <paulus@samba.org> This patch moves the common code to 32/64 bit headers and also duplicate 4K_PAGES and 64K_PAGES section. We will later change the 64 bit 64K_PAGES version to support smaller PTE fragments. The patch doesn't introduce any functional changes. Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/pgalloc.h')
-rw-r--r--arch/powerpc/include/asm/pgalloc.h46
1 files changed, 1 insertions, 45 deletions
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h
index bf301ac62f35..e9a9f60e596d 100644
--- a/arch/powerpc/include/asm/pgalloc.h
+++ b/arch/powerpc/include/asm/pgalloc.h
@@ -3,6 +3,7 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <asm-generic/tlb.h>
6 7
7#ifdef CONFIG_PPC_BOOK3E 8#ifdef CONFIG_PPC_BOOK3E
8extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address); 9extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address);
@@ -13,56 +14,11 @@ static inline void tlb_flush_pgtable(struct mmu_gather *tlb,
13} 14}
14#endif /* !CONFIG_PPC_BOOK3E */ 15#endif /* !CONFIG_PPC_BOOK3E */
15 16
16static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
17{
18 free_page((unsigned long)pte);
19}
20
21static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
22{
23 pgtable_page_dtor(ptepage);
24 __free_page(ptepage);
25}
26
27#ifdef CONFIG_PPC64 17#ifdef CONFIG_PPC64
28#include <asm/pgalloc-64.h> 18#include <asm/pgalloc-64.h>
29#else 19#else
30#include <asm/pgalloc-32.h> 20#include <asm/pgalloc-32.h>
31#endif 21#endif
32 22
33#ifdef CONFIG_SMP
34struct mmu_gather;
35extern void tlb_remove_table(struct mmu_gather *, void *);
36
37static 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
45static 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}
52#else /* CONFIG_SMP */
53static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift)
54{
55 pgtable_free(table, shift);
56}
57#endif /* !CONFIG_SMP */
58
59static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage,
60 unsigned long address)
61{
62 tlb_flush_pgtable(tlb, address);
63 pgtable_page_dtor(ptepage);
64 pgtable_free_tlb(tlb, page_address(ptepage), 0);
65}
66
67#endif /* __KERNEL__ */ 23#endif /* __KERNEL__ */
68#endif /* _ASM_POWERPC_PGALLOC_H */ 24#endif /* _ASM_POWERPC_PGALLOC_H */