linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>,
	 Mark Rutland <mark.rutland@arm.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	 Anshuman Khandual <anshuman.khandual@arm.com>,
	Kees Cook <keescook@chromium.org>
Subject: [RFC PATCH 0/8] arm64: Simplify VA space configurations
Date: Wed, 30 Oct 2024 11:18:04 +0100	[thread overview]
Message-ID: <20241030101803.2037606-10-ardb+git@google.com> (raw)

From: Ard Biesheuvel <ardb@kernel.org>

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 <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Kees Cook <keescook@chromium.org>

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(-)

-- 
2.47.0.163.g1226f6d8fa-goog



             reply	other threads:[~2024-10-30 10:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 10:18 Ard Biesheuvel [this message]
2024-10-30 10:18 ` [RFC PATCH 1/8] arm64: Kconfig: force ARM64_PAN=y when enabling TTBR0 sw PAN Ard Biesheuvel
2024-10-30 10:18 ` [RFC PATCH 2/8] arm64: Kconfig: fix ARCH_MMAP_RND_BITS_MAX for 52-bit virtual addressing Ard Biesheuvel
2024-10-30 10:18 ` [RFC PATCH 3/8] arm64: Kconfig: eliminate 64k/48-bit VA combination Ard Biesheuvel
2024-10-30 10:18 ` [RFC PATCH 4/8] arm64: Kconfig: eliminate 4k/48-bit " Ard Biesheuvel
2024-10-30 10:18 ` [RFC PATCH 5/8] arm64/Kconfig: Drop support for 47-bit virtual addressing Ard Biesheuvel
2024-10-30 10:18 ` [RFC PATCH 6/8] arm64/Kconfig: Drop support for 48-bit " Ard Biesheuvel
2024-10-30 10:18 ` [RFC PATCH 7/8] arm64/mm: Use reduced VA sizes (36/39/42 bits) only for user space Ard Biesheuvel
2024-10-30 12:44   ` Marc Zyngier
2024-10-30 13:25     ` Ard Biesheuvel
2024-10-30 10:18 ` [RFC PATCH 8/8] arm64/mm: Account for reduced VA sizes in T0SZ and skip the levels Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241030101803.2037606-10-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).