mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
mm: convert generic code to 5-level paging
Convert all non-architecture-specific code to 5-level paging. It's mostly mechanical adding handling one more page table level in places where we deal with pud_t. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
048456dcf2
commit
c2febafc67
23 changed files with 595 additions and 120 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <asm/pgtable.h>
|
||||
|
||||
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
|
||||
static int __read_mostly ioremap_p4d_capable;
|
||||
static int __read_mostly ioremap_pud_capable;
|
||||
static int __read_mostly ioremap_pmd_capable;
|
||||
static int __read_mostly ioremap_huge_disabled;
|
||||
|
@ -35,6 +36,11 @@ void __init ioremap_huge_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
static inline int ioremap_p4d_enabled(void)
|
||||
{
|
||||
return ioremap_p4d_capable;
|
||||
}
|
||||
|
||||
static inline int ioremap_pud_enabled(void)
|
||||
{
|
||||
return ioremap_pud_capable;
|
||||
|
@ -46,6 +52,7 @@ static inline int ioremap_pmd_enabled(void)
|
|||
}
|
||||
|
||||
#else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
|
||||
static inline int ioremap_p4d_enabled(void) { return 0; }
|
||||
static inline int ioremap_pud_enabled(void) { return 0; }
|
||||
static inline int ioremap_pmd_enabled(void) { return 0; }
|
||||
#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
|
||||
|
@ -94,14 +101,14 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
|
||||
static inline int ioremap_pud_range(p4d_t *p4d, unsigned long addr,
|
||||
unsigned long end, phys_addr_t phys_addr, pgprot_t prot)
|
||||
{
|
||||
pud_t *pud;
|
||||
unsigned long next;
|
||||
|
||||
phys_addr -= addr;
|
||||
pud = pud_alloc(&init_mm, pgd, addr);
|
||||
pud = pud_alloc(&init_mm, p4d, addr);
|
||||
if (!pud)
|
||||
return -ENOMEM;
|
||||
do {
|
||||
|
@ -120,6 +127,32 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int ioremap_p4d_range(pgd_t *pgd, unsigned long addr,
|
||||
unsigned long end, phys_addr_t phys_addr, pgprot_t prot)
|
||||
{
|
||||
p4d_t *p4d;
|
||||
unsigned long next;
|
||||
|
||||
phys_addr -= addr;
|
||||
p4d = p4d_alloc(&init_mm, pgd, addr);
|
||||
if (!p4d)
|
||||
return -ENOMEM;
|
||||
do {
|
||||
next = p4d_addr_end(addr, end);
|
||||
|
||||
if (ioremap_p4d_enabled() &&
|
||||
((next - addr) == P4D_SIZE) &&
|
||||
IS_ALIGNED(phys_addr + addr, P4D_SIZE)) {
|
||||
if (p4d_set_huge(p4d, phys_addr + addr, prot))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ioremap_pud_range(p4d, addr, next, phys_addr + addr, prot))
|
||||
return -ENOMEM;
|
||||
} while (p4d++, addr = next, addr != end);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ioremap_page_range(unsigned long addr,
|
||||
unsigned long end, phys_addr_t phys_addr, pgprot_t prot)
|
||||
{
|
||||
|
@ -135,7 +168,7 @@ int ioremap_page_range(unsigned long addr,
|
|||
pgd = pgd_offset_k(addr);
|
||||
do {
|
||||
next = pgd_addr_end(addr, end);
|
||||
err = ioremap_pud_range(pgd, addr, next, phys_addr+addr, prot);
|
||||
err = ioremap_p4d_range(pgd, addr, next, phys_addr+addr, prot);
|
||||
if (err)
|
||||
break;
|
||||
} while (pgd++, addr = next, addr != end);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue