kvm: arm64: Allow tuning the physical address size for VM
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 26 Sep 2018 16:32:54 +0000 (17:32 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Wed, 3 Oct 2018 10:45:20 +0000 (11:45 +0100)
commit233a7cb235318223df8133235383f4c595c654c1
tree04f9ed017c9cf6463f7bcf95801b8e070da0b7ef
parent58b3efc820acd3219e89ff014e93346a734229b8
kvm: arm64: Allow tuning the physical address size for VM

Allow specifying the physical address size limit for a new
VM via the kvm_type argument for the KVM_CREATE_VM ioctl. This
allows us to finalise the stage2 page table as early as possible
and hence perform the right checks on the memory slots
without complication. The size is encoded as Log2(PA_Size) in
bits[7:0] of the type field. For backward compatibility the
value 0 is reserved and implies 40bits. Also, lift the limit
of the IPA to host limit and allow lower IPA sizes (e.g, 32).

The userspace could check the extension KVM_CAP_ARM_VM_IPA_SIZE
for the availability of this feature. The cap check returns the
maximum limit for the physical address shift supported by the host.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <cdall@kernel.org>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Documentation/virtual/kvm/api.txt
arch/arm64/include/asm/stage2_pgtable.h
arch/arm64/kvm/reset.c
include/uapi/linux/kvm.h