[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/37] target-i386: make 'f-kvmclock' compatible wit
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 17/37] target-i386: make 'f-kvmclock' compatible with legacy behaviour |
Date: |
Mon, 22 Oct 2012 17:03:03 +0200 |
It'll keep legacy behavior of kvmclock CPUID feature, which is
toggles on KVM_FEATURE_CLOCKSOURCE and KVM_FEATURE_CLOCKSOURCE2
CPUID feature bits.
Rename feature corresponding to KVM_FEATURE_CLOCKSOURCE to
f-kvmclock1 to free f-kvmclock for use of legacy feature.
Signed-off-by: Igor Mammedov <address@hidden>
---
target-i386/cpu.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 407c5ce..9cdcae8 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -112,6 +112,42 @@ static const char *cpuid_7_0_ebx_feature_name[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
};
+#if defined(CONFIG_KVM)
+static void x86_cpu_get_kvmclock(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ X86CPU *cpu = X86_CPU(obj);
+ bool value = cpu->env.cpuid_kvm_features;
+ value = (value & KVM_FEATURE_CLOCKSOURCE) &&
+ (value & KVM_FEATURE_CLOCKSOURCE2);
+ visit_type_bool(v, &value, name, errp);
+}
+
+static void x86_cpu_set_kvmclock(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ X86CPU *cpu = X86_CPU(obj);
+ bool value;
+ visit_type_bool(v, &value, name, errp);
+ if (value == true) {
+ cpu->env.cpuid_kvm_features |= KVM_FEATURE_CLOCKSOURCE |
+ KVM_FEATURE_CLOCKSOURCE2;
+ } else {
+ cpu->env.cpuid_kvm_features &= ~(KVM_FEATURE_CLOCKSOURCE |
+ KVM_FEATURE_CLOCKSOURCE2);
+ }
+}
+
+PropertyInfo qdev_prop_kvmclock = {
+ .name = "boolean",
+ .get = x86_cpu_get_kvmclock,
+ .set = x86_cpu_set_kvmclock,
+};
+#define DEFINE_PROP_KVMCLOCK(_n, _s, _f)
\
+ DEFINE_PROP(_n, _s, _f, qdev_prop_kvmclock, uint32_t)
+
+#endif
+
static Property cpu_x86_properties[] = {
DEFINE_PROP_BIT("f-fpu", X86CPU, env.cpuid_features, 0, false),
DEFINE_PROP_BIT("f-vme", X86CPU, env.cpuid_features, 1, false),
@@ -201,7 +237,7 @@ static Property cpu_x86_properties[] = {
DEFINE_PROP_BIT("f-cvt16", X86CPU, env.cpuid_ext3_features, 18, false),
DEFINE_PROP_BIT("f-nodeid_msr", X86CPU, env.cpuid_ext3_features, 19,
false),
#if defined(CONFIG_KVM)
- DEFINE_PROP_BIT("f-kvmclock", X86CPU, env.cpuid_kvm_features, 0, true),
+ DEFINE_PROP_BIT("f-kvmclock1", X86CPU, env.cpuid_kvm_features, 0, true),
DEFINE_PROP_BIT("f-kvm_nopiodelay", X86CPU, env.cpuid_kvm_features, 1,
true),
DEFINE_PROP_BIT("f-kvm_mmu", X86CPU, env.cpuid_kvm_features, 2, true),
DEFINE_PROP_BIT("f-kvmclock2", X86CPU, env.cpuid_kvm_features, 3, true),
@@ -209,6 +245,7 @@ static Property cpu_x86_properties[] = {
DEFINE_PROP_BIT("f-kvm_steal_tm", X86CPU, env.cpuid_kvm_features, 5,
true),
DEFINE_PROP_BIT("f-kvm_pv_eoi", X86CPU, env.cpuid_kvm_features, 6, true),
DEFINE_PROP_BIT("f-kvmclock_stable", X86CPU, env.cpuid_kvm_features, 24,
true),
+ DEFINE_PROP_KVMCLOCK("f-kvmclock", X86CPU, env.cpuid_kvm_features),
#endif
DEFINE_PROP_BIT("f-npt", X86CPU, env.cpuid_svm_features, 0, false),
DEFINE_PROP_BIT("f-lbrv", X86CPU, env.cpuid_svm_features, 1, false),
--
1.7.11.7
- Re: [Qemu-devel] [PATCH 15/37] target-i386: set default value of "hypervisor" feature using static property, (continued)
- [Qemu-devel] [PATCH 22/37] target-i386: convert 'hv_vapic' to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 05/37] target-i386: move out CPU features initialization in separate func, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 32/37] target-i386: use static properties for setting cpuid features, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 29/37] target-i386: convert "stepping" to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 12/37] target-i386: convert "xlevel" to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 17/37] target-i386: make 'f-kvmclock' compatible with legacy behaviour,
Igor Mammedov <=
- [Qemu-devel] [PATCH 31/37] target-i386: convert "family" to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 18/37] target-i386: add stubs for hyperv_(vapic_recommended|relaxed_timing_enabled|get_spinlock_retries)(), Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 35/37] target-i386: use static properties in check_features_against_host() to print CPUID feature names, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 33/37] qdev: QDEV_PROP_FOREACH and QDEV_CLASS_FOREACH, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 16/37] target-i386: set kvm CPUID default feature values using static properties, Igor Mammedov, 2012/10/22