From patchwork Wed Sep 28 08:36:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 676088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3skWXx5m3Qz9sCg for ; Wed, 28 Sep 2016 18:47:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Ve9zmD3c; dkim-atps=neutral Received: from localhost ([::1]:56860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpAWF-0002i8-6q for incoming@patchwork.ozlabs.org; Wed, 28 Sep 2016 04:47:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpALq-0000K8-TM for qemu-devel@nongnu.org; Wed, 28 Sep 2016 04:36:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpALk-0008Lc-UK for qemu-devel@nongnu.org; Wed, 28 Sep 2016 04:36:26 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:36166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpALk-0008LO-Oc for qemu-devel@nongnu.org; Wed, 28 Sep 2016 04:36:20 -0400 Received: by mail-pf0-x243.google.com with SMTP id n24so1853421pfb.3 for ; Wed, 28 Sep 2016 01:36:20 -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=PsGvPh26/ttN+SPkpUAik5reOBEhNCSZl4Qc3QTx9IY=; b=Ve9zmD3ccC3n/tVC95Jv7dCQqgoTYjYMxrFhO7UE7AqXHCiodCy7dknREI3lZhSGuI STTqPZdBHm3cmypnFQhVLOXZLDKrIBEyTQ7b/mDJuSEn3cfnpz7g/WHx4To+GDnU9i5b 4751tNWK09t3o4DNgGOpxNw/R6pfcJR6hDbdoWBhl+lrudyONhMPeKP/U+DnsHkQiqBk rs+I65mWHstWafsbeSmOQLk1jx6ANze4nGkWEqzEw5cIDJKDMxhIakOQKHvcnGJkXxHt jyWJ8puJjKgisAGs1LEuzFPlZLfWh6C1uELZj4e9TyqZ2UiIGbunHFzq9nnJNqf2Toog OUOA== 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=PsGvPh26/ttN+SPkpUAik5reOBEhNCSZl4Qc3QTx9IY=; b=U6PC/1nG/6Y+QTpsagDwFuZ1OUiCdh3Yff3HZy79DlDdn0+PpDFDcFuUnn2HcWboOC 1SfhKXd4x99e+ZzDtQOtF9bFShT6lOvEzZs1yJimLIVDdhDKROcpKm9+78s2ZL+Jrz1W sAE78BQzHKbyXFABi9Xk3pIfu8P3HWPkV3cqyazJhufEwXVR3CZYYhixWUe44VFFczOR 6NIGTPLJhv0O9RH+Vg/GspAJyah32+1lQRg/xzmVhDqv8pzzR5WTzrfLnlQQajnj+X8f sI/QW6Plwn8i2Vjly2CroUyn1h3JMH7UPeMUVeU331sQO2qwPxyACKv6rxsN11MueZiz A91g== X-Gm-Message-State: AE9vXwPd3FMUhfEdqTyfrwtxjd3hOXindrIgDZUDp6icwnqufI19V1SjK0uMnE23Cue7Rw== X-Received: by 10.98.27.195 with SMTP id b186mr54420212pfb.111.1475051780104; Wed, 28 Sep 2016 01:36:20 -0700 (PDT) Received: from kernel.kingsoft.cn ([114.255.44.132]) by smtp.gmail.com with ESMTPSA id wd7sm10435007pab.2.2016.09.28.01.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 01:36:19 -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 16:36:14 +0800 Message-Id: <1475051774-5590-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:c00::243 Subject: [Qemu-devel] [PATCH v2] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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) {