[PATCH v2 0/1] KVM: arm64: Calculate hyp VA size only once

Petteri Kangaslampi posted 1 patch 3 weeks, 4 days ago
arch/arm64/include/asm/kvm_mmu.h |  3 ++-
arch/arm64/kvm/arm.c             |  4 ++--
arch/arm64/kvm/mmu.c             | 28 ++++-----------------------
arch/arm64/kvm/va_layout.c       | 33 +++++++++++++++++++++++++++-----
4 files changed, 36 insertions(+), 32 deletions(-)
[PATCH v2 0/1] KVM: arm64: Calculate hyp VA size only once
Posted by Petteri Kangaslampi 3 weeks, 4 days ago
All,

Here's a reworked fix to keep VA size calculations consistent between
the MMU and layout initialization code paths.

Previously, if the kernel was configured with a VA size of less than
48 bits (like happens in our environment), the assumptions used to
calculate hyp_physvirt_offset in kvm_compute_layout() and the code
that determines the VA size used in the rest of the system (calculated
in kvm_mmu_init()) would get out of sync. This could eventually result
in mapping failures.

The patch here is against 6.19-rc4 and tested in default, nVHE, and pKVM
configurations thanks to help from Vincent Donnefort. Detailed
knowledge of the address map remains somewhat distributed inside the
codebase, but at least everything now uses the same VA size, and
further refactoring is probably best done if/when Will's pKVM changes
have been merged.

Petteri Kangaslampi (1):
  KVM: arm64: Calculate hyp VA size only once

 arch/arm64/include/asm/kvm_mmu.h |  3 ++-
 arch/arm64/kvm/arm.c             |  4 ++--
 arch/arm64/kvm/mmu.c             | 28 ++++-----------------------
 arch/arm64/kvm/va_layout.c       | 33 +++++++++++++++++++++++++++-----
 4 files changed, 36 insertions(+), 32 deletions(-)

-- 
2.52.0.457.g6b5491de43-goog
Re: [PATCH v2 0/1] KVM: arm64: Calculate hyp VA size only once
Posted by Marc Zyngier 3 weeks, 3 days ago
On Tue, 13 Jan 2026 19:44:08 +0000, Petteri Kangaslampi wrote:
> All,
> 
> Here's a reworked fix to keep VA size calculations consistent between
> the MMU and layout initialization code paths.
> 
> Previously, if the kernel was configured with a VA size of less than
> 48 bits (like happens in our environment), the assumptions used to
> calculate hyp_physvirt_offset in kvm_compute_layout() and the code
> that determines the VA size used in the rest of the system (calculated
> in kvm_mmu_init()) would get out of sync. This could eventually result
> in mapping failures.
> 
> [...]

Applied to next, thanks!

[1/1] KVM: arm64: Calculate hyp VA size only once
      commit: 8e8eb10c107e67f22f87cd8c963d30ea73f04d5f

Cheers,

	M.
-- 
Without deviation from the norm, progress is not possible.