Skip to content

RFC arm64: Simplify VA space configurations

Ard Biesheuvel linux-arm-kernel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8arm64: Kconfig: force ARM64_PAN=y when enabling TTBR0 sw PANarch/arm64/Kconfig+2 -40 replies
2/8arm64: Kconfig: fix ARCH_MMAP_RND_BITS_MAX for 52-bit virtual addressingarch/arm64/Kconfig+3 -70 replies
3/8arm64: Kconfig: eliminate 64k/48-bit VA combinationarch/arm64/Kconfig arch/arm64/mm/pgd.c+8 -60 replies
4/8arm64: Kconfig: eliminate 4k/48-bit VA combinationarch/arm64/Kconfig+3 -40 replies
5/8arm64/Kconfig: Drop support for 47-bit virtual addressingarch/arm64/Kconfig+2 -80 replies
6/8arm64/Kconfig: Drop support for 48-bit virtual addressingarch/arm64/Kconfig+2 -70 replies
7/8arm64/mm: Use reduced VA sizes (36/39/42 bits) only for user spacearch/arm64/Kconfig arch/arm64/include/asm/assembler.h arch/arm64/include/asm/memory.h +6 more+31 -512 replies
8/8arm64/mm: Account for reduced VA sizes in T0SZ and skip the levelsarch/arm64/include/asm/mmu_context.h+8 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/8] arm64: Simplify VA space configurations

From: Ard Biesheuvel <[email protected]>

For historical reasons, we currently support many combinations of page size and virtual address space size:
- the original arm64 port used only 3 levels of paging (4k/39 bits), and the 4 level configuration was only added later
- LVA support on 64k pages could not be disabled at boot, and so it was added as a completely separate configuration, even though the number of translation levels is the same
- 16k pages gains only 1 bit of VA space when going from 3 to 4 levels of translation, and so both are supported
- 16k/36 bits is supported under CONFIG_EXPERT, but 36 bits is a bit on the small side for the kernel.

Let's simplify this, by
- removing the configurations that are also the fallbacks on LPA/LPA2 capable hardware,
- converting 36, 42 and 39 bit configurations into reduced definitions of TASK_SIZE, while keeping the larger VA space on the kernel side,
- dropping 16k/48 bits altogether.

The remaining configurations always support up to 52-bit virtual addressing on the kernel side, and implement the reduced userland VA space sizes by skipping levels when programming TTBR0_EL1. This is a quick and dirty hack, but sufficient for the purposes of this RFC.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Anshuman Khandual <[email protected]>
Cc Kees Cook <[email protected]>

Ard Biesheuvel (8):
arm64/Kconfig: force ARM64_PAN=y when enabling TTBR0 sw PAN arm64/Kconfig: fix ARCH_MMAP_RND_BITS_MAX for 52-bit virtual
addressing
arm64/Kconfig: eliminate 64k/48-bit VA combination arm64/Kconfig: eliminate 4k/48-bit VA combination arm64/Kconfig: Drop support for 47-bit virtual addressing arm64/Kconfig: Drop support for 48-bit virtual addressing arm64/mm: Use reduced VA sizes (36/39/42 bits) only for user space arm64/mm: Account for reduced VA sizes in T0SZ and skip the levels

 arch/arm64/Kconfig                     | 89 ++++++++------------
 arch/arm64/include/asm/assembler.h     |  2 +-
 arch/arm64/include/asm/memory.h        |  4 -
 arch/arm64/include/asm/mmu_context.h   |  9 +-
 arch/arm64/include/asm/pgtable-hwdef.h |  2 -
 arch/arm64/include/asm/processor.h     |  6 +-
 arch/arm64/kernel/cpufeature.c         |  2 -
 arch/arm64/kernel/head.S               |  4 -
 arch/arm64/mm/init.c                   |  4 +-
 arch/arm64/mm/pgd.c                    |  9 +-
 arch/arm64/mm/proc.S                   |  2 -
 11 files changed, 52 insertions(+), 81 deletions(-)
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog