[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/20] target-i386: Remove has_msr_* global vars for
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 19/20] target-i386: Remove has_msr_* global vars for KVM features |
Date: |
Tue, 27 Sep 2016 17:12:29 -0300 |
The global variables are not necessary because we can check KVM
feature flags in X86CPU directly.
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-i386/kvm.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 4046030..30b63b7 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -83,12 +83,9 @@ static bool has_msr_tsc_aux;
static bool has_msr_tsc_adjust;
static bool has_msr_tsc_deadline;
static bool has_msr_feature_control;
-static bool has_msr_async_pf_en;
-static bool has_msr_pv_eoi_en;
static bool has_msr_misc_enable;
static bool has_msr_smbase;
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_crash;
@@ -754,12 +751,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
c = &cpuid_data.entries[cpuid_i++];
c->function = KVM_CPUID_FEATURES | kvm_base;
c->eax = env->features[FEAT_KVM];
-
- has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
-
- has_msr_pv_eoi_en = c->eax & (1 << KVM_FEATURE_PV_EOI);
-
- has_msr_kvm_steal_time = c->eax & (1 << KVM_FEATURE_STEAL_TIME);
}
cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused);
@@ -1639,13 +1630,13 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
kvm_msr_entry_add(cpu, MSR_IA32_TSC, env->tsc);
kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, env->system_time_msr);
kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, env->wall_clock_msr);
- if (has_msr_async_pf_en) {
+ if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) {
kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, env->async_pf_en_msr);
}
- if (has_msr_pv_eoi_en) {
+ if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) {
kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, env->pv_eoi_en_msr);
}
- if (has_msr_kvm_steal_time) {
+ if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_STEAL_TIME)) {
kvm_msr_entry_add(cpu, MSR_KVM_STEAL_TIME, env->steal_time_msr);
}
if (has_msr_architectural_pmu) {
@@ -2048,13 +2039,13 @@ static int kvm_get_msrs(X86CPU *cpu)
#endif
kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, 0);
kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, 0);
- if (has_msr_async_pf_en) {
+ if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) {
kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, 0);
}
- if (has_msr_pv_eoi_en) {
+ if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) {
kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, 0);
}
- if (has_msr_kvm_steal_time) {
+ if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_STEAL_TIME)) {
kvm_msr_entry_add(cpu, MSR_KVM_STEAL_TIME, 0);
}
if (has_msr_architectural_pmu) {
--
2.7.4
- [Qemu-devel] [PULL 08/20] target-i386: Move feature name arrays inside FeatureWordInfo, (continued)
- [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, 2016/09/27
- [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 <=
- [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