Patchwork [2/3] qemu: Enable XSAVE related CPUID

login
register
mail settings
Submitter Sheng Yang
Date June 10, 2010, 3:31 a.m.
Message ID <1276140663-29954-2-git-send-email-sheng@linux.intel.com>
Download mbox | patch
Permalink /patch/55145/
State New
Headers show

Comments

Sheng Yang - June 10, 2010, 3:31 a.m.
We can support it in KVM now. The 0xd leaf is queried from KVM.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
 target-i386/cpuid.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
Sheng Yang - June 16, 2010, 2:59 p.m.
On Thursday 10 June 2010 11:31:02 Sheng Yang wrote:
> We can support it in KVM now. The 0xd leaf is queried from KVM.

Hi Marcelo & Avi

How about patch 1 and 2 in this series? They are used to enable XSAVE cpuid.

--
regards
Yang, Sheng
					     						
> 
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> ---
>  target-i386/cpuid.c |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
> index fb78061..26e4054 100644
> --- a/target-i386/cpuid.c
> +++ b/target-i386/cpuid.c
> @@ -1081,6 +1081,27 @@ 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 (kvm_enabled()) {
> +            *eax = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EAX);
> +            *ebx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EBX);
> +            *ecx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_ECX);
> +            *edx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EDX);
> +        } else {
> +            *eax = 0;
> +            *ebx = 0;
> +            *ecx = 0;
> +            *edx = 0;
> +        }
> +        break;
>      case 0x80000000:
>          *eax = env->cpuid_xlevel;
>          *ebx = env->cpuid_vendor1;
Marcelo Tosatti - June 16, 2010, 4:41 p.m.
On Wed, Jun 16, 2010 at 10:59:07PM +0800, Sheng Yang wrote:
> On Thursday 10 June 2010 11:31:02 Sheng Yang wrote:
> > We can support it in KVM now. The 0xd leaf is queried from KVM.
> 
> Hi Marcelo & Avi
> 
> How about patch 1 and 2 in this series? They are used to enable XSAVE cpuid.

Applied.

Patch

diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index fb78061..26e4054 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -1081,6 +1081,27 @@  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 (kvm_enabled()) {
+            *eax = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EAX);
+            *ebx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EBX);
+            *ecx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_ECX);
+            *edx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EDX);
+        } else {
+            *eax = 0;
+            *ebx = 0;
+            *ecx = 0;
+            *edx = 0;
+        }
+        break;
     case 0x80000000:
         *eax = env->cpuid_xlevel;
         *ebx = env->cpuid_vendor1;