On arm64, the maximum number of vcpus is constrained by the type of interrupt controller that has been selected (GICv2 imposes a limit of 8 vcpus, while GICv3 currently has a limit of 512). It is thus important to request this limit on the VM file descriptor rather than on the one that corresponds to /dev/kvm, as the latter is likely to return something that doesn't take the constraints into account. Reported-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> --- kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kvm.c b/kvm.c index e327541..3d5173d 100644 --- a/kvm.c +++ b/kvm.c @@ -406,7 +406,7 @@ int kvm__recommended_cpus(struct kvm *kvm) { int ret; - ret = ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS); + ret = ioctl(kvm->vm_fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS); if (ret <= 0) /* * api.txt states that if KVM_CAP_NR_VCPUS does not exist, @@ -421,7 +421,7 @@ int kvm__max_cpus(struct kvm *kvm) { int ret; - ret = ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS); + ret = ioctl(kvm->vm_fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS); if (ret <= 0) ret = kvm__recommended_cpus(kvm); -- 2.26.2 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm