[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/emul: Rename HVM_DELIVER_NO_ERROR_CODE to X86_EVENT_NO_EC
commit 3a9c68ff0f65022e4424136f1cc6cb2b30294e50 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Mon Nov 7 13:14:03 2016 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri Dec 2 17:23:01 2016 +0000 x86/emul: Rename HVM_DELIVER_NO_ERROR_CODE to X86_EVENT_NO_EC and move it to live with the other x86_event infrastructure in x86_emulate.h. Switch it and x86_event.error_code to being signed, matching the rest of the code. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/hvm/emulate.c | 5 ++--- xen/arch/x86/hvm/hvm.c | 6 +++--- xen/arch/x86/hvm/nestedhvm.c | 2 +- xen/arch/x86/hvm/svm/nestedsvm.c | 6 +++--- xen/arch/x86/hvm/svm/svm.c | 20 ++++++++++---------- xen/arch/x86/hvm/vmx/intr.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 25 +++++++++++++------------ xen/arch/x86/hvm/vmx/vvmx.c | 2 +- xen/arch/x86/x86_emulate/x86_emulate.h | 3 ++- xen/include/asm-x86/hvm/support.h | 2 -- 10 files changed, 36 insertions(+), 37 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index bb26d40..bc259ec 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -1609,7 +1609,7 @@ static int hvmemul_inject_sw_interrupt( hvmemul_ctxt->exn_pending = 1; hvmemul_ctxt->trap.vector = vector; - hvmemul_ctxt->trap.error_code = HVM_DELIVER_NO_ERROR_CODE; + hvmemul_ctxt->trap.error_code = X86_EVENT_NO_EC; hvmemul_ctxt->trap.insn_len = insn_len; return X86EMUL_OKAY; @@ -1696,8 +1696,7 @@ static int hvmemul_vmfunc( rc = hvm_funcs.altp2m_vcpu_emulate_vmfunc(ctxt->regs); if ( rc != X86EMUL_OKAY ) - hvmemul_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE, - ctxt); + hvmemul_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC, ctxt); return rc; } diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 9f63abe..4ad2151 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -502,7 +502,7 @@ void hvm_do_resume(struct vcpu *v) kind = EMUL_KIND_SET_CONTEXT_INSN; hvm_emulate_one_vm_event(kind, TRAP_invalid_op, - HVM_DELIVER_NO_ERROR_CODE); + X86_EVENT_NO_EC); v->arch.vm_event->emulate_flags = 0; } @@ -3054,7 +3054,7 @@ void hvm_task_switch( } if ( (tss.trace & 1) && !exn_raised ) - hvm_inject_hw_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_debug, X86_EVENT_NO_EC); out: hvm_unmap_entry(optss_desc); @@ -4074,7 +4074,7 @@ void hvm_ud_intercept(struct cpu_user_regs *regs) switch ( hvm_emulate_one(&ctxt) ) { case X86EMUL_UNHANDLEABLE: - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); break; case X86EMUL_EXCEPTION: if ( ctxt.exn_pending ) diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c index caad525..c4671d8 100644 --- a/xen/arch/x86/hvm/nestedhvm.c +++ b/xen/arch/x86/hvm/nestedhvm.c @@ -17,7 +17,7 @@ */ #include <asm/msr.h> -#include <asm/hvm/support.h> /* for HVM_DELIVER_NO_ERROR_CODE */ +#include <asm/hvm/support.h> #include <asm/hvm/hvm.h> #include <asm/p2m.h> /* for struct p2m_domain */ #include <asm/hvm/nestedhvm.h> diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c index b6b8526..8c9b073 100644 --- a/xen/arch/x86/hvm/svm/nestedsvm.c +++ b/xen/arch/x86/hvm/svm/nestedsvm.c @@ -756,7 +756,7 @@ nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs) default: gdprintk(XENLOG_ERR, "nsvm_vcpu_vmentry failed, injecting #UD\n"); - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); /* Must happen after hvm_inject_hw_exception or it doesn't work right. */ nv->nv_vmswitch_in_progress = 0; return 1; @@ -1581,7 +1581,7 @@ void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v) unsigned int inst_len; if ( !nestedhvm_enabled(v->domain) ) { - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); return; } @@ -1601,7 +1601,7 @@ void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v) vintr_t intr; if ( !nestedhvm_enabled(v->domain) ) { - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); return; } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index caab5ce..912d871 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -89,7 +89,7 @@ static DEFINE_SPINLOCK(osvw_lock); static void svm_crash_or_fault(struct vcpu *v) { if ( vmcb_get_cpl(v->arch.hvm_svm.vmcb) ) - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); else domain_crash(v->domain); } @@ -116,7 +116,7 @@ void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len) curr->arch.hvm_svm.vmcb->interrupt_shadow = 0; if ( regs->eflags & X86_EFLAGS_TF ) - hvm_inject_hw_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_debug, X86_EVENT_NO_EC); } static void svm_cpu_down(void) @@ -1285,7 +1285,7 @@ static void svm_inject_event(const struct x86_event *event) default: eventinj.fields.type = X86_EVENTTYPE_HW_EXCEPTION; - eventinj.fields.ev = (_event.error_code != HVM_DELIVER_NO_ERROR_CODE); + eventinj.fields.ev = (_event.error_code != X86_EVENT_NO_EC); eventinj.fields.errorcode = _event.error_code; break; } @@ -1553,7 +1553,7 @@ static void svm_fpu_dirty_intercept(void) { /* Check if l1 guest must make FPU ready for the l2 guest */ if ( v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_TS ) - hvm_inject_hw_exception(TRAP_no_device, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_no_device, X86_EVENT_NO_EC); else vmcb_set_cr0(n1vmcb, vmcb_get_cr0(n1vmcb) & ~X86_CR0_TS); return; @@ -2022,7 +2022,7 @@ svm_vmexit_do_vmrun(struct cpu_user_regs *regs, if ( !nsvm_efer_svm_enabled(v) ) { gdprintk(XENLOG_ERR, "VMRUN: nestedhvm disabled, injecting #UD\n"); - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); return; } @@ -2077,7 +2077,7 @@ svm_vmexit_do_vmload(struct vmcb_struct *vmcb, if ( !nsvm_efer_svm_enabled(v) ) { gdprintk(XENLOG_ERR, "VMLOAD: nestedhvm disabled, injecting #UD\n"); - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); return; } @@ -2113,7 +2113,7 @@ svm_vmexit_do_vmsave(struct vmcb_struct *vmcb, if ( !nsvm_efer_svm_enabled(v) ) { gdprintk(XENLOG_ERR, "VMSAVE: nestedhvm disabled, injecting #UD\n"); - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); return; } @@ -2416,7 +2416,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) case VMEXIT_EXCEPTION_DB: if ( !v->domain->debugger_attached ) - hvm_inject_hw_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_debug, X86_EVENT_NO_EC); else domain_pause_for_debugger(); break; @@ -2604,7 +2604,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) case VMEXIT_MONITOR: case VMEXIT_MWAIT: - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); break; case VMEXIT_VMRUN: @@ -2623,7 +2623,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) svm_vmexit_do_clgi(regs, v); break; case VMEXIT_SKINIT: - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); break; case VMEXIT_XSETBV: diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index 8fca08c..639a705 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -302,7 +302,7 @@ void vmx_intr_assist(void) } else if ( intack.source == hvm_intsrc_mce ) { - hvm_inject_hw_exception(TRAP_machine_check, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_machine_check, X86_EVENT_NO_EC); } else if ( cpu_has_vmx_virtual_intr_delivery && intack.source != hvm_intsrc_pic && diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 678cd64..d4a5027 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1586,7 +1586,8 @@ static void __vmx_inject_exception(int trap, int type, int error_code) intr_fields = INTR_INFO_VALID_MASK | MASK_INSR(type, INTR_INFO_INTR_TYPE_MASK) | MASK_INSR(trap, INTR_INFO_VECTOR_MASK); - if ( error_code != HVM_DELIVER_NO_ERROR_CODE ) { + if ( error_code != X86_EVENT_NO_EC ) + { __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code); intr_fields |= INTR_INFO_DELIVER_CODE_MASK; } @@ -1611,12 +1612,12 @@ void vmx_inject_extint(int trap, uint8_t source) INTR_INFO_VALID_MASK | MASK_INSR(X86_EVENTTYPE_EXT_INTR, INTR_INFO_INTR_TYPE_MASK) | MASK_INSR(trap, INTR_INFO_VECTOR_MASK), - HVM_DELIVER_NO_ERROR_CODE, source); + X86_EVENT_NO_EC, source); return; } } __vmx_inject_exception(trap, X86_EVENTTYPE_EXT_INTR, - HVM_DELIVER_NO_ERROR_CODE); + X86_EVENT_NO_EC); } void vmx_inject_nmi(void) @@ -1631,12 +1632,12 @@ void vmx_inject_nmi(void) INTR_INFO_VALID_MASK | MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK) | MASK_INSR(TRAP_nmi, INTR_INFO_VECTOR_MASK), - HVM_DELIVER_NO_ERROR_CODE, hvm_intsrc_nmi); + X86_EVENT_NO_EC, hvm_intsrc_nmi); return; } } __vmx_inject_exception(2, X86_EVENTTYPE_NMI, - HVM_DELIVER_NO_ERROR_CODE); + X86_EVENT_NO_EC); } /* @@ -2051,7 +2052,7 @@ static bool_t vmx_vcpu_emulate_ve(struct vcpu *v) vmx_vmcs_exit(v); hvm_inject_hw_exception(TRAP_virtualisation, - HVM_DELIVER_NO_ERROR_CODE); + X86_EVENT_NO_EC); out: hvm_unmap_guest_frame(veinfo, 0); @@ -2327,7 +2328,7 @@ void update_guest_eip(void) } if ( regs->eflags & X86_EFLAGS_TF ) - hvm_inject_hw_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_debug, X86_EVENT_NO_EC); } static void vmx_fpu_dirty_intercept(void) @@ -2855,7 +2856,7 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content) if ( (rc < 0) || (msr_content && (vmx_add_host_load_msr(msr) < 0)) ) - hvm_inject_hw_exception(TRAP_machine_check, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_machine_check, X86_EVENT_NO_EC); else __vmwrite(GUEST_IA32_DEBUGCTL, msr_content); @@ -3153,7 +3154,7 @@ static void vmx_propagate_intr(unsigned long intr) event.error_code = tmp; } else - event.error_code = HVM_DELIVER_NO_ERROR_CODE; + event.error_code = X86_EVENT_NO_EC; if ( event.type >= X86_EVENTTYPE_SW_INTERRUPT ) { @@ -3710,7 +3711,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) case EXIT_REASON_VMFUNC: if ( vmx_vmfunc_intercept(regs) != X86EMUL_OKAY ) - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); else update_guest_eip(); break; @@ -3724,7 +3725,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) * as far as vmexit. */ WARN_ON(exit_reason == EXIT_REASON_GETSEC); - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); break; case EXIT_REASON_TPR_BELOW_THRESHOLD: @@ -3849,7 +3850,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) vmx_get_segment_register(v, x86_seg_ss, &ss); if ( ss.attr.fields.dpl ) hvm_inject_hw_exception(TRAP_invalid_op, - HVM_DELIVER_NO_ERROR_CODE); + X86_EVENT_NO_EC); else domain_crash(v->domain); } diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index b5837d4..efaf54c 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -380,7 +380,7 @@ vmexit: invalid_op: gdprintk(XENLOG_ERR, "vmx_inst_check_privilege: invalid_op\n"); - hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); return X86EMUL_EXCEPTION; gp_fault: diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h index 54c532c..b0f0304 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.h +++ b/xen/arch/x86/x86_emulate/x86_emulate.h @@ -80,12 +80,13 @@ enum x86_event_type { X86_EVENTTYPE_PRI_SW_EXCEPTION, /* ICEBP (F1) */ X86_EVENTTYPE_SW_EXCEPTION, /* INT3 (CC), INTO (CE) */ }; +#define X86_EVENT_NO_EC (-1) /* No error code. */ struct x86_event { int16_t vector; uint8_t type; /* X86_EVENTTYPE_* */ uint8_t insn_len; /* Instruction length */ - uint32_t error_code; /* HVM_DELIVER_NO_ERROR_CODE if n/a */ + int32_t error_code; /* X86_EVENT_NO_EC if n/a */ unsigned long cr2; /* Only for TRAP_page_fault h/w exception */ }; diff --git a/xen/include/asm-x86/hvm/support.h b/xen/include/asm-x86/hvm/support.h index 2984abc..9938450 100644 --- a/xen/include/asm-x86/hvm/support.h +++ b/xen/include/asm-x86/hvm/support.h @@ -25,8 +25,6 @@ #include <xen/hvm/save.h> #include <asm/processor.h> -#define HVM_DELIVER_NO_ERROR_CODE (~0U) - #ifndef NDEBUG #define DBG_LEVEL_0 (1 << 0) #define DBG_LEVEL_1 (1 << 1) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |