@@ -173,6 +173,16 @@ without the feature to find out if enabling it is beneficial.
Requires: hv-vapic
+3.17. hv-stimer-direct
+=======================
+Hyper-V specification allows synthetic timer operation in two modes: "classic",
+when expiration event is delivered as SynIC message and "direct", when the event
+is delivered via normal interrupt. It is known that nested Hyper-V can only
+use synthetic timers in direct mode and thus 'hv-stimer-direct' needs to be
+enabled.
+
+Requires: hv-vpindex, hv-synic, hv-time, hv-stimer
+
4. Development features
========================
@@ -5785,6 +5785,7 @@ static Property x86_cpu_properties[] = {
DEFINE_PROP_BOOL("hv-tlbflush", X86CPU, hyperv_tlbflush, false),
DEFINE_PROP_BOOL("hv-evmcs", X86CPU, hyperv_evmcs, false),
DEFINE_PROP_BOOL("hv-ipi", X86CPU, hyperv_ipi, false),
+ DEFINE_PROP_BOOL("hv-stimer-direct", X86CPU, hyperv_stimer_direct, false),
DEFINE_PROP_BOOL("hv-all", X86CPU, hyperv_all, false),
DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true),
DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false),
@@ -1396,6 +1396,7 @@ struct X86CPU {
bool hyperv_tlbflush;
bool hyperv_evmcs;
bool hyperv_ipi;
+ bool hyperv_stimer_direct;
bool hyperv_all;
bool check_cpuid;
bool enforce_cpuid;
@@ -49,6 +49,7 @@
#define HV_GUEST_IDLE_STATE_AVAILABLE (1u << 5)
#define HV_FREQUENCY_MSRS_AVAILABLE (1u << 8)
#define HV_GUEST_CRASH_MSR_AVAILABLE (1u << 10)
+#define HV_STIMER_DIRECT_MODE_AVAILABLE (1u << 19)
/*
* HV_CPUID_ENLIGHTMENT_INFO.EAX bits
@@ -657,6 +657,7 @@ static bool hyperv_enabled(X86CPU *cpu)
cpu->hyperv_reenlightenment ||
cpu->hyperv_tlbflush ||
cpu->hyperv_ipi ||
+ cpu->hyperv_stimer_direct ||
cpu->hyperv_all);
}
@@ -832,6 +833,15 @@ static struct {
{0}
}
},
+ {
+ .name = "hv-stimer-direct",
+ .desc = "direct mode timers",
+ .flags = {
+ {.fw = FEAT_HYPERV_EDX,
+ .bits = HV_STIMER_DIRECT_MODE_AVAILABLE},
+ {0}
+ }
+ },
};
static struct kvm_cpuid2 *try_get_hv_cpuid(CPUState *cs, int max)
@@ -1178,6 +1188,8 @@ static int hyperv_handle_properties(CPUState *cs,
r |= hv_cpuid_check_and_set(cs, cpuid, "hv-tlbflush",
&cpu->hyperv_tlbflush);
r |= hv_cpuid_check_and_set(cs, cpuid, "hv-ipi", &cpu->hyperv_ipi);
+ r |= hv_cpuid_check_and_set(cs, cpuid, "hv-stimer-direct",
+ &cpu->hyperv_stimer_direct);
/* Dependencies */
if (cpu->hyperv_synic && !cpu->hyperv_synic_kvm_only &&
@@ -1198,6 +1210,9 @@ static int hyperv_handle_properties(CPUState *cs,
if (cpu->hyperv_ipi && !cpu->hyperv_vpindex) {
r |= hv_report_missing_dep(cpu, "hv-ipi", "hv-vpindex");
}
+ if (cpu->hyperv_stimer_direct && !cpu->hyperv_stimer) {
+ r |= hv_report_missing_dep(cpu, "hv-stimer-direct", "hv-stimer");
+ }
/* Not exposed by KVM but needed to make CPU hotplug in Windows work */
env->features[FEAT_HYPERV_EDX] |= HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE;
Hyper-V on KVM can only use Synthetic timers with Direct Mode (opting for an interrupt instead of VMBus message). This new capability is only announced in KVM_GET_SUPPORTED_HV_CPUID. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- docs/hyperv.txt | 10 ++++++++++ target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + target/i386/hyperv-proto.h | 1 + target/i386/kvm.c | 15 +++++++++++++++ 5 files changed, 28 insertions(+)