riscv: Implement sv48 support
authorAlexandre Ghiti <alexandre.ghiti@canonical.com>
Mon, 6 Dec 2021 10:46:51 +0000 (11:46 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 20 Jan 2022 01:54:09 +0000 (17:54 -0800)
commite8a62cc26ddf53a3c6ba2a8d33036cf7b84f3923
tree15b9020880a651c756268a4560b8c6c720fc1031
parent60639f74c2f4fcc3ffa2ac0b120eaa874ccc713f
riscv: Implement sv48 support

By adding a new 4th level of page table, give the possibility to 64bit
kernel to address 2^48 bytes of virtual address: in practice, that offers
128TB of virtual address space to userspace and allows up to 64TB of
physical memory.

If the underlying hardware does not support sv48, we will automatically
fallback to a standard 3-level page table by folding the new PUD level into
PGDIR level. In order to detect HW capabilities at runtime, we
use SATP feature that ignores writes with an unsupported mode.

Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
13 files changed:
arch/riscv/Kconfig
arch/riscv/include/asm/csr.h
arch/riscv/include/asm/fixmap.h
arch/riscv/include/asm/kasan.h
arch/riscv/include/asm/page.h
arch/riscv/include/asm/pgalloc.h
arch/riscv/include/asm/pgtable-64.h
arch/riscv/include/asm/pgtable.h
arch/riscv/kernel/head.S
arch/riscv/mm/context.c
arch/riscv/mm/init.c
arch/riscv/mm/kasan_init.c
drivers/firmware/efi/libstub/efi-stub.c