linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] KVM: arm64: Fix hyp VA size between layout and MMU
@ 2025-12-23 19:34 Petteri Kangaslampi
  2025-12-23 19:34 ` [PATCH 1/1] " Petteri Kangaslampi
  2025-12-30 15:34 ` [PATCH 0/1] " Marc Zyngier
  0 siblings, 2 replies; 4+ messages in thread
From: Petteri Kangaslampi @ 2025-12-23 19:34 UTC (permalink / raw)
  To: kvmarm
  Cc: Marc Zyngier, Oliver Upton, Vincent Donnefort, Joey Gouly,
	Suzuki K Poulose, Zenghui Yu, Catalin Marinas, Will Deacon,
	linux-arm-kernel, linux-kernel, Petteri Kangaslampi

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

-- 
2.52.0.351.gbe84eed79e-goog



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-30 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23 19:34 [PATCH 0/1] KVM: arm64: Fix hyp VA size between layout and MMU Petteri Kangaslampi
2025-12-23 19:34 ` [PATCH 1/1] " Petteri Kangaslampi
2025-12-30 15:37   ` Marc Zyngier
2025-12-30 15:34 ` [PATCH 0/1] " Marc Zyngier

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