[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/xsave: simplify xcomp_bv initialization



commit 83ae0bb2260c71e8dcec538dd477f7253aaef327
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jan 14 10:42:53 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jan 14 10:42:53 2016 +0100

    x86/xsave: simplify xcomp_bv initialization
    
    This simplifies a number of pointless conditionals: Bits 0 and 1 of
    xcomp_bv don't matter anyway, and as long as none of bits 2..62 are
    set, setting bit 63 is pointless too unless XSAVES is in use.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/domain.c  |    5 ++---
 xen/arch/x86/hvm/hvm.c |   10 ++++------
 xen/arch/x86/i387.c    |    2 +-
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 159d960..e70c125 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -922,9 +922,8 @@ int arch_set_info_guest(
         if ( v->arch.xsave_area )
         {
             v->arch.xsave_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
-            if ( cpu_has_xsaves || cpu_has_xsavec )
-                v->arch.xsave_area->xsave_hdr.xcomp_bv = XSTATE_FP_SSE |
-                                                         
XSTATE_COMPACTION_ENABLED;
+            v->arch.xsave_area->xsave_hdr.xcomp_bv =
+                cpu_has_xsaves ? XSTATE_COMPACTION_ENABLED : 0;
         }
     }
     else if ( v->arch.xsave_area )
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 922754a..a99edc2 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2110,9 +2110,8 @@ static int hvm_load_cpu_ctxt(struct domain *d, 
hvm_domain_context_t *h)
             struct xsave_struct *xsave_area = v->arch.xsave_area;
 
             xsave_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
-            if ( cpu_has_xsaves || cpu_has_xsavec )
-                xsave_area->xsave_hdr.xcomp_bv = XSTATE_FP_SSE |
-                                                 XSTATE_COMPACTION_ENABLED;
+            xsave_area->xsave_hdr.xcomp_bv =
+                cpu_has_xsaves ? XSTATE_COMPACTION_ENABLED : 0;
         }
     }
 
@@ -5476,9 +5475,8 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, 
uint16_t ip)
     if ( v->arch.xsave_area )
     {
         v->arch.xsave_area->xsave_hdr.xstate_bv = XSTATE_FP;
-        if ( cpu_has_xsaves || cpu_has_xsavec )
-            v->arch.xsave_area->xsave_hdr.xcomp_bv = XSTATE_FP |
-                                                     XSTATE_COMPACTION_ENABLED;
+        v->arch.xsave_area->xsave_hdr.xcomp_bv =
+            cpu_has_xsaves ? XSTATE_COMPACTION_ENABLED : 0;
     }
 
     v->arch.vgc_flags = VGCF_online;
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 9c29211..331a401 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -272,7 +272,7 @@ int vcpu_init_fpu(struct vcpu *v)
     if ( v->arch.xsave_area )
     {
         v->arch.fpu_ctxt = &v->arch.xsave_area->fpu_sse;
-        if ( cpu_has_xsaves || cpu_has_xsavec )
+        if ( cpu_has_xsaves )
             v->arch.xsave_area->xsave_hdr.xcomp_bv = XSTATE_COMPACTION_ENABLED;
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#master

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.