diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2019-05-17 16:19:16 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-06-21 02:29:38 +0200 |
commit | 2d384d7c836142a1ce851442bd6fb8e03a72663a (patch) | |
tree | 44a1634d89d865788ed221f14565b4d47fd66f0a /target/i386/cpu.h | |
parent | 6f38dca615286796df9a967117f3ce42b918c8db (diff) | |
download | qemu-2d384d7c836142a1ce851442bd6fb8e03a72663a.zip qemu-2d384d7c836142a1ce851442bd6fb8e03a72663a.tar.gz qemu-2d384d7c836142a1ce851442bd6fb8e03a72663a.tar.bz2 |
i386/kvm: convert hyperv enlightenments properties from bools to bits
Representing Hyper-V properties as bits will allow us to check features
and dependencies between them in a natural way.
Suggested-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20190517141924.19024-2-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/cpu.h')
-rw-r--r-- | target/i386/cpu.h | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0732e05..30cd1a0 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -734,6 +734,22 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS]; #define MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY (1U << 3) #define MSR_ARCH_CAP_SSB_NO (1U << 4) +/* Supported Hyper-V Enlightenments */ +#define HYPERV_FEAT_RELAXED 0 +#define HYPERV_FEAT_VAPIC 1 +#define HYPERV_FEAT_TIME 2 +#define HYPERV_FEAT_CRASH 3 +#define HYPERV_FEAT_RESET 4 +#define HYPERV_FEAT_VPINDEX 5 +#define HYPERV_FEAT_RUNTIME 6 +#define HYPERV_FEAT_SYNIC 7 +#define HYPERV_FEAT_STIMER 8 +#define HYPERV_FEAT_FREQUENCIES 9 +#define HYPERV_FEAT_REENLIGHTENMENT 10 +#define HYPERV_FEAT_TLBFLUSH 11 +#define HYPERV_FEAT_EVMCS 12 +#define HYPERV_FEAT_IPI 13 + #ifndef HYPERV_SPINLOCK_NEVER_RETRY #define HYPERV_SPINLOCK_NEVER_RETRY 0xFFFFFFFF #endif @@ -1370,23 +1386,11 @@ struct X86CPU { CPUNegativeOffsetState neg; CPUX86State env; - bool hyperv_vapic; - bool hyperv_relaxed_timing; int hyperv_spinlock_attempts; char *hyperv_vendor_id; - bool hyperv_time; - bool hyperv_crash; - bool hyperv_reset; - bool hyperv_vpindex; - bool hyperv_runtime; - bool hyperv_synic; bool hyperv_synic_kvm_only; - bool hyperv_stimer; - bool hyperv_frequencies; - bool hyperv_reenlightenment; - bool hyperv_tlbflush; - bool hyperv_evmcs; - bool hyperv_ipi; + uint64_t hyperv_features; + bool check_cpuid; bool enforce_cpuid; bool expose_kvm; @@ -1906,4 +1910,9 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const X86XSaveArea *buf); void x86_cpu_xsave_all_areas(X86CPU *cpu, X86XSaveArea *buf); void x86_update_hflags(CPUX86State* env); +static inline bool hyperv_feat_enabled(X86CPU *cpu, int feat) +{ + return !!(cpu->hyperv_features & BIT(feat)); +} + #endif /* I386_CPU_H */ |