diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2020-01-09 09:25:25 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-02-26 00:34:40 +0100 |
commit | 0b1c524caaae2428b20e714297243e5551251eb5 (patch) | |
tree | 51806fdc1f8b1c14a5fc08b25809bb2062c0eee2 /arch/powerpc/include/asm/pgtable.h | |
parent | powerpc/32: don't restore r0, r6-r8 on exception entry path after trace_hardi... (diff) | |
download | linux-0b1c524caaae2428b20e714297243e5551251eb5.tar.xz linux-0b1c524caaae2428b20e714297243e5551251eb5.zip |
powerpc/32: refactor pmd_offset(pud_offset(pgd_offset...
At several places pmd pointer is retrieved through the same action:
pmd = pmd_offset(pud_offset(pgd_offset(mm, addr), addr), addr);
or
pmd = pmd_offset(pud_offset(pgd_offset_k(addr), addr), addr);
Refactor this by implementing two helpers pmd_ptr() and pmd_ptr_k()
This will help when adding the p4d level.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/7b065c5be35726af4066cab238ee35cabceda1fa.1578558199.git.christophe.leroy@c-s.fr
Diffstat (limited to 'arch/powerpc/include/asm/pgtable.h')
-rw-r--r-- | arch/powerpc/include/asm/pgtable.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 8cc543ed114c..22bf7bb666a7 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -41,6 +41,18 @@ struct mm_struct; #ifndef __ASSEMBLY__ +#ifdef CONFIG_PPC32 +static inline pmd_t *pmd_ptr(struct mm_struct *mm, unsigned long va) +{ + return pmd_offset(pud_offset(pgd_offset(mm, va), va), va); +} + +static inline pmd_t *pmd_ptr_k(unsigned long va) +{ + return pmd_offset(pud_offset(pgd_offset_k(va), va), va); +} +#endif + #include <asm/tlbflush.h> /* Keep these as a macros to avoid include dependency mess */ |