[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/25] i386/kvm: hv-stimer requires hv-time and hv-sy
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 08/25] i386/kvm: hv-stimer requires hv-time and hv-synic |
Date: |
Fri, 21 Jun 2019 03:42:13 +0200 |
From: Vitaly Kuznetsov <address@hidden>
Synthetic timers operate in hv-time time and Windows won't use these
without SynIC.
Add .dependencies field to kvm_hyperv_properties[] and a generic mechanism
to check dependencies between features.
Signed-off-by: Vitaly Kuznetsov <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target/i386/kvm.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 93ac6ba..58afa31 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -689,6 +689,7 @@ static struct {
uint32_t fw;
uint32_t bits;
} flags[2];
+ uint64_t dependencies;
} kvm_hyperv_properties[] = {
[HYPERV_FEAT_RELAXED] = {
.desc = "relaxed timing (hv-relaxed)",
@@ -756,7 +757,8 @@ static struct {
.flags = {
{.fw = FEAT_HYPERV_EAX,
.bits = HV_SYNTIMERS_AVAILABLE}
- }
+ },
+ .dependencies = BIT(HYPERV_FEAT_SYNIC) | BIT(HYPERV_FEAT_TIME)
},
[HYPERV_FEAT_FREQUENCIES] = {
.desc = "frequency MSRs (hv-frequencies)",
@@ -986,12 +988,25 @@ static int hv_cpuid_check_and_set(CPUState *cs, struct
kvm_cpuid2 *cpuid,
X86CPU *cpu = X86_CPU(cs);
CPUX86State *env = &cpu->env;
uint32_t r, fw, bits;
- int i;
+ uint64_t deps;
+ int i, dep_feat = 0;
if (!hyperv_feat_enabled(cpu, feature) && !cpu->hyperv_passthrough) {
return 0;
}
+ deps = kvm_hyperv_properties[feature].dependencies;
+ while ((dep_feat = find_next_bit(&deps, 64, dep_feat)) < 64) {
+ if (!(hyperv_feat_enabled(cpu, dep_feat))) {
+ fprintf(stderr,
+ "Hyper-V %s requires Hyper-V %s\n",
+ kvm_hyperv_properties[feature].desc,
+ kvm_hyperv_properties[dep_feat].desc);
+ return 1;
+ }
+ dep_feat++;
+ }
+
for (i = 0; i < ARRAY_SIZE(kvm_hyperv_properties[feature].flags); i++) {
fw = kvm_hyperv_properties[feature].flags[i].fw;
bits = kvm_hyperv_properties[feature].flags[i].bits;
@@ -1107,11 +1122,11 @@ static int hyperv_handle_properties(CPUState *cs,
r |= hv_cpuid_check_and_set(cs, cpuid, HYPERV_FEAT_EVMCS);
r |= hv_cpuid_check_and_set(cs, cpuid, HYPERV_FEAT_IPI);
- /* Dependencies */
+ /* Additional dependencies not covered by kvm_hyperv_properties[] */
if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNIC) &&
!cpu->hyperv_synic_kvm_only &&
!hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX)) {
- fprintf(stderr, "Hyper-V %s requires %s\n",
+ fprintf(stderr, "Hyper-V %s requires Hyper-V %s\n",
kvm_hyperv_properties[HYPERV_FEAT_SYNIC].desc,
kvm_hyperv_properties[HYPERV_FEAT_VPINDEX].desc);
r |= 1;
--
1.8.3.1
- [Qemu-devel] [PULL 00/25] Misc (mostly x86) patches for 2019-06-21, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 01/25] kvm-all: Add/update fprintf's for kvm_*_ioeventfd_del, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 02/25] hax: Honor CPUState::halted, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 03/25] i386/kvm: convert hyperv enlightenments properties from bools to bits, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 06/25] i386/kvm: document existing Hyper-V enlightenments, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 04/25] i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 05/25] i386/kvm: move Hyper-V CPUID filling to hyperv_handle_properties(), Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 08/25] i386/kvm: hv-stimer requires hv-time and hv-synic,
Paolo Bonzini <=
- [Qemu-devel] [PULL 09/25] i386/kvm: hv-tlbflush/ipi require hv-vpindex, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 10/25] i386/kvm: hv-evmcs requires hv-vapic, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 16/25] target/i386: kvm: Re-inject #DB to guest with updated DR6, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 24/25] util/main-loop: Fix incorrect assertion, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 23/25] sd: Fix out-of-bounds assertions, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 14/25] KVM: Introduce kvm_arch_destroy_vcpu(), Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 13/25] target/i386: kvm: Delete VMX migration blocker on vCPU init failure, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 15/25] target/i386: kvm: Use symbolic constant for #DB/#BP exception constants, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 11/25] i386/kvm: add support for Direct Mode for Hyper-V synthetic timers, Paolo Bonzini, 2019/06/20
- [Qemu-devel] [PULL 12/25] target/i386: define a new MSR based feature word - FEAT_CORE_CAPABILITY, Paolo Bonzini, 2019/06/20