]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Make KVM_CAP_MAX_VCPUS compatible with the selected GIC version
authorMarc Zyngier <maz@kernel.org>
Mon, 27 Apr 2020 14:15:07 +0000 (15:15 +0100)
committerMarc Zyngier <maz@kernel.org>
Sat, 16 May 2020 14:05:02 +0000 (15:05 +0100)
commitc3d0a2d6da9470061c50509d24a9fc1cfd686aa1
tree5b45fc529c5d6a17f0d11e15c9fc3ca87c2a3a08
parentee42fdaccaf7f6a6c3e259e32c0ffd50cd707dd5
KVM: arm64: Make KVM_CAP_MAX_VCPUS compatible with the selected GIC version

KVM_CAP_MAX_VCPUS always return the maximum possible number of
VCPUs, irrespective of the selected interrupt controller. This
is pretty misleading for userspace that selects a GICv2 on a GICv3
system that supports v2 compat: It always gets a maximum of 512
VCPUs, even if the effective limit is 8. The 9th VCPU will fail
to be created, which is unexpected as far as userspace is concerned.

Fortunately, we already have the right information stashed in the
kvm structure, and we can return it as requested.

Reported-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Tested-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20200427141507.284985-1-maz@kernel.org
arch/arm64/kvm/arm.c