[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriti
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid() |
Date: |
Tue, 5 Feb 2013 17:39:24 +0100 |
ORing kvm_default_features to def->kvm_features might set unsupported
bits if kvm_arch_get_supported_cpuid() returns less bits set than in
kvm_default_features. Fix it by removing kvm_default_features and using
only what kvm_arch_get_supported_cpuid() returns.
Mark disable_kvm_pv_eoi() to be removed in favor of compat_props
when available.
Signed-off-by: Igor Mammedov <address@hidden>
---
target-i386/cpu.c | 20 ++++++++------------
target-i386/cpu.h | 2 ++
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 62fdc84..e66362e 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -220,17 +220,12 @@ typedef struct model_features_t {
int check_cpuid = 0;
int enforce_cpuid = 0;
-static uint32_t kvm_default_features = (1 << KVM_FEATURE_CLOCKSOURCE) |
- (1 << KVM_FEATURE_NOP_IO_DELAY) |
- (1 << KVM_FEATURE_CLOCKSOURCE2) |
- (1 << KVM_FEATURE_ASYNC_PF) |
- (1 << KVM_FEATURE_STEAL_TIME) |
- (1 << KVM_FEATURE_PV_EOI) |
- (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT);
-
+/* TODO: replace it with compat properties when feature bits
+ * are converted into static properties */
+bool x86_cpu_no_pv_eoi;
void disable_kvm_pv_eoi(void)
{
- kvm_default_features &= ~(1UL << KVM_FEATURE_PV_EOI);
+ x86_cpu_no_pv_eoi = true;
}
void host_cpuid(uint32_t function, uint32_t count,
@@ -2061,9 +2056,6 @@ static void x86_cpu_initfn(Object *obj)
env->cpuid_ext3_features = def->ext3_features;
object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", NULL);
env->cpuid_kvm_features = def->kvm_features;
- if (kvm_enabled()) {
- env->cpuid_kvm_features |= kvm_default_features;
- }
env->cpuid_svm_features = def->svm_features;
env->cpuid_ext4_features = def->ext4_features;
env->cpuid_7_0_ebx_features = def->cpuid_7_0_ebx_features;
@@ -2107,6 +2099,10 @@ static void x86_cpu_def_class_init(ObjectClass *oc, void
*data)
*/
memcpy(xcc->info.vendor, hostcc->info.vendor,
sizeof(xcc->info.vendor));
+ xcc->info.kvm_features = xcc->info.kvm_features;
+ if (x86_cpu_no_pv_eoi) {
+ xcc->info.kvm_features &= ~(1UL << KVM_FEATURE_PV_EOI);
+ }
}
/* Look for specific models that have the QEMU version in .model_id */
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 11ef942..51f20b6 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1246,6 +1246,8 @@ void do_smm_enter(CPUX86State *env1);
void cpu_report_tpr_access(CPUX86State *env, TPRAccess access);
+/* TODO: convert to compat_props */
+extern bool x86_cpu_no_pv_eoi;
void disable_kvm_pv_eoi(void);
/* Return name of 32-bit register, from a R_* constant */
--
1.7.1
- [Qemu-devel] [PATCH qom-cpu-next v4 0/5] target-i386: X86CPU subclasses, Igor Mammedov, 2013/02/05
- [Qemu-devel] [PATCH 1/5] target-i386: Move cpu_x86_init(), Igor Mammedov, 2013/02/05
- [Qemu-devel] [PATCH 2/5] target-i386: Split command line parsing out of cpu_x86_register(), Igor Mammedov, 2013/02/05
- [Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid(),
Igor Mammedov <=
- Re: [Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid(), Eduardo Habkost, 2013/02/05
- Re: [Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid(), Igor Mammedov, 2013/02/05
- Re: [Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid(), Eduardo Habkost, 2013/02/05
- Re: [Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid(), Igor Mammedov, 2013/02/05
- Re: [Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid(), Eduardo Habkost, 2013/02/05
- Re: [Qemu-devel] [PATCH 5/5] target-i386: fix kvm_default_features overwriting kvm_arch_get_supported_cpuid(), Igor Mammedov, 2013/02/06
[Qemu-devel] [PATCH 3/5] target-i386: Slim conversion to X86CPU subclasses, Igor Mammedov, 2013/02/05