[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 02/19] i386: introduce kvm_hv_evmcs_available()
From: |
Vitaly Kuznetsov |
Subject: |
[PATCH v3 02/19] i386: introduce kvm_hv_evmcs_available() |
Date: |
Thu, 7 Jan 2021 16:06:23 +0100 |
Enlightened VMCS feature is hardware specific, it is only supported on
Intel CPUs. Introduce a simple kvm_hv_evmcs_available() helper, it will
be used to filter out 'hv_evmcs' when 'hyperv=on' option is added to
X86MachineClass.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
target/i386/kvm/kvm-stub.c | 5 +++++
target/i386/kvm/kvm.c | 8 ++++++++
target/i386/kvm/kvm_i386.h | 1 +
3 files changed, 14 insertions(+)
diff --git a/target/i386/kvm/kvm-stub.c b/target/i386/kvm/kvm-stub.c
index 92f49121b8fa..0a163ae207c5 100644
--- a/target/i386/kvm/kvm-stub.c
+++ b/target/i386/kvm/kvm-stub.c
@@ -39,3 +39,8 @@ bool kvm_hv_vpindex_settable(void)
{
return false;
}
+
+bool kvm_hv_evmcs_available(void)
+{
+ return false;
+}
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 6dc1ee052d5f..edaaed56c6e2 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -95,6 +95,7 @@ static bool has_msr_hv_crash;
static bool has_msr_hv_reset;
static bool has_msr_hv_vpindex;
static bool hv_vpindex_settable;
+static bool hv_evmcs_available;
static bool has_msr_hv_runtime;
static bool has_msr_hv_synic;
static bool has_msr_hv_stimer;
@@ -192,6 +193,11 @@ bool kvm_hv_vpindex_settable(void)
return hv_vpindex_settable;
}
+bool kvm_hv_evmcs_available(void)
+{
+ return hv_evmcs_available;
+}
+
static int kvm_get_tsc(CPUState *cs)
{
X86CPU *cpu = X86_CPU(cs);
@@ -2146,6 +2152,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
has_pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
hv_vpindex_settable = kvm_check_extension(s, KVM_CAP_HYPERV_VP_INDEX);
+ hv_evmcs_available =
+ kvm_check_extension(s, KVM_CAP_HYPERV_ENLIGHTENED_VMCS);
has_exception_payload = kvm_check_extension(s, KVM_CAP_EXCEPTION_PAYLOAD);
if (has_exception_payload) {
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index dc725083891c..08968cfb33f1 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -47,6 +47,7 @@ bool kvm_has_x2apic_api(void);
bool kvm_has_waitpkg(void);
bool kvm_hv_vpindex_settable(void);
+bool kvm_hv_evmcs_available(void);
uint64_t kvm_swizzle_msi_ext_dest_id(uint64_t address);
--
2.29.2
- [PATCH v3 00/19] i386: KVM: expand Hyper-V features early and provide simple 'hv-default=on' option, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 01/19] linux-headers: update against 5.11-rc2, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 02/19] i386: introduce kvm_hv_evmcs_available(),
Vitaly Kuznetsov <=
- [PATCH v3 04/19] i386: invert hyperv_spinlock_attempts setting logic with hv_passthrough, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 03/19] i386: keep hyperv_vendor string up-to-date, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 05/19] i386: always fill Hyper-V CPUID feature leaves from X86CPU data, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 06/19] i386: stop using env->features[] for filling Hyper-V CPUIDs, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 07/19] i386: introduce hyperv_feature_supported(), Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 08/19] i386: introduce hv_cpuid_get_host(), Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 09/19] i386: drop FEAT_HYPERV feature leaves, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 10/19] i386: introduce hv_cpuid_cache, Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 11/19] i386: split hyperv_handle_properties() into hyperv_expand_features()/hyperv_fill_cpuids(), Vitaly Kuznetsov, 2021/01/07
- [PATCH v3 12/19] i386: move eVMCS enablement to hyperv_init_vcpu(), Vitaly Kuznetsov, 2021/01/07