From: Keir Fraser Date: Thu, 27 May 2010 07:34:44 +0000 (+0100) Subject: vmx: Fix c/s 21433:095e4b964f99: Must save host MSRs on cpu init X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12077 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=92ed5b7e9c642ff0f7c68eb8a39bd687726ba03c;p=xen.git vmx: Fix c/s 21433:095e4b964f99: Must save host MSRs on cpu init Original patch by Dulloor Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 2d0b45bad1..e74032a9d2 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -431,6 +431,8 @@ int vmx_cpu_up(void) BUG_ON(!(read_cr4() & X86_CR4_VMXE)); + vmx_save_host_msrs(); + /* * Ensure the current processor operating mode meets * the requred CRO fixed bits in VMX operation. diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 48cc3b59b3..d60a552ca2 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -144,7 +144,7 @@ static u32 msr_index[] = #define MSR_INDEX_SIZE (ARRAY_SIZE(msr_index)) -static void vmx_save_host_msrs(void) +void vmx_save_host_msrs(void) { struct vmx_msr_state *host_msr_state = &this_cpu(host_msr_state); int i; @@ -343,7 +343,7 @@ static void vmx_restore_guest_msrs(struct vcpu *v) #else /* __i386__ */ -#define vmx_save_host_msrs() ((void)0) +void vmx_save_host_msrs(void) {} #define vmx_restore_host_msrs() ((void)0) #define vmx_save_guest_msrs(v) ((void)0) @@ -1415,8 +1415,6 @@ static struct hvm_function_table __read_mostly vmx_function_table = { struct hvm_function_table * __init start_vmx(void) { - vmx_save_host_msrs(); - /* Xen does not fill x86_capability words except 0. */ boot_cpu_data.x86_capability[4] = cpuid_ecx(1); diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h index 389531b79d..535830f7d3 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -29,6 +29,7 @@ extern int vmx_cpu_up_prepare(unsigned int cpu); extern void vmx_cpu_dead(unsigned int cpu); extern int vmx_cpu_up(void); extern void vmx_cpu_down(void); +extern void vmx_save_host_msrs(void); struct vmcs_struct { u32 vmcs_revision_id;