[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] vmx: Caching the VMCS field EXCEPTION_BITMAP and cleanup some unused function.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1284395084 -3600 # Node ID 767e3f4366f89fd23b398c8f7168172c03449675 # Parent 78b16cd326dd51bf577ed2ff7cf657baca96a70d vmx: Caching the VMCS field EXCEPTION_BITMAP and cleanup some unused function. Signed-off-by: Qing He <qing.he@xxxxxxxxx> Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx> --- xen/arch/x86/hvm/vmx/vmcs.c | 6 +++--- xen/arch/x86/hvm/vmx/vmx.c | 29 ++++++++++++++++++----------- xen/include/asm-x86/hvm/vmx/vmcs.h | 1 + xen/include/asm-x86/hvm/vmx/vmx.h | 12 ++---------- 4 files changed, 24 insertions(+), 24 deletions(-) diff -r 78b16cd326dd -r 767e3f4366f8 xen/arch/x86/hvm/vmx/vmcs.c --- a/xen/arch/x86/hvm/vmx/vmcs.c Mon Sep 13 17:24:10 2010 +0100 +++ b/xen/arch/x86/hvm/vmx/vmcs.c Mon Sep 13 17:24:44 2010 +0100 @@ -839,10 +839,10 @@ static int construct_vmcs(struct vcpu *v __vmwrite(VMCS_LINK_POINTER_HIGH, ~0UL); #endif - __vmwrite(EXCEPTION_BITMAP, - HVM_TRAP_MASK + v->arch.hvm_vmx.exception_bitmap = HVM_TRAP_MASK | (paging_mode_hap(d) ? 0 : (1U << TRAP_page_fault)) - | (1U << TRAP_no_device)); + | (1U << TRAP_no_device); + vmx_update_exception_bitmap(v); v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_PE | X86_CR0_ET; hvm_update_guest_cr(v, 0); diff -r 78b16cd326dd -r 767e3f4366f8 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Mon Sep 13 17:24:10 2010 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Mon Sep 13 17:24:44 2010 +0100 @@ -385,6 +385,11 @@ long_mode_do_msr_write(unsigned int msr, #endif /* __i386__ */ +void vmx_update_exception_bitmap(struct vcpu *v) +{ + __vmwrite(EXCEPTION_BITMAP, v->arch.hvm_vmx.exception_bitmap); +} + static int vmx_guest_x86_mode(struct vcpu *v) { unsigned int cs_ar_bytes; @@ -623,7 +628,8 @@ static void vmx_fpu_enter(struct vcpu *v static void vmx_fpu_enter(struct vcpu *v) { setup_fpu(v); - __vm_clear_bit(EXCEPTION_BITMAP, TRAP_no_device); + v->arch.hvm_vmx.exception_bitmap &= ~(1u << TRAP_no_device); + vmx_update_exception_bitmap(v); v->arch.hvm_vmx.host_cr0 &= ~X86_CR0_TS; __vmwrite(HOST_CR0, v->arch.hvm_vmx.host_cr0); } @@ -649,7 +655,8 @@ static void vmx_fpu_leave(struct vcpu *v { v->arch.hvm_vcpu.hw_cr[0] |= X86_CR0_TS; __vmwrite(GUEST_CR0, v->arch.hvm_vcpu.hw_cr[0]); - __vm_set_bit(EXCEPTION_BITMAP, TRAP_no_device); + v->arch.hvm_vmx.exception_bitmap |= (1u << TRAP_no_device); + vmx_update_exception_bitmap(v); } } @@ -1049,7 +1056,7 @@ static void vmx_update_host_cr3(struct v void vmx_update_debug_state(struct vcpu *v) { - unsigned long intercepts, mask; + unsigned long mask; ASSERT(v == current); @@ -1057,12 +1064,11 @@ void vmx_update_debug_state(struct vcpu if ( !cpu_has_monitor_trap_flag ) mask |= 1u << TRAP_debug; - intercepts = __vmread(EXCEPTION_BITMAP); if ( v->arch.hvm_vcpu.debug_state_latch ) - intercepts |= mask; + v->arch.hvm_vmx.exception_bitmap |= mask; else - intercepts &= ~mask; - __vmwrite(EXCEPTION_BITMAP, intercepts); + v->arch.hvm_vmx.exception_bitmap &= ~mask; + vmx_update_exception_bitmap(v); } static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr) @@ -1124,7 +1130,8 @@ static void vmx_update_guest_cr(struct v vmx_set_segment_register(v, s, ®[s]); v->arch.hvm_vcpu.hw_cr[4] |= X86_CR4_VME; __vmwrite(GUEST_CR4, v->arch.hvm_vcpu.hw_cr[4]); - __vmwrite(EXCEPTION_BITMAP, 0xffffffff); + v->arch.hvm_vmx.exception_bitmap = 0xffffffff; + vmx_update_exception_bitmap(v); } else { @@ -1136,11 +1143,11 @@ static void vmx_update_guest_cr(struct v ((v->arch.hvm_vcpu.hw_cr[4] & ~X86_CR4_VME) |(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_VME)); __vmwrite(GUEST_CR4, v->arch.hvm_vcpu.hw_cr[4]); - __vmwrite(EXCEPTION_BITMAP, - HVM_TRAP_MASK + v->arch.hvm_vmx.exception_bitmap = HVM_TRAP_MASK | (paging_mode_hap(v->domain) ? 0 : (1U << TRAP_page_fault)) - | (1U << TRAP_no_device)); + | (1U << TRAP_no_device); + vmx_update_exception_bitmap(v); vmx_update_debug_state(v); } } diff -r 78b16cd326dd -r 767e3f4366f8 xen/include/asm-x86/hvm/vmx/vmcs.h --- a/xen/include/asm-x86/hvm/vmx/vmcs.h Mon Sep 13 17:24:10 2010 +0100 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h Mon Sep 13 17:24:44 2010 +0100 @@ -97,6 +97,7 @@ struct arch_vmx_struct { /* Cache of cpu execution control. */ u32 exec_control; u32 secondary_exec_control; + u32 exception_bitmap; #ifdef __x86_64__ struct vmx_msr_state msr_state; diff -r 78b16cd326dd -r 767e3f4366f8 xen/include/asm-x86/hvm/vmx/vmx.h --- a/xen/include/asm-x86/hvm/vmx/vmx.h Mon Sep 13 17:24:10 2010 +0100 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h Mon Sep 13 17:24:44 2010 +0100 @@ -60,6 +60,8 @@ void vmx_vlapic_msr_changed(struct vcpu void vmx_vlapic_msr_changed(struct vcpu *v); void vmx_realmode(struct cpu_user_regs *regs); void vmx_update_debug_state(struct vcpu *v); +void vmx_update_exception_bitmap(struct vcpu *v); + /* * Exit Reasons @@ -292,16 +294,6 @@ static inline unsigned long __vmread_saf return ecx; } -static inline void __vm_set_bit(unsigned long field, unsigned int bit) -{ - __vmwrite(field, __vmread(field) | (1UL << bit)); -} - -static inline void __vm_clear_bit(unsigned long field, unsigned int bit) -{ - __vmwrite(field, __vmread(field) & ~(1UL << bit)); -} - static inline void __invept(int type, u64 eptp, u64 gpa) { struct { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |