openrisc: add support for folded p4d page tables
authorMike Rapoport <rppt@linux.ibm.com>
Thu, 4 Jun 2020 23:46:39 +0000 (16:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jun 2020 02:06:21 +0000 (19:06 -0700)
Implement primitives necessary for the 4th level folding, add walks of p4d
level where appropriate and remove usage of __ARCH_USE_5LEVEL_HACK.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Brian Cain <bcain@codeaurora.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: James Morse <james.morse@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Julien Thierry <julien.thierry.kdev@gmail.com>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/20200414153455.21744-8-rppt@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/openrisc/include/asm/pgtable.h
arch/openrisc/mm/fault.c
arch/openrisc/mm/init.c

index 7f3fb9c..219979e 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef __ASM_OPENRISC_PGTABLE_H
 #define __ASM_OPENRISC_PGTABLE_H
 
-#define __ARCH_USE_5LEVEL_HACK
 #include <asm-generic/pgtable-nopmd.h>
 
 #ifndef __ASSEMBLY__
index 8af1cc7..6e0a11a 100644 (file)
@@ -295,6 +295,7 @@ vmalloc_fault:
 
                int offset = pgd_index(address);
                pgd_t *pgd, *pgd_k;
+               p4d_t *p4d, *p4d_k;
                pud_t *pud, *pud_k;
                pmd_t *pmd, *pmd_k;
                pte_t *pte_k;
@@ -321,8 +322,13 @@ vmalloc_fault:
                 * it exists.
                 */
 
-               pud = pud_offset(pgd, address);
-               pud_k = pud_offset(pgd_k, address);
+               p4d = p4d_offset(pgd, address);
+               p4d_k = p4d_offset(pgd_k, address);
+               if (!p4d_present(*p4d_k))
+                       goto no_context;
+
+               pud = pud_offset(p4d, address);
+               pud_k = pud_offset(p4d_k, address);
                if (!pud_present(*pud_k))
                        goto no_context;
 
index f94fe6d..3bcdc1c 100644 (file)
@@ -68,6 +68,7 @@ static void __init map_ram(void)
        unsigned long v, p, e;
        pgprot_t prot;
        pgd_t *pge;
+       p4d_t *p4e;
        pud_t *pue;
        pmd_t *pme;
        pte_t *pte;
@@ -87,7 +88,8 @@ static void __init map_ram(void)
 
                while (p < e) {
                        int j;
-                       pue = pud_offset(pge, v);
+                       p4e = p4d_offset(pge, v);
+                       pue = pud_offset(p4e, v);
                        pme = pmd_offset(pue, v);
 
                        if ((u32) pue != (u32) pge || (u32) pme != (u32) pge) {