@@ -39,3 +39,8 @@ bool kvm_hv_vpindex_settable(void)
{
return false;
}
+
+bool kvm_hv_evmcs_available(void)
+{
+ return false;
+}
@@ -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);
@@ -2124,6 +2130,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) {
@@ -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);
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-stub.c | 5 +++++ target/i386/kvm.c | 8 ++++++++ target/i386/kvm_i386.h | 1 + 3 files changed, 14 insertions(+)