@@ -1669,6 +1669,7 @@ struct X86CPU {
uint32_t hyperv_interface_id[4];
uint32_t hyperv_version_id[4];
uint32_t hyperv_limits[3];
+ bool hyperv_features_expaned;
bool check_cpuid;
bool enforce_cpuid;
@@ -1225,6 +1225,10 @@ static void hyperv_expand_features(CPUState *cs, Error **errp)
if (!hyperv_enabled(cpu))
return;
+ if (cpu->hyperv_features_expaned) {
+ return;
+ }
+
if (kvm_check_extension(kvm_state, KVM_CAP_HYPERV_CPUID) > 0) {
cpuid = get_supported_hv_cpuid(cs);
} else {
@@ -1361,6 +1365,8 @@ static void hyperv_expand_features(CPUState *cs, Error **errp)
/* Not exposed by KVM but needed to make CPU hotplug in Windows work */
env->features[FEAT_HYPERV_EDX] |= HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE;
+ cpu->hyperv_features_expaned = true;
+
out:
g_free(cpuid);
Introduce a per cpu hyperv_features_expaned flag indicating that Hyper-V related CPUIDs were already acquired from KVM. We are going to start doing the expansion prior to creating KVM vCPU but in case KVM doesn't support sustem wide KVM_GET_SUPPORTED_HV_CPUID ioctl this can't happen. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- target/i386/cpu.h | 1 + target/i386/kvm.c | 6 ++++++ 2 files changed, 7 insertions(+)