From patchwork Wed Sep 28 05:31:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 9353103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBBF46086A for ; Wed, 28 Sep 2016 05:31:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D92D32930F for ; Wed, 28 Sep 2016 05:31:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDE1329319; Wed, 28 Sep 2016 05:31:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A5E42930F for ; Wed, 28 Sep 2016 05:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbcI1FbZ (ORCPT ); Wed, 28 Sep 2016 01:31:25 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33115 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752104AbcI1FbU (ORCPT ); Wed, 28 Sep 2016 01:31:20 -0400 Received: by mail-pa0-f65.google.com with SMTP id oz2so1588946pac.0 for ; Tue, 27 Sep 2016 22:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=AzfRoZ2p/Pp37XaTyCSJCZCnme16HK20+4WFG7z/WcM=; b=wtdjEAKHF2fra12h5cFoKIetkvJTmrSPQTf2rI5INZU7LGeQZWuDwHo6WiFZj7qIsQ pHvcv4JkPtkCwtndPOJkVZDx3LNCNa2EbBwWY7ryOHHpWTkeOVYfUEMMRAgQmJjl+b0r SNuZ5LWLlbBFcN9hnlZllPRMAI4QWwOyKMYvSXkg1z4CX/9KE/dOWmybpwwqrlbW3dIp Ot1PXUrOs3wArvTKmagZxLLbPZJP7KJBSCepCAFdaTblgxg03PjTGX+oeaTwhlBW6+iO kc/7q+pZZmoNxeCaSJAbw9GMeMBPSw9sDEee+Fn561f493UaTTpqynZ268rGaUDbNPu8 a5aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AzfRoZ2p/Pp37XaTyCSJCZCnme16HK20+4WFG7z/WcM=; b=itUoRlBDO5VcR7nME/A4RcfZQD4SwzcILpXTiUviuZWXXiyKtgvqbCODTIFfya+g4r oWbS+IcXP5zLwAye8MovfIkie32cFS7q3abjwB9E/hmE9bCwz3cVJd5Gh8jjYy5D5M70 UIElx9+TgkSDhjf2zT9+nGCAjs+aBjeXi8XSig1pSuooWUiaEqFaFq5C7C/PBhvVRWNu 9fjUHr3RVEzXcQ/Naccv5LCKDJgAgI/gQQKkCF1acVPhwCt8rOeDQOl4loAwnwWo8Bx0 J2Yj1cHjs9uywev80XR+GKpXmAv81bi8IAdAMM++32xSbggv85RpmZTJhTFgW3NBCerR Clig== X-Gm-Message-State: AE9vXwPp4S3/TaiQTyzTjI3/eQ5PvSsht51jDwVFeM1xmolrgU3E1gQ4BmIVQtVSvuOPNw== X-Received: by 10.66.158.233 with SMTP id wx9mr53275458pab.2.1475040679248; Tue, 27 Sep 2016 22:31:19 -0700 (PDT) Received: from kernel.kingsoft.cn ([114.255.44.132]) by smtp.gmail.com with ESMTPSA id yg10sm8760873pab.8.2016.09.27.22.31.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Sep 2016 22:31:18 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: kvm@vger.kernel.org, qemu-devel@nongnu.org Cc: Wanpeng Li , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" Subject: [PATCH] target-i386: fix losing XCR0 processor state component bits Date: Wed, 28 Sep 2016 13:31:09 +0800 Message-Id: <1475040669-29085-1-git-send-email-wanpeng.li@hotmail.com> X-Mailer: git-send-email 1.9.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- target-i386/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index ad09246..9d24eff 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2156,6 +2156,10 @@ static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w, r = kvm_arch_get_supported_cpuid(kvm_state, wi->cpuid_eax, wi->cpuid_ecx, wi->cpuid_reg); + if ((w == FEAT_XSAVE_COMP_LO) || + (w == FEAT_XSAVE_COMP_HI)) { + return r; + } } else if (tcg_enabled()) { r = wi->tcg_features; } else {