Skip to content

Commit

Permalink
correct idt_vectoring_info handling
Browse files Browse the repository at this point in the history
filter out HW exception and NMI from idt_vectoring_info first:
- queue HW exception through vcpu_queue_exception
- make NMI request through vcpu_make_request
this is a complement patch for previous commit "exception: refine exception
injection path", here take care un-injected vectors for types HW exception &
NMI, the previous commit take care SW exception & external interrupt.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Tian, Kevin <kevin.tian@intel.com>
  • Loading branch information
JasonChenCJ authored and lijinxia committed May 30, 2018
1 parent 7718338 commit 9a604ed
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions hypervisor/arch/x86/vmexit.c
Expand Up @@ -166,6 +166,23 @@ int vmexit_handler(struct vcpu *vcpu)
/* Obtain interrupt info */
vcpu->arch_vcpu.idt_vectoring_info =
exec_vmread(VMX_IDT_VEC_INFO_FIELD);
/* Filter out HW exception & NMI */
if (vcpu->arch_vcpu.idt_vectoring_info & VMX_INT_INFO_VALID) {
uint32_t vector_info = vcpu->arch_vcpu.idt_vectoring_info;
uint32_t vector = vector_info & 0xff;
uint32_t type = (vector_info & VMX_INT_TYPE_MASK) >> 8;
uint32_t err_code = 0;

if (type == VMX_INT_TYPE_HW_EXP) {
if (vector_info & VMX_INT_INFO_ERR_CODE_VALID)
err_code = exec_vmread(VMX_IDT_VEC_ERROR_CODE);
vcpu_queue_exception(vcpu, vector, err_code);
vcpu->arch_vcpu.idt_vectoring_info = 0;
} else if (type == VMX_INT_TYPE_NMI) {
vcpu_make_request(vcpu, ACRN_REQUEST_NMI);
vcpu->arch_vcpu.idt_vectoring_info = 0;
}
}

/* Calculate basic exit reason (low 16-bits) */
basic_exit_reason = vcpu->arch_vcpu.exit_reason & 0xFFFF;
Expand Down

0 comments on commit 9a604ed

Please sign in to comment.