Skip to content

Commit

Permalink
powerpc/mm: refactor pmd_pgtable()
Browse files Browse the repository at this point in the history
pmd_pgtable() is identical on the 4 subarches, refactor it.

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Christophe Leroy authored and Michael Ellerman committed May 2, 2019
1 parent 7cec90e commit 8a2cc87
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions arch/powerpc/include/asm/book3s/32/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,
*pmdp = __pmd(__pa(pte_page) | _PMD_PRESENT);
}

#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))

static inline void pgtable_free(void *table, unsigned index_size)
{
if (!index_size) {
Expand Down
5 changes: 0 additions & 5 deletions arch/powerpc/include/asm/book3s/64/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
*pmd = __pmd(__pgtable_ptr_val(pte_page) | PMD_VAL_BITS);
}

static inline pgtable_t pmd_pgtable(pmd_t pmd)
{
return (pgtable_t)pmd_page_vaddr(pmd);
}

static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
unsigned long address)
{
Expand Down
2 changes: 0 additions & 2 deletions arch/powerpc/include/asm/nohash/32/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,4 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,
*pmdp = __pmd(__pa(pte_page) | _PMD_USER | _PMD_PRESENT);
}

#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))

#endif /* _ASM_POWERPC_PGALLOC_32_H */
2 changes: 0 additions & 2 deletions arch/powerpc/include/asm/nohash/64/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
pmd_set(pmd, (unsigned long)pte_page);
}

#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))

static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
{
return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX),
Expand Down
5 changes: 5 additions & 0 deletions arch/powerpc/include/asm/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,9 @@ static inline void check_pgt_cache(void) { }
#include <asm/nohash/pgalloc.h>
#endif

static inline pgtable_t pmd_pgtable(pmd_t pmd)
{
return (pgtable_t)pmd_page_vaddr(pmd);
}

#endif /* _ASM_POWERPC_PGALLOC_H */

0 comments on commit 8a2cc87

Please sign in to comment.