aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/pgalloc-32.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-32.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-32.h')
-rw-r--r--arch/powerpc/include/asm/pgalloc-32.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h
index 580cf73b96e8..27b2386f738a 100644
--- a/arch/powerpc/include/asm/pgalloc-32.h
+++ b/arch/powerpc/include/asm/pgalloc-32.h
@@ -37,6 +37,17 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
37extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 37extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
38extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr); 38extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);
39 39
40static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
41{
42 free_page((unsigned long)pte);
43}
44
45static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
46{
47 pgtable_page_dtor(ptepage);
48 __free_page(ptepage);
49}
50
40static inline void pgtable_free(void *table, unsigned index_size) 51static inline void pgtable_free(void *table, unsigned index_size)
41{ 52{
42 BUG_ON(index_size); /* 32-bit doesn't use this */ 53 BUG_ON(index_size); /* 32-bit doesn't use this */
@@ -45,4 +56,38 @@ static inline void pgtable_free(void *table, unsigned index_size)
45 56
46#define check_pgt_cache() do { } while (0) 57#define check_pgt_cache() do { } while (0)
47 58
59#ifdef CONFIG_SMP
60static inline void pgtable_free_tlb(struct mmu_gather *tlb,
61 void *table, int shift)
62{
63 unsigned long pgf = (unsigned long)table;
64 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
65 pgf |= shift;
66 tlb_remove_table(tlb, (void *)pgf);
67}
68
69static inline void __tlb_remove_table(void *_table)
70{
71 void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);
72 unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;
73
74 pgtable_free(table, shift);
75}
76#else
77static inline void pgtable_free_tlb(struct mmu_gather *tlb,
78 void *table, int shift)
79{
80 pgtable_free(table, shift);
81}
82#endif
83
84static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
85 unsigned long address)
86{
87 struct page *page = page_address(table);
88
89 tlb_flush_pgtable(tlb, address);
90 pgtable_page_dtor(page);
91 pgtable_free_tlb(tlb, page, 0);
92}
48#endif /* _ASM_POWERPC_PGALLOC_32_H */ 93#endif /* _ASM_POWERPC_PGALLOC_32_H */