mbox series

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

Message ID 20220127024844.2413385-1-panqinglin2020@iscas.ac.cn (mailing list archive)
Headers show
Series Add Sv57 page table support | expand

Message

Qinglin Pan Jan. 27, 2022, 2:48 a.m. UTC
From: Qinglin Pan <panqinglin2020@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(-)

Comments

Palmer Dabbelt Feb. 22, 2022, 8:28 p.m. UTC | #1
On Wed, 26 Jan 2022 18:48:40 PST (-0800), panqinglin2020@iscas.ac.cn wrote:
> From: Qinglin Pan <panqinglin2020@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(-)

Thanks, this is on for-next.