aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2016-04-29 09:26:16 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-05-11 07:53:50 -0400
commitbcbe7f777eb396f9bbf4cb1cab3b206f50881191 (patch)
treef74718b93fe5d88b928f5365a58322c1dc6b43a4
parent27209206a60fa6ffc92e8d9886ae32abaad5b442 (diff)
powerpc/mm: Simplify the code dropping 4-level table #ifdef
Simplify the code by dropping 4-level page table #ifdef. We are always 4-level now. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/book3s/64/pgalloc.h57
1 files changed, 18 insertions, 39 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/pgalloc.h b/arch/powerpc/include/asm/book3s/64/pgalloc.h
index 54017260c8bf..2a246245eca0 100644
--- a/arch/powerpc/include/asm/book3s/64/pgalloc.h
+++ b/arch/powerpc/include/asm/book3s/64/pgalloc.h
@@ -51,7 +51,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
51 kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd); 51 kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);
52} 52}
53 53
54#ifndef CONFIG_PPC_64K_PAGES
55static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) 54static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
56{ 55{
57 pgd_set(pgd, __pgtable_ptr_val(pud)); 56 pgd_set(pgd, __pgtable_ptr_val(pud));
@@ -78,7 +77,13 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
78{ 77{
79 pmd_set(pmd, __pgtable_ptr_val(pte)); 78 pmd_set(pmd, __pgtable_ptr_val(pte));
80} 79}
81 80/*
81 * FIXME!!
82 * Between 4K and 64K pages, we differ in what is stored in pmd. ie.
83 * typedef pte_t *pgtable_t; -> 64K
84 * typedef struct page *pgtable_t; -> 4k
85 */
86#ifdef CONFIG_PPC_4K_PAGES
82static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 87static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
83 pgtable_t pte_page) 88 pgtable_t pte_page)
84{ 89{
@@ -176,36 +181,6 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift);
176extern void __tlb_remove_table(void *_table); 181extern void __tlb_remove_table(void *_table);
177#endif 182#endif
178 183
179#ifndef __PAGETABLE_PUD_FOLDED
180/* book3s 64 is 4 level page table */
181static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
182{
183 pgd_set(pgd, __pgtable_ptr_val(pud));
184}
185
186static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
187{
188 return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
189 GFP_KERNEL|__GFP_REPEAT);
190}
191
192static inline void pud_free(struct mm_struct *mm, pud_t *pud)
193{
194 kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud);
195}
196#endif
197
198static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
199{
200 pud_set(pud, __pgtable_ptr_val(pmd));
201}
202
203static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
204 pte_t *pte)
205{
206 pmd_set(pmd, __pgtable_ptr_val(pte));
207}
208
209static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 184static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
210 pgtable_t pte_page) 185 pgtable_t pte_page)
211{ 186{
@@ -245,7 +220,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
245 tlb_flush_pgtable(tlb, address); 220 tlb_flush_pgtable(tlb, address);
246 pgtable_free_tlb(tlb, table, 0); 221 pgtable_free_tlb(tlb, table, 0);
247} 222}
248#endif /* CONFIG_PPC_64K_PAGES */ 223#endif /* CONFIG_PPC_4K_PAGES */
249 224
250static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 225static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
251{ 226{
@@ -258,13 +233,17 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
258 kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd); 233 kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
259} 234}
260 235
261#define __pmd_free_tlb(tlb, pmd, addr) \ 236static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
262 pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX) 237 unsigned long address)
263#ifndef __PAGETABLE_PUD_FOLDED 238{
264#define __pud_free_tlb(tlb, pud, addr) \ 239 return pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX);
265 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE) 240}
266 241
267#endif /* __PAGETABLE_PUD_FOLDED */ 242static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
243 unsigned long address)
244{
245 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE);
246}
268 247
269#define check_pgt_cache() do { } while (0) 248#define check_pgt_cache() do { } while (0)
270 249