WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Fix PV CPUID virtualization of XSave

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix PV CPUID virtualization of XSave
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Wed, 21 Sep 2011 15:33:08 +0100
Delivery-date: Wed, 21 Sep 2011 07:33:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Shan Haitao <haitao.shan@xxxxxxxxx>
# Date 1316300518 -3600
# Node ID b78235de5c6407023759f9bbf723dd83887fedf0
# Parent  c944e82bb092925f31403a129087e9d40e0fa06a
Fix PV CPUID virtualization of XSave

The patch will fix XSave CPUID virtualization for PV guests. The XSave
area size returned by CPUID leaf D is changed dynamically depending on
the XCR0. Tools/libxc only assigns a static value. The fix will adjust
xsave area size during runtime.

Note: This fix is already in HVM cpuid virtualization. And Dom0 is not
affected, either.

Signed-off-by:  Shan Haitao <haitao.shan@xxxxxxxxx>
---


diff -r c944e82bb092 -r b78235de5c64 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Sun Sep 18 00:00:26 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Sun Sep 18 00:01:58 2011 +0100
@@ -2426,7 +2426,7 @@
         {
             /* reset EBX to default value first */
             *ebx = XSTATE_AREA_MIN_SIZE; 
-            for ( sub_leaf = 2; sub_leaf < 64; sub_leaf++ )
+            for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ )
             {
                 if ( !(v->arch.xcr0 & (1ULL << sub_leaf)) )
                     continue;
diff -r c944e82bb092 -r b78235de5c64 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Sun Sep 18 00:00:26 2011 +0100
+++ b/xen/arch/x86/traps.c      Sun Sep 18 00:01:58 2011 +0100
@@ -770,6 +770,30 @@
     {
         if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) )
             domain_cpuid(current->domain, a, c, &a, &b, &c, &d);
+
+        switch ( a )
+        {
+        case 0xd:
+        {
+            unsigned int sub_leaf, _eax, _ebx, _ecx, _edx;
+            /* EBX value of main leaf 0 depends on enabled xsave features */
+            if ( c == 0 && current->arch.xcr0 )
+            {
+                /* reset EBX to default value first */
+                b = XSTATE_AREA_MIN_SIZE;
+                for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ )
+                {
+                    if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) )
+                        continue;
+                    domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx,
+                                 &_edx);
+                    if ( (_eax + _ebx) > b )
+                        b = _eax + _ebx;
+                }
+            }
+        break;
+        }
+        }
         goto out;
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix PV CPUID virtualization of XSave, Xen patchbot-unstable <=