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

[Xen-changelog] [xen-unstable] vmx: remove CSTAR save/restore on VMX



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1179222363 -3600
# Node ID dc4324d3fbb0ca99734e289c95a5b73244ef7bf2
# Parent  c027880b50b44f4fa256cdf8888b435e5323fc4c
vmx: remove CSTAR save/restore on VMX

CSTAR is an unused MSR in 64-bit mode on Intel's EM64T, hence there's
no need to save/restore this MSR during context switches. Mimic real
hardware by retaining the value written for eventual guest OS reads.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmx.c         |   12 ++++++------
 xen/include/asm-x86/hvm/vmx/vmcs.h |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff -r c027880b50b4 -r dc4324d3fbb0 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue May 15 10:43:59 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue May 15 10:46:03 2007 +0100
@@ -88,8 +88,7 @@ static DEFINE_PER_CPU(struct vmx_msr_sta
 
 static u32 msr_index[VMX_MSR_COUNT] =
 {
-    MSR_LSTAR, MSR_STAR, MSR_CSTAR,
-    MSR_SYSCALL_MASK
+    MSR_LSTAR, MSR_STAR, MSR_SYSCALL_MASK
 };
 
 static void vmx_save_host_msrs(void)
@@ -146,7 +145,7 @@ static inline int long_mode_do_msr_read(
         break;
 
     case MSR_CSTAR:
-        msr_content = guest_msr_state->msrs[VMX_INDEX_MSR_CSTAR];
+        msr_content = v->arch.hvm_vmx.cstar;
         break;
 
     case MSR_SYSCALL_MASK:
@@ -249,7 +248,8 @@ static inline int long_mode_do_msr_write
     case MSR_CSTAR:
         if ( !is_canonical_address(msr_content) )
             goto uncanonical_address;
-        WRITE_MSR(CSTAR);
+        v->arch.hvm_vmx.cstar = msr_content;
+        break;
 
     case MSR_SYSCALL_MASK:
         WRITE_MSR(SYSCALL_MASK);
@@ -729,12 +729,12 @@ static void vmx_save_cpu_state(struct vc
     unsigned long guest_flags = guest_state->flags;
 
     data->shadow_gs = v->arch.hvm_vmx.shadow_gs;
+    data->msr_cstar = v->arch.hvm_vmx.cstar;
 
     /* save msrs */
     data->msr_flags        = guest_flags;
     data->msr_lstar        = guest_state->msrs[VMX_INDEX_MSR_LSTAR];
     data->msr_star         = guest_state->msrs[VMX_INDEX_MSR_STAR];
-    data->msr_cstar        = guest_state->msrs[VMX_INDEX_MSR_CSTAR];
     data->msr_syscall_mask = guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK];
 #endif
 
@@ -754,9 +754,9 @@ static void vmx_load_cpu_state(struct vc
     guest_state->flags = data->msr_flags;
     guest_state->msrs[VMX_INDEX_MSR_LSTAR]        = data->msr_lstar;
     guest_state->msrs[VMX_INDEX_MSR_STAR]         = data->msr_star;
-    guest_state->msrs[VMX_INDEX_MSR_CSTAR]        = data->msr_cstar;
     guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK] = data->msr_syscall_mask;
 
+    v->arch.hvm_vmx.cstar     = data->msr_cstar;
     v->arch.hvm_vmx.shadow_gs = data->shadow_gs;
 #endif
 
diff -r c027880b50b4 -r dc4324d3fbb0 xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h        Tue May 15 10:43:59 2007 +0100
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h        Tue May 15 10:46:03 2007 +0100
@@ -37,7 +37,6 @@ enum {
 enum {
     VMX_INDEX_MSR_LSTAR = 0,
     VMX_INDEX_MSR_STAR,
-    VMX_INDEX_MSR_CSTAR,
     VMX_INDEX_MSR_SYSCALL_MASK,
 
     VMX_MSR_COUNT
@@ -77,6 +76,7 @@ struct arch_vmx_struct {
 #ifdef __x86_64__
     struct vmx_msr_state msr_state;
     unsigned long        shadow_gs;
+    unsigned long        cstar;
 #endif
     unsigned long        efer;
     unsigned long        vmxassist_enabled:1;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.