[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 21/22] i386: record if Hyper-V features were already expanded
From: |
Vitaly Kuznetsov |
Subject: |
[PATCH RFC 21/22] i386: record if Hyper-V features were already expanded |
Date: |
Fri, 4 Sep 2020 16:54:30 +0200 |
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(+)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 0aad60e0c707..c72755139047 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -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;
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 0945983498b2..961241528a5c 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -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);
--
2.25.4
- [PATCH RFC 12/22] i386: always fill Hyper-V CPUID feature leaves from X86CPU data, (continued)
- [PATCH RFC 12/22] i386: always fill Hyper-V CPUID feature leaves from X86CPU data, Vitaly Kuznetsov, 2020/09/04
- [PATCH RFC 15/22] i386: switch hyperv_expand_features() to using error_setg(), Vitaly Kuznetsov, 2020/09/04
- [PATCH RFC 18/22] i386: prefer system KVM_GET_SUPPORTED_HV_CPUID ioctl over vCPU's one, Vitaly Kuznetsov, 2020/09/04
- [PATCH RFC 22/22] i386: expand Hyper-V features early, Vitaly Kuznetsov, 2020/09/04
- [PATCH RFC 21/22] i386: record if Hyper-V features were already expanded,
Vitaly Kuznetsov <=
- [PATCH RFC 19/22] i386: prepare hyperv_expand_features() to be called at CPU feature expansion time, Vitaly Kuznetsov, 2020/09/04
- [PATCH RFC 16/22] i386: make hyperv_expand_features() return void, Vitaly Kuznetsov, 2020/09/04
- [PATCH RFC 17/22] i386: adjust the expected KVM_GET_SUPPORTED_HV_CPUID array size, Vitaly Kuznetsov, 2020/09/04
- [PATCH RFC 20/22] i386: use global kvm_state in hyperv_enabled() check, Vitaly Kuznetsov, 2020/09/04