ia64/xen-unstable

changeset 15107:dc4324d3fbb0

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@novell.com>
author kfraser@localhost.localdomain
date Tue May 15 10:46:03 2007 +0100 (2007-05-15)
parents c027880b50b4
children cb006eecd6f5
files xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vmx/vmcs.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue May 15 10:43:59 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue May 15 10:46:03 2007 +0100
     1.3 @@ -88,8 +88,7 @@ static DEFINE_PER_CPU(struct vmx_msr_sta
     1.4  
     1.5  static u32 msr_index[VMX_MSR_COUNT] =
     1.6  {
     1.7 -    MSR_LSTAR, MSR_STAR, MSR_CSTAR,
     1.8 -    MSR_SYSCALL_MASK
     1.9 +    MSR_LSTAR, MSR_STAR, MSR_SYSCALL_MASK
    1.10  };
    1.11  
    1.12  static void vmx_save_host_msrs(void)
    1.13 @@ -146,7 +145,7 @@ static inline int long_mode_do_msr_read(
    1.14          break;
    1.15  
    1.16      case MSR_CSTAR:
    1.17 -        msr_content = guest_msr_state->msrs[VMX_INDEX_MSR_CSTAR];
    1.18 +        msr_content = v->arch.hvm_vmx.cstar;
    1.19          break;
    1.20  
    1.21      case MSR_SYSCALL_MASK:
    1.22 @@ -249,7 +248,8 @@ static inline int long_mode_do_msr_write
    1.23      case MSR_CSTAR:
    1.24          if ( !is_canonical_address(msr_content) )
    1.25              goto uncanonical_address;
    1.26 -        WRITE_MSR(CSTAR);
    1.27 +        v->arch.hvm_vmx.cstar = msr_content;
    1.28 +        break;
    1.29  
    1.30      case MSR_SYSCALL_MASK:
    1.31          WRITE_MSR(SYSCALL_MASK);
    1.32 @@ -729,12 +729,12 @@ static void vmx_save_cpu_state(struct vc
    1.33      unsigned long guest_flags = guest_state->flags;
    1.34  
    1.35      data->shadow_gs = v->arch.hvm_vmx.shadow_gs;
    1.36 +    data->msr_cstar = v->arch.hvm_vmx.cstar;
    1.37  
    1.38      /* save msrs */
    1.39      data->msr_flags        = guest_flags;
    1.40      data->msr_lstar        = guest_state->msrs[VMX_INDEX_MSR_LSTAR];
    1.41      data->msr_star         = guest_state->msrs[VMX_INDEX_MSR_STAR];
    1.42 -    data->msr_cstar        = guest_state->msrs[VMX_INDEX_MSR_CSTAR];
    1.43      data->msr_syscall_mask = guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK];
    1.44  #endif
    1.45  
    1.46 @@ -754,9 +754,9 @@ static void vmx_load_cpu_state(struct vc
    1.47      guest_state->flags = data->msr_flags;
    1.48      guest_state->msrs[VMX_INDEX_MSR_LSTAR]        = data->msr_lstar;
    1.49      guest_state->msrs[VMX_INDEX_MSR_STAR]         = data->msr_star;
    1.50 -    guest_state->msrs[VMX_INDEX_MSR_CSTAR]        = data->msr_cstar;
    1.51      guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK] = data->msr_syscall_mask;
    1.52  
    1.53 +    v->arch.hvm_vmx.cstar     = data->msr_cstar;
    1.54      v->arch.hvm_vmx.shadow_gs = data->shadow_gs;
    1.55  #endif
    1.56  
     2.1 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h	Tue May 15 10:43:59 2007 +0100
     2.2 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h	Tue May 15 10:46:03 2007 +0100
     2.3 @@ -37,7 +37,6 @@ struct vmcs_struct {
     2.4  enum {
     2.5      VMX_INDEX_MSR_LSTAR = 0,
     2.6      VMX_INDEX_MSR_STAR,
     2.7 -    VMX_INDEX_MSR_CSTAR,
     2.8      VMX_INDEX_MSR_SYSCALL_MASK,
     2.9  
    2.10      VMX_MSR_COUNT
    2.11 @@ -77,6 +76,7 @@ struct arch_vmx_struct {
    2.12  #ifdef __x86_64__
    2.13      struct vmx_msr_state msr_state;
    2.14      unsigned long        shadow_gs;
    2.15 +    unsigned long        cstar;
    2.16  #endif
    2.17      unsigned long        efer;
    2.18      unsigned long        vmxassist_enabled:1;