RFC KVM: arm64: Use TTBR1_EL2 for hVHE runtime mappings
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest5 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | KVM: arm64: Make hyp symbol address conversion explicitarch/ arch/ arch/ +1 more | +53 | 0 replies | |
| 2/5 | KVM: arm64: Split hyp mapping APIs by address typearch/ arch/ arch/ +5 more | +122 | 0 replies | |
| 3/5 | KVM: arm64: Split hyp VA-to-PA conversion by address typearch/ arch/ arch/ +9 more | +49 | 0 replies | |
| 4/5 | KVM: arm64: Rename the hyp private VA allocation basearch/ | +16 | 0 replies | |
| 5/5 | KVM: arm64: Use TTBR1_EL2 for hVHE runtime mappingsarch/ arch/ arch/ +12 more | +328 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/5] KVM: arm64: Use TTBR1_EL2 for hVHE runtime mappings
hVHE currently disables TTBR1_EL2 and places both the identity mapping and the hyp runtime mappings in TTBR0_EL2. As a result, it continues to use the legacy nVHE virtual-address layout even though hVHE uses the EL2&0 translation regime and can retain canonical kernel-image addresses.
This series moves the hVHE runtime mappings to TTBR1_EL2 and reserves TTBR0_EL2 for the identity mapping used during MMU and page-table transitions. Conventional VHE is unaffected, and nVHE continues to use the existing TTBR0-only layout, including when protected mode is enabled.
The existing code does not consistently distinguish kernel-image symbols from linear-map addresses because both currently use the same EL2 address transformation. The first four patches make this distinction explicit by:
- adding helpers for kernel-image symbol addresses;
- splitting the hyp mapping APIs by address type;
- providing separate symbol and linear VA-to-PA conversions; and
- clarifying the private hyp VA allocation terminology.
The final patch implements the TTBR1 layout. Hyp symbols retain their linked kernel-image VAs, while pools, per-CPU regions, SVE state and shared memory continue to use linear-map addresses. A separate TTBR0 page table contains the idmap, and both roots are installed during initial EL2 setup and pKVM finalization.
The resulting layouts are:
nVHE:
TTBR0_EL2: idmap and runtime mappings
TTBR1_EL2: unused
hVHE:
TTBR0_EL2: idmap
TTBR1_EL2: runtime mappings
Aneesh Kumar K.V (Arm) (5):
KVM: arm64: Make hyp symbol address conversion explicit
KVM: arm64: Split hyp mapping APIs by address type
KVM: arm64: Split hyp VA-to-PA conversion by address type
KVM: arm64: Rename the hyp private VA allocation base
KVM: arm64: Use TTBR1_EL2 for hVHE runtime mappings
arch/arm64/include/asm/kvm_asm.h | 13 +-- arch/arm64/include/asm/kvm_host.h | 2 + arch/arm64/include/asm/kvm_hyp.h | 4 +- arch/arm64/include/asm/kvm_mmu.h | 89 ++++++++++++++-- arch/arm64/include/asm/kvm_pgtable.h | 27 +++++ arch/arm64/include/asm/kvm_pkvm.h | 3 + arch/arm64/kernel/asm-offsets.c | 5 +- arch/arm64/kvm/arm.c | 92 +++++++++------- arch/arm64/kvm/hyp/include/nvhe/memory.h | 13 +-- arch/arm64/kvm/hyp/include/nvhe/mm.h | 9 +- arch/arm64/kvm/hyp/nvhe/early_alloc.c | 1 + arch/arm64/kvm/hyp/nvhe/events.c | 2 +- arch/arm64/kvm/hyp/nvhe/host.S | 4 +- arch/arm64/kvm/hyp/nvhe/hyp-init.S | 29 ++++- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 30 +++--- arch/arm64/kvm/hyp/nvhe/mm.c | 110 +++++++++++++------ arch/arm64/kvm/hyp/nvhe/psci-relay.c | 12 +-- arch/arm64/kvm/hyp/nvhe/setup.c | 55 +++++++--- arch/arm64/kvm/hyp/pgtable.c | 62 ++++++++++- arch/arm64/kvm/hyp_trace.c | 2 +- arch/arm64/kvm/mmu.c | 128 ++++++++++++++++------- arch/arm64/kvm/pkvm.c | 3 + arch/arm64/kvm/va_layout.c | 32 +++++- 23 files changed, 546 insertions(+), 181 deletions(-)
base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
Signature · 1 line
2.43.0