From patchwork Thu May 27 09:50:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 53712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F2342B7D1D for ; Thu, 27 May 2010 19:52:26 +1000 (EST) Received: from localhost ([127.0.0.1]:47589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHZlG-000522-LX for incoming@patchwork.ozlabs.org; Thu, 27 May 2010 05:52:22 -0400 Received: from [140.186.70.92] (port=34741 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHZiN-0004DM-FX for qemu-devel@nongnu.org; Thu, 27 May 2010 05:49:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHZiM-0005NB-69 for qemu-devel@nongnu.org; Thu, 27 May 2010 05:49:23 -0400 Received: from mga11.intel.com ([192.55.52.93]:43320) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHZiM-0005MR-0O for qemu-devel@nongnu.org; Thu, 27 May 2010 05:49:22 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 27 May 2010 02:46:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.53,310,1272870000"; d="scan'208";a="802343386" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.36.64]) by fmsmga001.fm.intel.com with ESMTP; 27 May 2010 02:49:00 -0700 Received: from yasker by syang10-desktop with local (Exim 4.71) (envelope-from ) id 1OHZj7-0001OH-Sq; Thu, 27 May 2010 17:50:09 +0800 From: Sheng Yang To: Avi Kivity , Marcelo Tosatti , Anthony Liguori Date: Thu, 27 May 2010 17:50:06 +0800 Message-Id: <1274953806-5316-1-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.7.0.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Sheng Yang Subject: [Qemu-devel] [PATCH] qemu: Enable XSAVE related CPUID X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We can support it in KVM now. The initial values are the minimal requirement of XSAVE capable processor. Signed-off-by: Sheng Yang --- target-i386/cpuid.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index eebf038..cbf5595 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -1067,6 +1067,38 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ecx = 0; *edx = 0; break; + case 0xD: + /* Processor Extended State */ + if (!(env->cpuid_ext_features & CPUID_EXT_XSAVE)) { + *eax = 0; + *ebx = 0; + *ecx = 0; + *edx = 0; + break; + } + if (count == 0) { + *eax = 0x7; /* FP | SSE | YMM */ + *ebx = 0x340; /* FP + SSE + YMM size */ + *ecx = 0x340; /* FP + SSE + YMM size */ + *edx = 0; + } else if (count == 1) { + /* eax = 1, so we can continue with others */ + *eax = 1; + *ebx = 0; + *ecx = 0; + *edx = 0; + } else if (count == 2) { + *eax = 0x100; /* YMM size */ + *ebx = 0x240; /* YMM offset */ + *ecx = 0; + *edx = 0; + } else { + *eax = 0; + *ebx = 0; + *ecx = 0; + *edx = 0; + } + break; case 0x80000000: *eax = env->cpuid_xlevel; *ebx = env->cpuid_vendor1;