[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/20] target-i386: Remove has_msr_hv_tsc global vari
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 17/20] target-i386: Remove has_msr_hv_tsc global variable |
Date: |
Tue, 27 Sep 2016 17:12:27 -0300 |
The global variable is not necessary because we can check
cpu->hyperv_time directly.
We just need to ensure cpu->hyperv_time will be cleared if the
feature is not really being exposed to the guest due to missing
KVM_CAP_HYPERV_TIME capability.
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-i386/kvm.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 031ae90..4046030 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -91,7 +91,6 @@ static bool has_msr_bndcfgs;
static bool has_msr_kvm_steal_time;
static int lm_capable_kernel;
static bool has_msr_hv_hypercall;
-static bool has_msr_hv_tsc;
static bool has_msr_hv_crash;
static bool has_msr_hv_reset;
static bool has_msr_hv_vpindex;
@@ -602,6 +601,11 @@ static int hyperv_handle_properties(CPUState *cs)
X86CPU *cpu = X86_CPU(cs);
CPUX86State *env = &cpu->env;
+ if (cpu->hyperv_time &&
+ kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TIME) <= 0) {
+ cpu->hyperv_time = false;
+ }
+
if (cpu->hyperv_relaxed_timing) {
env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE;
}
@@ -609,12 +613,10 @@ static int hyperv_handle_properties(CPUState *cs)
env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE;
env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_APIC_ACCESS_AVAILABLE;
}
- if (cpu->hyperv_time &&
- kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TIME) > 0) {
+ if (cpu->hyperv_time) {
env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE;
env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_TIME_REF_COUNT_AVAILABLE;
env->features[FEAT_HYPERV_EAX] |= 0x200;
- has_msr_hv_tsc = true;
}
if (cpu->hyperv_crash && has_msr_hv_crash) {
env->features[FEAT_HYPERV_EDX] |= HV_X64_GUEST_CRASH_MSR_AVAILABLE;
@@ -1683,7 +1685,7 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE,
env->msr_hv_vapic);
}
- if (has_msr_hv_tsc) {
+ if (cpu->hyperv_time) {
kvm_msr_entry_add(cpu, HV_X64_MSR_REFERENCE_TSC, env->msr_hv_tsc);
}
if (has_msr_hv_crash) {
@@ -2087,7 +2089,7 @@ static int kvm_get_msrs(X86CPU *cpu)
if (cpu->hyperv_vapic) {
kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE, 0);
}
- if (has_msr_hv_tsc) {
+ if (cpu->hyperv_time) {
kvm_msr_entry_add(cpu, HV_X64_MSR_REFERENCE_TSC, 0);
}
if (has_msr_hv_crash) {
--
2.7.4
- [Qemu-devel] [PULL 06/20] target-i386: Enable CPUID[0x8000000A] if SVM is enabled, (continued)
- [Qemu-devel] [PULL 06/20] target-i386: Enable CPUID[0x8000000A] if SVM is enabled, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 07/20] linux-user: remove #define smp_{cores, threads}, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 11/20] target-i386: xsave: Simplify CPUID[0xD, 0].{EAX, EDX} calculation, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 08/20] target-i386: Move feature name arrays inside FeatureWordInfo, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 10/20] target-i386: xsave: Calculate enabled components only once, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 09/20] target-i386: Don't try to enable PT State xsave component, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 13/20] target-i386: xsave: Calculate set of xsave components on realize, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 14/20] target-i386: Move xsave component mask to features array, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 12/20] target-i386: xsave: Helper function to calculate xsave area size, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 16/20] target-i386: Remove has_msr_hv_apic global variable, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 17/20] target-i386: Remove has_msr_hv_tsc global variable,
Eduardo Habkost <=
- [Qemu-devel] [PULL 18/20] target-i386: Clear KVM CPUID features if KVM is disabled, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 15/20] target-i386: Remove has_msr_mtrr global variable, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 19/20] target-i386: Remove has_msr_* global vars for KVM features, Eduardo Habkost, 2016/09/27
- [Qemu-devel] [PULL 20/20] sysbus: Remove ignored return value of FindSysbusDeviceFunc, Eduardo Habkost, 2016/09/27
- Re: [Qemu-devel] [PULL 00/20] x86 and machine queue, 2016-09-27, Peter Maydell, 2016/09/27