[PATCH v2 0/4] Add Sv57 page table support

panqinglin2020 at iscas.ac.cn panqinglin2020 at iscas.ac.cn
Wed Jan 26 18:48:40 PST 2022


From: Qinglin Pan <panqinglin2020 at iscas.ac.cn>

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.

Tested on:
 - qemu rv64
 - qemu rv64 with CONFIG_KASAN and CONFIG_KASAN_VMALLOC on.
 - qemu rv32
 - sifive unmatched with CONFIG_KASAN and CONFIG_KASAN_VMALLOC on.

Changes in v2:
  - Fix KASAN for sv57, thanks to Alex

Qinglin Pan (4):
  riscv: mm: Control p4d's folding by pgtable_l5_enabled
  riscv: mm: Prepare pt_ops helper functions for sv57
  riscv: mm: Set sv57 on defaultly
  riscv: mm: Support kasan for sv57

 arch/riscv/Kconfig                  |   4 +-
 arch/riscv/include/asm/csr.h        |   1 +
 arch/riscv/include/asm/fixmap.h     |   1 +
 arch/riscv/include/asm/page.h       |   1 +
 arch/riscv/include/asm/pgalloc.h    |  49 ++++++++
 arch/riscv/include/asm/pgtable-64.h | 106 +++++++++++++++++-
 arch/riscv/include/asm/pgtable.h    |   6 +-
 arch/riscv/kernel/cpu.c             |   4 +-
 arch/riscv/mm/init.c                | 166 ++++++++++++++++++++++++----
 arch/riscv/mm/kasan_init.c          | 155 +++++++++++++++++++++++---
 10 files changed, 451 insertions(+), 42 deletions(-)

-- 
2.34.1




More information about the linux-riscv mailing list