Commit bcbe7f77 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Michael Ellerman

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: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 27209206
...@@ -51,7 +51,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) ...@@ -51,7 +51,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd); kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);
} }
#ifndef CONFIG_PPC_64K_PAGES
static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
{ {
pgd_set(pgd, __pgtable_ptr_val(pud)); 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,7 +77,13 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
{ {
pmd_set(pmd, __pgtable_ptr_val(pte)); pmd_set(pmd, __pgtable_ptr_val(pte));
} }
/*
* FIXME!!
* Between 4K and 64K pages, we differ in what is stored in pmd. ie.
* typedef pte_t *pgtable_t; -> 64K
* typedef struct page *pgtable_t; -> 4k
*/
#ifdef CONFIG_PPC_4K_PAGES
static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
pgtable_t pte_page) pgtable_t pte_page)
{ {
...@@ -176,36 +181,6 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift); ...@@ -176,36 +181,6 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift);
extern void __tlb_remove_table(void *_table); extern void __tlb_remove_table(void *_table);
#endif #endif
#ifndef __PAGETABLE_PUD_FOLDED
/* book3s 64 is 4 level page table */
static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
{
pgd_set(pgd, __pgtable_ptr_val(pud));
}
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
{
return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
GFP_KERNEL|__GFP_REPEAT);
}
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
{
kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud);
}
#endif
static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
{
pud_set(pud, __pgtable_ptr_val(pmd));
}
static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
pte_t *pte)
{
pmd_set(pmd, __pgtable_ptr_val(pte));
}
static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
pgtable_t pte_page) pgtable_t pte_page)
{ {
...@@ -245,7 +220,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, ...@@ -245,7 +220,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
tlb_flush_pgtable(tlb, address); tlb_flush_pgtable(tlb, address);
pgtable_free_tlb(tlb, table, 0); pgtable_free_tlb(tlb, table, 0);
} }
#endif /* CONFIG_PPC_64K_PAGES */ #endif /* CONFIG_PPC_4K_PAGES */
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
{ {
...@@ -258,13 +233,17 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) ...@@ -258,13 +233,17 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd); kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
} }
#define __pmd_free_tlb(tlb, pmd, addr) \ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX) unsigned long address)
#ifndef __PAGETABLE_PUD_FOLDED {
#define __pud_free_tlb(tlb, pud, addr) \ return pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX);
pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE) }
#endif /* __PAGETABLE_PUD_FOLDED */ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
unsigned long address)
{
pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE);
}
#define check_pgt_cache() do { } while (0) #define check_pgt_cache() do { } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment