RISC-V: Add Sv57 page table support
authorPalmer Dabbelt <palmer@rivosinc.com>
Tue, 22 Feb 2022 17:40:52 +0000 (09:40 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Tue, 22 Feb 2022 17:40:52 +0000 (09:40 -0800)
This implements Sv57 support at runtime. The kernel will try to boot
with 5-level page table firstly , and will fallback to 4-level if the HW
does not support it. And it will finally fallback to 3-level if the HW
alse does not support sv48.

* riscv-sv57:
  riscv: mm: Support kasan for sv57
  riscv: mm: Set sv57 on defaultly
  riscv: mm: Prepare pt_ops helper functions for sv57
  riscv: mm: Control p4d's folding by pgtable_l5_enabled

1  2 
arch/riscv/mm/init.c

@@@ -38,9 -38,9 +38,9 @@@ EXPORT_SYMBOL(kernel_map)
  #endif
  
  #ifdef CONFIG_64BIT
- u64 satp_mode __ro_after_init = !IS_ENABLED(CONFIG_XIP_KERNEL) ? SATP_MODE_48 : SATP_MODE_39;
 -u64 satp_mode = !IS_ENABLED(CONFIG_XIP_KERNEL) ? SATP_MODE_57 : SATP_MODE_39;
++u64 satp_mode __ro_after_init = !IS_ENABLED(CONFIG_XIP_KERNEL) ? SATP_MODE_57 : SATP_MODE_39;
  #else
 -u64 satp_mode = SATP_MODE_32;
 +u64 satp_mode __ro_after_init = SATP_MODE_32;
  #endif
  EXPORT_SYMBOL(satp_mode);