[PATCH v5 18/18] kvm: arm64: Allow tuning the physical address size for VM
From: Peter Maydell <hidden>
Date: 2018-09-18 17:15:27
Also in:
kvm, kvmarm, lkml
On 18 September 2018 at 17:27, Suzuki K Poulose [off-list ref] wrote:
---
"On arm64, the physical address size for a VM (IPA Size limit) is limited
to 40bits by default. The limit can be configured if the host supports the
extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use
KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type
identifier, where IPA_Bits is the maximum width of any physical
address used by the VM. The IPA_Bits is encoded in bits[7-0] of the
machine type identifier.
e.g, to configure a guest to use 48bit physical address size :
vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48));
The requested size (IPA_Bits) must be :
0 - Implies default 40bits (for backward compatibility)
or
N - Implies N bits, where N is a positive integer such that 32 <= N <=
Host_IPA_Limit
Host_IPA_Limit is the maximum possible value for IPA_Bits on the host and
is dependent on the CPU capability and the kernel configuration. The limit
can
be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the KVM_CHECK_EXTENSION
ioctl() at run-time.
Please note that configuring the IPA size does not affect the capability
exposed by the guest CPUs in ID_AA64MMFR0_EL1[PARange]. It only affects
the guest to host physical address (stage2) translations setup by the host.
"Thanks, this is much clearer. The only bit I'm not sure about is that last paragraph -- if I ask for a VM with a 48 bit address space why don't we tell the guest that that's what it has ? thanks -- PMM