[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86: MSR_IA32_BNDCFGS save/restore
commit 4c2502450ef1cc6fa1fd6daab8dbed8af1b88a29 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue Feb 25 09:41:40 2014 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Feb 25 09:41:40 2014 +0100 x86: MSR_IA32_BNDCFGS save/restore Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Liu Jinsong <jinsong.liu@xxxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> --- xen/arch/x86/hvm/vmx/vmx.c | 52 ++++++++++++++++++++++++++++++++++++ xen/include/asm-x86/hvm/vmx/vmcs.h | 2 + 2 files changed, 54 insertions(+), 0 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index baf3040..b128e81 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -580,6 +580,55 @@ static int vmx_load_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt) return 0; } +static unsigned int __init vmx_init_msr(void) +{ + return !!cpu_has_mpx; +} + +static void vmx_save_msr(struct vcpu *v, struct hvm_msr *ctxt) +{ + vmx_vmcs_enter(v); + + if ( cpu_has_mpx ) + { + __vmread(GUEST_BNDCFGS, &ctxt->msr[ctxt->count].val); + if ( ctxt->msr[ctxt->count].val ) + ctxt->msr[ctxt->count++].index = MSR_IA32_BNDCFGS; + } + + vmx_vmcs_exit(v); +} + +static int vmx_load_msr(struct vcpu *v, struct hvm_msr *ctxt) +{ + unsigned int i; + int err = 0; + + vmx_vmcs_enter(v); + + for ( i = 0; i < ctxt->count; ++i ) + { + switch ( ctxt->msr[i].index ) + { + case MSR_IA32_BNDCFGS: + if ( cpu_has_mpx ) + __vmwrite(GUEST_BNDCFGS, ctxt->msr[i].val); + else + err = -ENXIO; + break; + default: + continue; + } + if ( err ) + break; + ctxt->msr[i]._rsvd = 1; + } + + vmx_vmcs_exit(v); + + return err; +} + static void vmx_fpu_enter(struct vcpu *v) { vcpu_restore_fpu_lazy(v); @@ -1607,6 +1656,9 @@ static struct hvm_function_table __initdata vmx_function_table = { .vcpu_destroy = vmx_vcpu_destroy, .save_cpu_ctxt = vmx_save_vmcs_ctxt, .load_cpu_ctxt = vmx_load_vmcs_ctxt, + .init_msr = vmx_init_msr, + .save_msr = vmx_save_msr, + .load_msr = vmx_load_msr, .get_interrupt_shadow = vmx_get_interrupt_shadow, .set_interrupt_shadow = vmx_set_interrupt_shadow, .guest_x86_mode = vmx_guest_x86_mode, diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h index 75cd653..45dcfa1 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -367,6 +367,8 @@ enum vmcs_field { GUEST_PDPTR2_HIGH = 0x0000280f, GUEST_PDPTR3 = 0x00002810, GUEST_PDPTR3_HIGH = 0x00002811, + GUEST_BNDCFGS = 0x00002812, + GUEST_BNDCFGS_HIGH = 0x00002813, HOST_PAT = 0x00002c00, HOST_PAT_HIGH = 0x00002c01, HOST_EFER = 0x00002c02, -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |