Received: from eggs.gnu.org ([2001:4830:134:3::10]:60616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar7X0-0000cs-It for qemu-devel@nongnu.org; Fri, 15 Apr 2016 13:27:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ar7Ws-00029A-R2 for qemu-devel@nongnu.org; Fri, 15 Apr 2016 13:27:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55441) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar7Ws-00028T-Cg for qemu-devel@nongnu.org; Fri, 15 Apr 2016 13:27:38 -0400 Date: Fri, 15 Apr 2016 19:27:34 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <20160415172733.GD18429@potion.brq.redhat.com> References: <1460667307-14819-1-git-send-email-rkrcmar@redhat.com> <20160415165427.GI11931@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160415165427.GI11931@thinpad.lan.raisama.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] target-i386: add AMD CPUID.1:edx aliases to x86_cpu_get_migratable_flags List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, Richard Henderson , Paolo Bonzini , Andreas =?utf-8?Q?F=C3=A4rber?= 2016-04-15 13:54-0300, Eduardo Habkost: > On Thu, Apr 14, 2016 at 10:55:07PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: >> QEMU complains about -cpu host on an AMD machine: >> warning: host doesn't support requested feature: CPUID.80000001H:EDX= [bit 0] >> For bits 0,1,3,4,5,6,7,8,9,12,13,14,15,16,17,23,24. >>=20 >> Host does support them, but x86_cpu_get_migratable_flags filters unnam= ed >> features and drops these bits without realizing that they are aliases = to >> CPUID.1H:EDX and have their names there. >>=20 >> See https://bugzilla.redhat.com/show_bug.cgi?id=3D1326721 for details. >>=20 >> Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 >> --- >> target-i386/cpu.c | 40 ++++++++++++++++++++++------------------ >> 1 file changed, 22 insertions(+), 18 deletions(-) >=20 > I don't think we need that complexity to fix the problem. We even > have a similar hack in kvm_arch_get_supported_cpuid() to make > sure it handles the alias bits properly. Instead of hacking those > functions to copy CPUID[1] data, it's much easier to simply copy > the alias bits in realizefn after we call > x86_cpu_filter_features(), not before. >=20 > The following (untested) fix should be sufficient: It is, Tested-by: Radim Kr=C4=8Dm=C3=A1=C5=99 Thank you. > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index ddae932..d0b5b69 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2897,6 +2897,14 @@ static void x86_cpu_realizefn(DeviceState *dev, = Error **errp) > env->cpuid_level =3D 7; > } > =20 > + if (x86_cpu_filter_features(cpu) && cpu->enforce_cpuid) { > + error_setg(&local_err, > + kvm_enabled() ? > + "Host doesn't support requested features" : > + "TCG doesn't support requested features"); > + goto out; > + } > + > /* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits= on > * CPUID[1].EDX. > */ > @@ -2907,14 +2915,6 @@ static void x86_cpu_realizefn(DeviceState *dev, = Error **errp) > } > =20 > =20 > - if (x86_cpu_filter_features(cpu) && cpu->enforce_cpuid) { > - error_setg(&local_err, > - kvm_enabled() ? > - "Host doesn't support requested features" : > - "TCG doesn't support requested features"); > - goto out; > - } > - > #ifndef CONFIG_USER_ONLY > qemu_register_reset(x86_cpu_machine_reset_cb, cpu); > =20 >=20 >=20 > --=20 > Eduardo