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: 102593 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4R9nL0T027267 for ; Thu, 27 May 2010 09:49:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757688Ab0E0JtT (ORCPT ); Thu, 27 May 2010 05:49:19 -0400 Received: from mga11.intel.com ([192.55.52.93]:42132 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751978Ab0E0JtS (ORCPT ); Thu, 27 May 2010 05:49:18 -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 Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, Sheng Yang Subject: [PATCH] qemu: Enable XSAVE related CPUID 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 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 27 May 2010 09:49:22 +0000 (UTC) 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;