Thread (10 messages) 10 messages, 4 authors, 2021-03-09

Re: [PATCH] KVM: arm64: Cap default IPA size to the host's own size

From: Will Deacon <will@kernel.org>
Date: 2021-03-09 11:42:30
Also in: kvm, kvmarm

On Tue, Mar 09, 2021 at 11:35:54AM +0000, Marc Zyngier wrote:
On Tue, 09 Mar 2021 11:26:59 +0000,
Will Deacon [off-list ref] wrote:
quoted
On Mon, Mar 08, 2021 at 05:46:43PM +0000, Marc Zyngier wrote:
quoted
KVM/arm64 has forever used a 40bit default IPA space, partially
due to its 32bit heritage (where the only choice is 40bit).

However, there are implementations in the wild that have a *cough*
much smaller *cough* IPA space, which leads to a misprogramming of
VTCR_EL2, and a guest that is stuck on its first memory access
if userspace dares to ask for the default IPA setting (which most
VMMs do).

Instead, cap the default IPA size to what the host can actually
do, and spit out a one-off message on the console. The boot warning
is turned into a more meaningfull message, and the new behaviour
is also documented.

Although this is a userspace ABI change, it doesn't really change
much for userspace:

- the guest couldn't run before this change, while it now has
  a chance to if the memory range fits the reduced IPA space

- a memory slot that was accepted because it did fit the default
  IPA space but didn't fit the HW constraints is now properly
  rejected

The other thing that's left doing is to convince userspace to
actually use the IPA space setting instead of relying on the
antiquated default.
Is there a way for userspace to discover the default IPA size, or does
it have to try setting values until it finds one that sticks?
Yes, since 233a7cb23531 ("kvm: arm64: Allow tuning the physical
address size for VM").

The VMM can issue a KVM_CAP_ARM_VM_IPA_SIZE ioctl(), and get in return
the maximum IPA size (I have a patch for kvmtool that does this).
Great, thanks -- that's exactly what I was thinking about when I asked the
question!

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help