mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 08:50:27 +00:00
Add APIC ACCESS VMexit handler
Update 'apic_access_exit_handler()' function to emulate guest instruments to read/write guest's lapic registers page Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
@@ -37,6 +37,9 @@
|
||||
#include <bsp_extern.h>
|
||||
#include <hv_debug.h>
|
||||
|
||||
#include "instr_emul_wrapper.h"
|
||||
#include "instr_emul.h"
|
||||
|
||||
#include "time.h"
|
||||
#include "vlapic_priv.h"
|
||||
|
||||
@@ -2331,9 +2334,32 @@ apicv_inject_pir(struct vlapic *vlapic)
|
||||
}
|
||||
}
|
||||
|
||||
int apicv_access_exit_handler(__unused struct vcpu *vcpu)
|
||||
int apic_access_exit_handler(struct vcpu *vcpu)
|
||||
{
|
||||
TRACE_2L(TRC_VMEXIT_APICV_ACCESS, 0, 0);
|
||||
bool ret;
|
||||
int access_type, offset;
|
||||
uint64_t qual;
|
||||
struct vlapic *vlapic;
|
||||
|
||||
qual = vcpu->arch_vcpu.exit_qualification;
|
||||
access_type = APIC_ACCESS_TYPE(qual);
|
||||
|
||||
/*parse offset if linear access*/
|
||||
if (access_type <= 3)
|
||||
offset = APIC_ACCESS_OFFSET(qual);
|
||||
|
||||
vlapic = vcpu->arch_vcpu.vlapic;
|
||||
|
||||
analyze_instruction(vcpu, &vcpu->mmio);
|
||||
if (access_type == 1) {
|
||||
if (!emulate_instruction(vcpu, &vcpu->mmio))
|
||||
vlapic_write(vlapic, 1, offset, vcpu->mmio.value, &ret);
|
||||
} else if (access_type == 0) {
|
||||
vlapic_read(vlapic, 1, offset, &vcpu->mmio.value, &ret);
|
||||
emulate_instruction(vcpu, &vcpu->mmio);
|
||||
}
|
||||
|
||||
TRACE_2L(TRC_VMEXIT_APICV_ACCESS, qual, (uint64_t)vlapic);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -125,7 +125,7 @@ static const struct vm_exit_dispatch dispatch_table[] = {
|
||||
[VMX_EXIT_REASON_TPR_BELOW_THRESHOLD] = {
|
||||
.handler = unhandled_vmexit_handler},
|
||||
[VMX_EXIT_REASON_APIC_ACCESS] = {
|
||||
.handler = apicv_access_exit_handler,
|
||||
.handler = apic_access_exit_handler,
|
||||
.need_exit_qualification = 1},
|
||||
[VMX_EXIT_REASON_VIRTUALIZED_EOI] = {
|
||||
.handler = apicv_virtualized_eoi_exit_handler,
|
||||
|
Reference in New Issue
Block a user