From patchwork Tue Jun 21 17:08:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 101320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7FF91B6F59 for ; Wed, 22 Jun 2011 03:23:44 +1000 (EST) Received: from localhost ([::1]:33711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4fs-0002EB-TY for incoming@patchwork.ozlabs.org; Tue, 21 Jun 2011 13:23:40 -0400 Received: from eggs.gnu.org ([140.186.70.92]:56408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4Ro-00071I-B8 for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:09:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZ4Rk-000100-AH for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:09:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4Ri-0000xu-NN for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:09:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5LH90jP022569 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Jun 2011 13:09:00 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5LH8xmG019566; Tue, 21 Jun 2011 13:08:59 -0400 Received: from amt.cnet (vpn-9-196.rdu.redhat.com [10.11.9.196]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p5LH8wna020384; Tue, 21 Jun 2011 13:08:59 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 5DB5566E2BB; Tue, 21 Jun 2011 14:08:44 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id p5LH8gZ6006992; Tue, 21 Jun 2011 14:08:42 -0300 From: Marcelo Tosatti To: Anthony Liguori Date: Tue, 21 Jun 2011 14:08:03 -0300 Message-Id: <31e8c69697becf5e0b54a6a0cef1d27109d469e9.1308676084.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Andre Przywara , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 14/15] KVM: Fix XSAVE feature bit enumeration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Andre Przywara When iterating through the XSAVE feature enumeration CPUID leaf (0xD) we should not stop at the first zero EAX, but instead keep scanning since there are gaps in the enumeration (ECX=1 for instance). This fixes the proper usage of AVX in KVM guests. Signed-off-by: Andre Przywara Signed-off-by: Marcelo Tosatti --- target-i386/kvm.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 938e0a3..10fb2c4 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -416,6 +416,9 @@ int kvm_arch_init_vcpu(CPUState *env) case 0xb: case 0xd: for (j = 0; ; j++) { + if (i == 0xd && j == 64) { + break; + } c->function = i; c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX; c->index = j; @@ -428,7 +431,7 @@ int kvm_arch_init_vcpu(CPUState *env) break; } if (i == 0xd && c->eax == 0) { - break; + continue; } c = &cpuid_data.entries[cpuid_i++]; }