From: Igor Mammedov Subject: Re: [PATCH qom-cpu-next v3 3/4] target-i386: Slim conversion to X86CPU subclasses Date: Mon, 4 Feb 2013 21:21:16 +0100 Message-ID: <20130204212116.7c13c978@thinkpad.mammed.net> References: <1359765428-27805-1-git-send-email-afaerber@suse.de> <1359765428-27805-4-git-send-email-afaerber@suse.de> <20130204120856.571533d5@nial.usersys.redhat.com> <510FAF10.3050505@suse.de> <20130204170501.20ddb78f@nial.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: ehabkost@redhat.com, Gleb Natapov , Marcelo Tosatti , qemu-devel@nongnu.org, blauwirbel@gmail.com, anthony@codemonkey.ws, X86 , Andreas =?UTF-8?B?RsOkcmJlcg==?= To: Igor Mammedov Return-path: In-Reply-To: <20130204170501.20ddb78f@nial.usersys.redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org On Mon, 4 Feb 2013 17:05:01 +0100 Igor Mammedov wrote: > On Mon, 04 Feb 2013 13:52:32 +0100 > Andreas F=C3=A4rber wrote: >=20 > > Am 04.02.2013 12:08, schrieb Igor Mammedov: > > > On Sat, 2 Feb 2013 01:37:07 +0100 > > > Andreas F=C3=A4rber wrote: > > >=20 [...] >=20 > > >> @@ -2198,6 +2018,8 @@ static void x86_cpu_initfn(Object *obj) > > >> CPUState *cs =3D CPU(obj); > > >> X86CPU *cpu =3D X86_CPU(obj); > > >> CPUX86State *env =3D &cpu->env; > > >> + X86CPUClass *xcc =3D X86_CPU_GET_CLASS(obj); > > >> + const x86_def_t *def =3D &xcc->info; > > >> static int inited; > > >> =20 > > >> cpu_exec_init(env); > > >> @@ -2227,6 +2049,41 @@ static void x86_cpu_initfn(Object *obj) > > >> x86_cpuid_get_tsc_freq, > > >> x86_cpuid_set_tsc_freq, NULL, NULL, NULL); > > >> =20 > > >> + /* sysenter isn't supported in compatibility mode on AMD, > > >> + * syscall isn't supported in compatibility mode on Intel. > > >> + * Normally we advertise the actual CPU vendor, but you can > > >> + * override this using the 'vendor' property if you want to use > > >> + * KVM's sysenter/syscall emulation in compatibility mode and > > >> + * when doing cross vendor migration > > >> + */ > > >> + if (kvm_enabled()) { > > >> + host_cpuid(0, 0, NULL, &env->cpuid_vendor1, &env->cpuid_ven= dor2, > > >> + &env->cpuid_vendor3); > > > This is not per instance specific, this override would be better done= to > > > sub-classes in kvm_arch_init(). > >=20 > > Hmm... I think the issue I addresses this way was that kvm.c didn't have > > access to your static vendor_words2str() helper. Writing the words into > > the word fields is more direct than converting them to a string and > > writing them back into the words. > you have these correct vendor words ready after you called > kvm_host_cpu_class_init() in kvm_arch_init(), so just direct copy from ho= st > class would do. I was talking nonsense here. Why not to make vendor_words2str() helper not static and use it in kvm.c instead of doing partial init of host class and then reuse the value you got to override vendor in other classes? [...] --=20 Regards, Igor