[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] nested vmx: enable secondary processor-based VM-Execution controls
# HG changeset patch # User Dongxiao Xu <dongxiao.xu@xxxxxxxxx> # Date 1354267402 0 # Node ID a15b4080f143787f9e8381c5e00cdfd5585c3456 # Parent 828cb146d25a2c060b6fe3beee78c034d7f4f8af nested vmx: enable secondary processor-based VM-Execution controls Enable secondary processor-based control in VMCS Besides that, add a helper function to get the certain control bit in secondary processor-based control MSR. Signed-off-by: Dongxiao Xu <dongxiao.xu@xxxxxxxxx> Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> Acked-by: Jun Nakajima <jun.nakajima@xxxxxxxxx> Committed-by: Keir Fraser <keir@xxxxxxx> --- diff -r 828cb146d25a -r a15b4080f143 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Fri Nov 30 09:22:51 2012 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Fri Nov 30 09:23:22 2012 +0000 @@ -344,7 +344,7 @@ void vmx_update_cpu_exec_control(struct __vmwrite(CPU_BASED_VM_EXEC_CONTROL, v->arch.hvm_vmx.exec_control); } -static void vmx_update_secondary_exec_control(struct vcpu *v) +void vmx_update_secondary_exec_control(struct vcpu *v) { if ( nestedhvm_vcpu_in_guestmode(v) ) nvmx_update_secondary_exec_control(v, diff -r 828cb146d25a -r a15b4080f143 xen/arch/x86/hvm/vmx/vvmx.c --- a/xen/arch/x86/hvm/vmx/vvmx.c Fri Nov 30 09:22:51 2012 +0000 +++ b/xen/arch/x86/hvm/vmx/vvmx.c Fri Nov 30 09:23:22 2012 +0000 @@ -244,6 +244,17 @@ static inline u32 __n2_exec_control(stru return __get_vvmcs(nvcpu->nv_vvmcx, CPU_BASED_VM_EXEC_CONTROL); } +static inline u32 __n2_secondary_exec_control(struct vcpu *v) +{ + struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v); + u64 second_ctrl = 0; + + if ( __n2_exec_control(v) & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS ) + second_ctrl = __get_vvmcs(nvcpu->nv_vvmcx, SECONDARY_VM_EXEC_CONTROL); + + return second_ctrl; +} + static int vmx_inst_check_privilege(struct cpu_user_regs *regs, int vmxop_check) { struct vcpu *v = current; @@ -454,7 +465,6 @@ void nvmx_update_exec_control(struct vcp /* Enforce the removed features */ shadow_cntrl &= ~(CPU_BASED_TPR_SHADOW | CPU_BASED_ACTIVATE_MSR_BITMAP - | CPU_BASED_ACTIVATE_SECONDARY_CONTROLS | CPU_BASED_ACTIVATE_IO_BITMAP | CPU_BASED_UNCOND_IO_EXITING); shadow_cntrl |= host_cntrl; @@ -487,7 +497,12 @@ void nvmx_update_exec_control(struct vcp void nvmx_update_secondary_exec_control(struct vcpu *v, unsigned long value) { - set_shadow_control(v, SECONDARY_VM_EXEC_CONTROL, value); + u32 shadow_cntrl; + struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v); + + shadow_cntrl = __get_vvmcs(nvcpu->nv_vvmcx, SECONDARY_VM_EXEC_CONTROL); + shadow_cntrl |= value; + set_shadow_control(v, SECONDARY_VM_EXEC_CONTROL, shadow_cntrl); } static void nvmx_update_pin_control(struct vcpu *v, unsigned long host_cntrl) @@ -714,6 +729,7 @@ static void load_shadow_control(struct v */ nvmx_update_pin_control(v, vmx_pin_based_exec_control); vmx_update_cpu_exec_control(v); + vmx_update_secondary_exec_control(v); nvmx_update_exit_control(v, vmx_vmexit_control); nvmx_update_entry_control(v); vmx_update_exception_bitmap(v); @@ -923,6 +939,7 @@ static void virtual_vmexit(struct cpu_us v->arch.hvm_vcpu.guest_efer &= ~(EFER_LMA | EFER_LME); vmx_update_cpu_exec_control(v); + vmx_update_secondary_exec_control(v); vmx_update_exception_bitmap(v); load_vvmcs_host_state(v); @@ -1274,12 +1291,20 @@ int nvmx_msr_read_intercept(unsigned int CPU_BASED_UNCOND_IO_EXITING | CPU_BASED_RDTSC_EXITING | CPU_BASED_MONITOR_TRAP_FLAG | - CPU_BASED_VIRTUAL_NMI_PENDING; + CPU_BASED_VIRTUAL_NMI_PENDING | + CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; /* bit 1, 4-6,8,13-16,26 must be 1 (refer G4 of SDM) */ tmp = ( (1<<26) | (0xf << 13) | 0x100 | (0x7 << 4) | 0x2); /* 0-settings */ data = ((data | tmp) << 32) | (tmp); break; + case MSR_IA32_VMX_PROCBASED_CTLS2: + /* 1-seetings */ + data = 0; + /* 0-settings */ + tmp = 0; + data = (data << 32) | tmp; + break; case MSR_IA32_VMX_EXIT_CTLS: /* 1-seetings */ /* bit 0-8, 10,11,13,14,16,17 must be 1 (refer G4 of SDM) */ diff -r 828cb146d25a -r a15b4080f143 xen/include/asm-x86/hvm/vmx/vmx.h --- a/xen/include/asm-x86/hvm/vmx/vmx.h Fri Nov 30 09:22:51 2012 +0000 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h Fri Nov 30 09:23:22 2012 +0000 @@ -70,6 +70,7 @@ void vmx_realmode(struct cpu_user_regs * void vmx_update_debug_state(struct vcpu *v); void vmx_update_exception_bitmap(struct vcpu *v); void vmx_update_cpu_exec_control(struct vcpu *v); +void vmx_update_secondary_exec_control(struct vcpu *v); /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |