From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wanpeng Li Subject: [PATCH v2] target-i386: fix losing XCR0 processor state component bits Date: Wed, 28 Sep 2016 16:36:14 +0800 Message-ID: <1475051774-5590-1-git-send-email-wanpeng.li@hotmail.com> Cc: Wanpeng Li , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" To: kvm@vger.kernel.org, qemu-devel@nongnu.org Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:35309 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752258AbcI1IgZ (ORCPT ); Wed, 28 Sep 2016 04:36:25 -0400 Received: by mail-pf0-f195.google.com with SMTP id 6so1862909pfl.2 for ; Wed, 28 Sep 2016 01:36:20 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: From: Wanpeng Li Commit 96193c22a "target-i386: Move xsave component mask to features array" leverages features array to handle XCR0 processor state component bits, however, it introduces a regression: warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 0] warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 1] warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 2] My desktop doesn't have enough advance features, so just X87,SSE,AVX warnings are splat when I boot a guest. The get migratable flags logic in x86_cpu_filter_features() path will filter out the feature flags which are unsupported and unmigratable. However, the bits of XCR0 processor state component featureword don't have feat_names, and some features like SSE/AVX etc have feat_names in CPUID.01H:EDX, CPUID.01H:ECX, so they are treated as unsupported. This patch fix it by don't filter out XCR0 processor state components bits though they don't have feat_names just as before commit 96193c22ab3. Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Michael S. Tsirkin Signed-off-by: Wanpeng Li --- v1 -> v2: * move the check to x86_cpu_get_migratable_flags() target-i386/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 333309b..cc929ca 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -602,7 +602,10 @@ static uint32_t x86_cpu_get_migratable_flags(FeatureWord w) uint32_t f = 1U << i; /* If the feature name is unknown, it is not supported by QEMU yet */ if (!wi->feat_names[i]) { - continue; + if (w != FEAT_XSAVE_COMP_LO && + w != FEAT_XSAVE_COMP_HI) { + continue; + } } /* Skip features known to QEMU, but explicitly marked as unmigratable */ if (wi->unmigratable_flags & f) { -- 1.9.1