ia64/xen-unstable

changeset 15246:dc25aedfa4f3

hvm: Correctly hook VLAPIC MSR change notification for VMX into
save/restore path.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu May 31 09:49:53 2007 +0100 (2007-05-31)
parents c9d66baad22b
children 340dbdb9cfec
files xen/arch/x86/hvm/vlapic.c xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vmx/vmx.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vlapic.c	Wed May 30 18:29:21 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/vlapic.c	Thu May 31 09:49:53 2007 +0100
     1.3 @@ -32,6 +32,7 @@
     1.4  #include <xen/lib.h>
     1.5  #include <xen/sched.h>
     1.6  #include <asm/current.h>
     1.7 +#include <asm/hvm/vmx/vmx.h>
     1.8  #include <public/hvm/ioreq.h>
     1.9  #include <public/hvm/params.h>
    1.10  
    1.11 @@ -710,6 +711,8 @@ void vlapic_msr_set(struct vlapic *vlapi
    1.12  
    1.13      vlapic->hw.apic_base_msr = value;
    1.14  
    1.15 +    vmx_vlapic_msr_changed(vlapic_vcpu(vlapic));
    1.16 +
    1.17      HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
    1.18                  "apic base msr is 0x%016"PRIx64, vlapic->hw.apic_base_msr);
    1.19  }
    1.20 @@ -877,6 +880,9 @@ static int lapic_load_hidden(struct doma
    1.21          return -EINVAL;
    1.22  
    1.23      lapic_info(s);
    1.24 +
    1.25 +    vmx_vlapic_msr_changed(v);
    1.26 +
    1.27      return 0;
    1.28  }
    1.29  
     2.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Wed May 30 18:29:21 2007 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Thu May 31 09:49:53 2007 +0100
     2.3 @@ -456,6 +456,8 @@ static void construct_vmcs(struct vcpu *
     2.4      vmx_vmcs_exit(v);
     2.5  
     2.6      paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */
     2.7 +
     2.8 +    vmx_vlapic_msr_changed(v);
     2.9  }
    2.10  
    2.11  int vmx_create_vmcs(struct vcpu *v)
     3.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Wed May 30 18:29:21 2007 +0100
     3.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu May 31 09:49:53 2007 +0100
     3.3 @@ -2547,7 +2547,7 @@ static void vmx_install_vlapic_mapping(s
     3.4      vmx_vmcs_exit(v);
     3.5  }
     3.6  
     3.7 -static void vmx_check_vlapic_msr(struct vcpu *v)
     3.8 +void vmx_vlapic_msr_changed(struct vcpu *v)
     3.9  {
    3.10      struct vlapic *vlapic = vcpu_vlapic(v);
    3.11      uint32_t ctl;
    3.12 @@ -2555,12 +2555,14 @@ static void vmx_check_vlapic_msr(struct 
    3.13      if ( !cpu_has_vmx_virtualize_apic_accesses )
    3.14          return;
    3.15  
    3.16 +    vmx_vmcs_enter(v);
    3.17      ctl  = __vmread(SECONDARY_VM_EXEC_CONTROL);
    3.18      ctl &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
    3.19      if ( !vlapic_hw_disabled(vlapic) &&
    3.20           (vlapic_base_address(vlapic) == APIC_DEFAULT_PHYS_BASE) )
    3.21          ctl |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
    3.22      __vmwrite(SECONDARY_VM_EXEC_CONTROL, ctl);
    3.23 +    vmx_vmcs_exit(v);
    3.24  }
    3.25  
    3.26  static inline int vmx_do_msr_write(struct cpu_user_regs *regs)
    3.27 @@ -2591,7 +2593,6 @@ static inline int vmx_do_msr_write(struc
    3.28          break;
    3.29      case MSR_IA32_APICBASE:
    3.30          vlapic_msr_set(vcpu_vlapic(v), msr_content);
    3.31 -        vmx_check_vlapic_msr(v);
    3.32          break;
    3.33      default:
    3.34          if ( !long_mode_do_msr_write(regs) )
     4.1 --- a/xen/include/asm-x86/hvm/vmx/vmx.h	Wed May 30 18:29:21 2007 +0100
     4.2 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Thu May 31 09:49:53 2007 +0100
     4.3 @@ -32,6 +32,7 @@ void vmx_asm_do_vmentry(void);
     4.4  void vmx_intr_assist(void);
     4.5  void vmx_do_resume(struct vcpu *);
     4.6  void set_guest_time(struct vcpu *v, u64 gtime);
     4.7 +void vmx_vlapic_msr_changed(struct vcpu *v);
     4.8  
     4.9  /*
    4.10   * Exit Reasons