ia64/xen-unstable
changeset 15673:8daf61f4d89d
vmx: Simplify event-injection logic.
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kfraser@localhost.localdomain |
---|---|
date | Tue Jul 31 09:39:14 2007 +0100 (2007-07-31) |
parents | 55fb4c6e7702 |
children | 9174a8cfb578 |
files | xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vmx/vmx.h |
line diff
1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c Mon Jul 30 16:03:16 2007 +0100 1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Jul 31 09:39:14 2007 +0100 1.3 @@ -2853,47 +2853,6 @@ static void vmx_do_extint(struct cpu_use 1.4 } 1.5 } 1.6 1.7 -static void vmx_reflect_exception(struct vcpu *v) 1.8 -{ 1.9 - int error_code, intr_info, vector; 1.10 - 1.11 - intr_info = __vmread(VM_EXIT_INTR_INFO); 1.12 - vector = intr_info & 0xff; 1.13 - if ( intr_info & INTR_INFO_DELIVER_CODE_MASK ) 1.14 - error_code = __vmread(VM_EXIT_INTR_ERROR_CODE); 1.15 - else 1.16 - error_code = VMX_DELIVER_NO_ERROR_CODE; 1.17 - 1.18 -#ifndef NDEBUG 1.19 - { 1.20 - unsigned long rip; 1.21 - 1.22 - rip = __vmread(GUEST_RIP); 1.23 - HVM_DBG_LOG(DBG_LEVEL_1, "rip = %lx, error_code = %x", 1.24 - rip, error_code); 1.25 - } 1.26 -#endif /* NDEBUG */ 1.27 - 1.28 - /* 1.29 - * According to Intel Virtualization Technology Specification for 1.30 - * the IA-32 Intel Architecture (C97063-002 April 2005), section 1.31 - * 2.8.3, SW_EXCEPTION should be used for #BP and #OV, and 1.32 - * HW_EXCEPTION used for everything else. The main difference 1.33 - * appears to be that for SW_EXCEPTION, the EIP/RIP is incremented 1.34 - * by VM_ENTER_INSTRUCTION_LEN bytes, whereas for HW_EXCEPTION, 1.35 - * it is not. 1.36 - */ 1.37 - if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_SW_EXCEPTION ) 1.38 - { 1.39 - int ilen = __get_instruction_length(); /* Safe: software exception */ 1.40 - vmx_inject_sw_exception(v, vector, ilen); 1.41 - } 1.42 - else 1.43 - { 1.44 - vmx_inject_hw_exception(v, vector, error_code); 1.45 - } 1.46 -} 1.47 - 1.48 static void vmx_failed_vmentry(unsigned int exit_reason, 1.49 struct cpu_user_regs *regs) 1.50 { 1.51 @@ -3006,14 +2965,11 @@ asmlinkage void vmx_vmexit_handler(struc 1.52 vmx_inject_hw_exception(v, TRAP_page_fault, regs->error_code); 1.53 break; 1.54 case TRAP_nmi: 1.55 - if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI ) 1.56 - { 1.57 - HVMTRACE_0D(NMI, v); 1.58 - vmx_store_cpu_guest_regs(v, regs, NULL); 1.59 - do_nmi(regs); /* Real NMI, vector 2: normal processing. */ 1.60 - } 1.61 - else 1.62 - vmx_reflect_exception(v); 1.63 + if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) != INTR_TYPE_NMI ) 1.64 + goto exit_and_crash; 1.65 + HVMTRACE_0D(NMI, v); 1.66 + vmx_store_cpu_guest_regs(v, regs, NULL); 1.67 + do_nmi(regs); /* Real NMI, vector 2: normal processing. */ 1.68 break; 1.69 case TRAP_machine_check: 1.70 HVMTRACE_0D(MCE, v);
2.1 --- a/xen/include/asm-x86/hvm/vmx/vmx.h Mon Jul 30 16:03:16 2007 +0100 2.2 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h Tue Jul 31 09:39:14 2007 +0100 2.3 @@ -263,8 +263,8 @@ static inline int __vmxon (u64 addr) 2.4 return rc; 2.5 } 2.6 2.7 -static inline void __vmx_inject_exception(struct vcpu *v, int trap, int type, 2.8 - int error_code, int ilen) 2.9 +static inline void __vmx_inject_exception( 2.10 + struct vcpu *v, int trap, int type, int error_code) 2.11 { 2.12 unsigned long intr_fields; 2.13 2.14 @@ -282,9 +282,6 @@ static inline void __vmx_inject_exceptio 2.15 intr_fields |= INTR_INFO_DELIVER_CODE_MASK; 2.16 } 2.17 2.18 - if ( ilen ) 2.19 - __vmwrite(VM_ENTRY_INSTRUCTION_LEN, ilen); 2.20 - 2.21 __vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields); 2.22 2.23 if (trap == TRAP_page_fault) 2.24 @@ -297,28 +294,19 @@ static inline void vmx_inject_hw_excepti 2.25 struct vcpu *v, int trap, int error_code) 2.26 { 2.27 v->arch.hvm_vmx.vector_injected = 1; 2.28 - __vmx_inject_exception(v, trap, INTR_TYPE_HW_EXCEPTION, error_code, 0); 2.29 -} 2.30 - 2.31 -static inline void vmx_inject_sw_exception( 2.32 - struct vcpu *v, int trap, int instruction_len) 2.33 -{ 2.34 - v->arch.hvm_vmx.vector_injected = 1; 2.35 - __vmx_inject_exception(v, trap, INTR_TYPE_SW_EXCEPTION, 2.36 - VMX_DELIVER_NO_ERROR_CODE, 2.37 - instruction_len); 2.38 + __vmx_inject_exception(v, trap, INTR_TYPE_HW_EXCEPTION, error_code); 2.39 } 2.40 2.41 static inline void vmx_inject_extint(struct vcpu *v, int trap) 2.42 { 2.43 __vmx_inject_exception(v, trap, INTR_TYPE_EXT_INTR, 2.44 - VMX_DELIVER_NO_ERROR_CODE, 0); 2.45 + VMX_DELIVER_NO_ERROR_CODE); 2.46 } 2.47 2.48 static inline void vmx_inject_nmi(struct vcpu *v) 2.49 { 2.50 __vmx_inject_exception(v, 2, INTR_TYPE_NMI, 2.51 - VMX_DELIVER_NO_ERROR_CODE, 0); 2.52 + VMX_DELIVER_NO_ERROR_CODE); 2.53 } 2.54 2.55 #endif /* __ASM_X86_HVM_VMX_VMX_H__ */