]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
kvm: Check KVM_CAP_MAX_VCPUS at vm level
authorXiaoyao Li <xiaoyao.li@intel.com>
Thu, 8 May 2025 14:59:36 +0000 (10:59 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 28 May 2025 17:35:54 +0000 (19:35 +0200)
KVM with TDX support starts to report different KVM_CAP_MAX_VCPUS per
different VM types. So switch to check the KVM_CAP_MAX_VCPUS at vm level.

KVM still returns the global KVM_CAP_MAX_VCPUS when the KVM is old that
doesn't report different value at vm level.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250508150002.689633-31-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/kvm/kvm-all.c

index 42d239cf8f291dd7c8f25565950e012e3f68215b..71e6060458560a03708452a474fcd86d837943d4 100644 (file)
@@ -2431,7 +2431,7 @@ static int kvm_recommended_vcpus(KVMState *s)
 
 static int kvm_max_vcpus(KVMState *s)
 {
-    int ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS);
+    int ret = kvm_vm_check_extension(s, KVM_CAP_MAX_VCPUS);
     return (ret) ? ret : kvm_recommended_vcpus(s);
 }