mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-26 15:31:35 +00:00
exception: use func vcpu_queue_exception to inject exception
use func vcpu_queue_exception for vcpu_inject_gp and exception_vmexit_handler. Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Tian, Kevin <kevin.tian@intel.com>
This commit is contained in:
parent
ebc7ee2e18
commit
75a03bf0f7
@ -930,7 +930,7 @@ vlapic_set_cr8(struct vlapic *vlapic, uint64_t val)
|
||||
uint8_t tpr;
|
||||
|
||||
if (val & ~0xf) {
|
||||
vcpu_inject_gp(vlapic->vcpu);
|
||||
vcpu_inject_gp(vlapic->vcpu, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ int rdmsr_vmexit_handler(struct vcpu *vcpu)
|
||||
case MSR_IA32_MTRR_CAP:
|
||||
case MSR_IA32_MTRR_DEF_TYPE:
|
||||
{
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
break;
|
||||
}
|
||||
case MSR_IA32_BIOS_SIGN_ID:
|
||||
@ -236,7 +236,7 @@ int rdmsr_vmexit_handler(struct vcpu *vcpu)
|
||||
msr <= MSR_IA32_VMX_TRUE_ENTRY_CTLS))) {
|
||||
pr_warn("rdmsr: %lx should not come here!", msr);
|
||||
}
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
v = 0;
|
||||
break;
|
||||
}
|
||||
@ -284,7 +284,7 @@ int wrmsr_vmexit_handler(struct vcpu *vcpu)
|
||||
case MSR_IA32_MTRR_CAP:
|
||||
case MSR_IA32_MTRR_DEF_TYPE:
|
||||
{
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
break;
|
||||
}
|
||||
case MSR_IA32_BIOS_SIGN_ID:
|
||||
@ -348,7 +348,7 @@ int wrmsr_vmexit_handler(struct vcpu *vcpu)
|
||||
msr <= MSR_IA32_VMX_TRUE_ENTRY_CTLS))) {
|
||||
pr_warn("rdmsr: %lx should not come here!", msr);
|
||||
}
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -316,9 +316,10 @@ int vcpu_inject_nmi(struct vcpu *vcpu)
|
||||
return vcpu_make_request(vcpu, ACRN_REQUEST_NMI);
|
||||
}
|
||||
|
||||
int vcpu_inject_gp(struct vcpu *vcpu)
|
||||
int vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code)
|
||||
{
|
||||
return vcpu_make_request(vcpu, ACRN_REQUEST_GP);
|
||||
vcpu_queue_exception(vcpu, IDT_GP, err_code);
|
||||
return vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
|
||||
}
|
||||
|
||||
int interrupt_window_vmexit_handler(struct vcpu *vcpu)
|
||||
@ -533,8 +534,8 @@ int exception_vmexit_handler(struct vcpu *vcpu)
|
||||
|
||||
/* Handle all other exceptions */
|
||||
VCPU_RETAIN_RIP(vcpu);
|
||||
vcpu->arch_vcpu.exception_info.exception = exception_vector;
|
||||
vcpu->arch_vcpu.exception_info.error = int_err_code;
|
||||
|
||||
vcpu_queue_exception(vcpu, exception_vector, int_err_code);
|
||||
|
||||
if (exception_vector == IDT_MC) {
|
||||
/* just print error message for #MC, it then will be injected
|
||||
|
@ -437,7 +437,7 @@ static int xsetbv_vmexit_handler(struct vcpu *vcpu)
|
||||
|
||||
val64 = exec_vmread(VMX_GUEST_CR4);
|
||||
if (!(val64 & CR4_OSXSAVE)) {
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ static int xsetbv_vmexit_handler(struct vcpu *vcpu)
|
||||
|
||||
/*to access XCR0,'rcx' should be 0*/
|
||||
if (ctx_ptr->guest_cpu_regs.regs.rcx != 0) {
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ static int xsetbv_vmexit_handler(struct vcpu *vcpu)
|
||||
|
||||
/*bit 0(x87 state) of XCR0 can't be cleared*/
|
||||
if (!(val64 & 0x01)) {
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ static int xsetbv_vmexit_handler(struct vcpu *vcpu)
|
||||
*to use AVX instructions.
|
||||
**/
|
||||
if (((val64 >> 1) & 0x3) == 0x2) {
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ void vcpu_thread(struct vcpu *vcpu)
|
||||
pr_fatal("dispatch VM exit handler failed for reason"
|
||||
" %d, ret = %d!",
|
||||
vcpu->arch_vcpu.exit_reason & 0xFFFF, ret);
|
||||
vcpu_inject_gp(vcpu);
|
||||
vcpu_inject_gp(vcpu, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -64,10 +64,10 @@ int get_req_info(char *str, int str_max);
|
||||
/*
|
||||
* VCPU related APIs
|
||||
*/
|
||||
#define ACRN_REQUEST_EVENT 0
|
||||
#define ACRN_REQUEST_EXTINT 1
|
||||
#define ACRN_REQUEST_NMI 2
|
||||
#define ACRN_REQUEST_GP 3
|
||||
#define ACRN_REQUEST_EXCP 0
|
||||
#define ACRN_REQUEST_EVENT 1
|
||||
#define ACRN_REQUEST_EXTINT 2
|
||||
#define ACRN_REQUEST_NMI 3
|
||||
#define ACRN_REQUEST_TMR_UPDATE 4
|
||||
#define ACRN_REQUEST_TLB_FLUSH 5
|
||||
#define ACRN_REQUEST_TRP_FAULT 6
|
||||
|
@ -183,7 +183,7 @@ extern spurious_handler_t spurious_handler;
|
||||
|
||||
int vcpu_inject_extint(struct vcpu *vcpu);
|
||||
int vcpu_inject_nmi(struct vcpu *vcpu);
|
||||
int vcpu_inject_gp(struct vcpu *vcpu);
|
||||
int vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code);
|
||||
int vcpu_make_request(struct vcpu *vcpu, int eventid);
|
||||
int vcpu_queue_exception(struct vcpu *vcpu, int32_t vector, uint32_t err_code);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user