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] hvm: fix XSAVE leaf 0 EBX size calculatio

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: fix XSAVE leaf 0 EBX size calculation
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Wed, 09 Feb 2011 06:50:33 -0800
Delivery-date: Wed, 09 Feb 2011 06:52:18 -0800
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 Keir Fraser <keir@xxxxxxx>
# Date 1297013191 0
# Node ID 7ada6faef565bd8f676ddfaff9c568ca592ee5be
# Parent  575d2f40acc4b2ac1528efe023c4e66914efdb8b
hvm: fix XSAVE leaf 0 EBX size calculation

Fixes a size calculation bug when enabled bits in XFEATURE_MASK (xcr0)
aren't contiguous.

Current for_loop will stop when xcr0 feature bit is 0. But in reality,
the bits can be non-contiguous. One example is that LWP is bit 62 on
AMD platform. This patch iterates through all bits to calculate the
size for enabled features.

Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
---
 xen/arch/x86/hvm/hvm.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff -r 575d2f40acc4 -r 7ada6faef565 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Sun Feb 06 17:22:44 2011 +0000
+++ b/xen/arch/x86/hvm/hvm.c    Sun Feb 06 17:26:31 2011 +0000
@@ -2222,10 +2222,12 @@ void hvm_cpuid(unsigned int input, unsig
         /* EBX value of main leaf 0 depends on enabled xsave features */
         if ( count == 0 && v->arch.xcr0 ) 
         {
-            for ( sub_leaf = 2; 
-                  (sub_leaf < 64) && (v->arch.xcr0 & (1ULL << sub_leaf));
-                  sub_leaf++ ) 
+            /* reset EBX to default value first */
+            *ebx = 576; 
+            for ( sub_leaf = 2; sub_leaf < 64; sub_leaf++ )
             {
+                if ( !(v->arch.xcr0 & (1ULL << sub_leaf)) )
+                    continue;
                 domain_cpuid(v->domain, input, sub_leaf, &_eax, &_ebx, &_ecx, 
                              &_edx);
                 if ( (_eax + _ebx) > *ebx )

_______________________________________________
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] hvm: fix XSAVE leaf 0 EBX size calculation, Xen patchbot-unstable <=