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: 9353107 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 83D726077B for ; Wed, 28 Sep 2016 05:31:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7592E292FA for ; Wed, 28 Sep 2016 05:31:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A1F229310; Wed, 28 Sep 2016 05:31:42 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 15B17292FA for ; Wed, 28 Sep 2016 05:31:42 +0000 (UTC) Received: from localhost ([::1]:56086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp7T3-000089-9b for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Sep 2016 01:31:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp7Sn-00007y-FC for qemu-devel@nongnu.org; Wed, 28 Sep 2016 01:31:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bp7Si-00021o-Fk for qemu-devel@nongnu.org; Wed, 28 Sep 2016 01:31:25 -0400 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]:34338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp7Si-00021N-9L for qemu-devel@nongnu.org; Wed, 28 Sep 2016 01:31:20 -0400 Received: by mail-pa0-x242.google.com with SMTP id r9so925577paz.1 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=fZjB3pbJfQtUlJ403JnoJCGXEImTKkwtX2zuMa9TUu+2miLUMaiYOA9Ba7wu07a9Y1 uO2a0BqGGHDR2OdpMuAQhZB0bZe5SJvhQeW0canV38+qS89lZ7R5KW1ZWcY3COhPAL0b YE0ltSlaXBwt3tA9oLIGhyOEFLH8qQelYnf65xNVfEGh5YEzx2Sq75aBFWYxgEizuKQi uJku3gdhEoE3MFxYsabjC83apN0/JNHgLYKmt4E1cWVnaIoSRVy9gqXlDJXSOZSRsi50 nCRDpFljSdaJI//nI6vsTYlI/QRA29hCVV5Bp9xLRxDvvPRAoUS0XWCIb0Mgt7O73HsM 5pjw== X-Gm-Message-State: AE9vXwPlwKuwTX6Q7AKf8qzdHNVN0DJkiSpWSBW++YBM4QrdIW+LluxEsamBOebojj5p+w== 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 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::242 Subject: [Qemu-devel] [PATCH] target-i386: fix losing XCR0 processor state component bits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Michael S. Tsirkin" , Eduardo Habkost , Wanpeng Li , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 {