Skip to content

KVM: arm64: Fix hyp VA size between layout and MMU

Petteri Kangaslampi kvmarm linux-arm-kernel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1KVM: arm64: Fix hyp VA size between layout and MMUarch/arm64/kvm/va_layout.c+12 -51 reply

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/1] KVM: arm64: Fix hyp VA size between layout and MMU

All,

In the KVM initialization code, kvm_mmu_init() and kvm_compute_layout() use different logic when determining the hypervisor's virtual address space size. Specifically, the MMU code uses the larger of vabits_actual (the kernel's VA size) and IDMAP_VA_BITS (48 bits), while the VA layout code just uses the kernel's VA size.

This means that if the kernel is configured with a VA size of less than 48 bits (like happens in our environment), the assumptions used to calculate hyp_physvirt_offset and the code that determines VA ranges to use for mappings in hyp/nvhe/mm.c get out of sync, which can results in mapping failures.

The immediate fix is pretty obvious and attached here. This is against 6.12 but I don't think this code has changed recently. I think longer term refactoring knowledge of the hypervisor's address space into one place might be helpful; currently it is a bit spread out.

Petteri Kangaslampi (1):
KVM: arm64: Fix hyp VA size between layout and MMU

 arch/arm64/kvm/va_layout.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
Signature · 1 line
2.52.0.351.gbe84eed79e-goog