From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQmEZ-0007nb-Jy for qemu-devel@nongnu.org; Tue, 23 Oct 2012 17:42:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQmEY-000606-I9 for qemu-devel@nongnu.org; Tue, 23 Oct 2012 17:41:59 -0400 Received: from hub021-nj-6.exch021.serverdata.net ([206.225.164.222]:46520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQmEY-0005zu-E3 for qemu-devel@nongnu.org; Tue, 23 Oct 2012 17:41:58 -0400 Message-ID: <50870F25.3050304@CloudSwitch.Com> Date: Tue, 23 Oct 2012 17:41:57 -0400 From: Don Slutz MIME-Version: 1.0 References: <1350918203-25198-1-git-send-email-imammedo@redhat.com> <1350918203-25198-18-git-send-email-imammedo@redhat.com> In-Reply-To: <1350918203-25198-18-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 17/37] target-i386: make 'f-kvmclock' compatible with legacy behaviour List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: aliguori@us.ibm.com, ehabkost@redhat.com, jan.kiszka@siemens.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de On 10/22/12 11:03, Igor Mammedov wrote: > 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 > --- > 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), Reviewed-by: Don Slutz