[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] nEPT: handle invept instruction from L1 VMM
# HG changeset patch # User Zhang Xiantao <xiantao.zhang@xxxxxxxxx> # Date 1358245781 -3600 # Node ID a16d3f55a3d583bc50ad1c7a79fef5eb75140a5a # Parent 51095ed4f95131d7aa467810c3fae043c945220b nEPT: handle invept instruction from L1 VMM Add the INVEPT instruction emulation logic. Signed-off-by: Zhang Xiantao <xiantao.zhang@xxxxxxxxx> Acked-by: Tim Deegan <tim@xxxxxxx> Acked-by: Jun Nakajima <jun.nakajima@xxxxxxxxx> Acked-by: Eddie Dong <eddie.dong@xxxxxxxxx> Committed-by: Jan Beulich <jbeulich@xxxxxxxx> --- diff -r 51095ed4f951 -r a16d3f55a3d5 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Tue Jan 15 11:28:23 2013 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Jan 15 11:29:41 2013 +0100 @@ -2580,10 +2580,14 @@ void vmx_vmexit_handler(struct cpu_user_ update_guest_eip(); break; + case EXIT_REASON_INVEPT: + if ( nvmx_handle_invept(regs) == X86EMUL_OKAY ) + update_guest_eip(); + break; + case EXIT_REASON_MWAIT_INSTRUCTION: case EXIT_REASON_MONITOR_INSTRUCTION: case EXIT_REASON_GETSEC: - case EXIT_REASON_INVEPT: case EXIT_REASON_INVVPID: /* * We should never exit on GETSEC because CR4.SMXE is always 0 when diff -r 51095ed4f951 -r a16d3f55a3d5 xen/arch/x86/hvm/vmx/vvmx.c --- a/xen/arch/x86/hvm/vmx/vvmx.c Tue Jan 15 11:28:23 2013 +0100 +++ b/xen/arch/x86/hvm/vmx/vvmx.c Tue Jan 15 11:29:41 2013 +0100 @@ -1393,6 +1393,40 @@ int nvmx_handle_vmwrite(struct cpu_user_ return X86EMUL_OKAY; } +int nvmx_handle_invept(struct cpu_user_regs *regs) +{ + struct vmx_inst_decoded decode; + unsigned long eptp; + int ret; + + if ( (ret = decode_vmx_inst(regs, &decode, &eptp, 0)) != X86EMUL_OKAY ) + return ret; + + switch ( reg_read(regs, decode.reg2) ) + { + case INVEPT_SINGLE_CONTEXT: + { + struct p2m_domain *p2m = vcpu_nestedhvm(current).nv_p2m; + if ( p2m ) + { + p2m_flush(current, p2m); + ept_sync_domain(p2m); + } + break; + } + case INVEPT_ALL_CONTEXT: + p2m_flush_nestedp2m(current->domain); + __invept(INVEPT_ALL_CONTEXT, 0, 0); + break; + default: + vmreturn(regs, VMFAIL_INVALID); + return X86EMUL_OKAY; + } + vmreturn(regs, VMSUCCEED); + return X86EMUL_OKAY; +} + + #define __emul_value(enable1, default1) \ ((enable1 | default1) << 32 | (default1)) diff -r 51095ed4f951 -r a16d3f55a3d5 xen/include/asm-x86/hvm/vmx/vvmx.h --- a/xen/include/asm-x86/hvm/vmx/vvmx.h Tue Jan 15 11:28:23 2013 +0100 +++ b/xen/include/asm-x86/hvm/vmx/vvmx.h Tue Jan 15 11:29:41 2013 +0100 @@ -191,6 +191,7 @@ int nvmx_handle_vmread(struct cpu_user_r int nvmx_handle_vmwrite(struct cpu_user_regs *regs); int nvmx_handle_vmresume(struct cpu_user_regs *regs); int nvmx_handle_vmlaunch(struct cpu_user_regs *regs); +int nvmx_handle_invept(struct cpu_user_regs *regs); int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content); int nvmx_msr_write_intercept(unsigned int msr, _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |