From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asETD-0005UY-SV for qemu-devel@nongnu.org; Mon, 18 Apr 2016 15:04:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asETB-0007Pu-1M for qemu-devel@nongnu.org; Mon, 18 Apr 2016 15:04:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asETA-0007Pi-Sf for qemu-devel@nongnu.org; Mon, 18 Apr 2016 15:04:24 -0400 From: Eduardo Habkost Date: Mon, 18 Apr 2016 16:04:18 -0300 Message-Id: <1461006258-1696-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1461006258-1696-1-git-send-email-ehabkost@redhat.com> References: <1461006258-1696-1-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 1/1] target-i386: Set AMD alias bits after filtering CPUID data List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Richard Henderson , =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-devel@nongnu.org QEMU complains about -cpu host on an AMD machine: warning: host doesn't support requested feature: CPUID.80000001H:EDX [b= it 0] For bits 0,1,3,4,5,6,7,8,9,12,13,14,15,16,17,23,24. KVM_GET_SUPPORTED_CPUID and and x86_cpu_get_migratable_flags() don't handle the AMD CPUID aliases bits, making x86_cpu_filter_features() print warnings and clear those CPUID bits incorrectly. To avoid hacking x86_cpu_get_migratable_flags() to handle CPUID_EXT2_AMD_ALIASES (just like the existing hack inside kvm_arch_get_supported_cpuid()), simply move the CPUID_EXT2_AMD_ALIASES code in x86_cpu_realizefn() after the x86_cpu_filter_features() call. This will probably make the CPUID_EXT2_AMD_ALIASES hack in kvm_arch_get_supported_cpuid() unnecessary, too. The hack will be removed in a follow-up patch after v2.6.0. Reported-by: Radim Kr=C4=8Dm=C3=A1=C5=99 Tested-by: Radim Kr=C4=8Dm=C3=A1=C5=99 Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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, Er= ror **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 o= n * CPUID[1].EDX. */ @@ -2907,14 +2915,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Er= ror **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 2.1.0