align the coding style when access VMEXIT_QUAL

- align coding style to avoid redundant operations
   when operating on reading  VMX_EXIT_QUALIFICATION

Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Yonghua Huang 2018-03-14 00:56:05 +08:00 committed by Jack Ren
parent 337706b6ba
commit 83e78e16c7
3 changed files with 10 additions and 6 deletions

View File

@ -414,7 +414,7 @@ int ept_violation_handler(struct vcpu *vcpu)
uint64_t gpa; uint64_t gpa;
/* Handle page fault from guest */ /* Handle page fault from guest */
exit_qual = exec_vmread(VMX_EXIT_QUALIFICATION); exit_qual = vcpu->arch_vcpu.exit_qualification;
memset(&vcpu->req, 0, sizeof(struct vhm_request)); memset(&vcpu->req, 0, sizeof(struct vhm_request));

View File

@ -2316,7 +2316,7 @@ int apicv_virtualized_eoi_exit_handler(struct vcpu *vcpu)
{ {
struct vlapic *vlapic = NULL; struct vlapic *vlapic = NULL;
int vector = exec_vmread(VMX_EXIT_QUALIFICATION) & 0xFF; int vector;
struct lapic *lapic; struct lapic *lapic;
struct lapic_reg *tmrptr; struct lapic_reg *tmrptr;
uint32_t idx, mask; uint32_t idx, mask;
@ -2325,6 +2325,7 @@ int apicv_virtualized_eoi_exit_handler(struct vcpu *vcpu)
vlapic = vcpu->arch_vcpu.vlapic; vlapic = vcpu->arch_vcpu.vlapic;
lapic = vlapic->apic_page; lapic = vlapic->apic_page;
vector = (vcpu->arch_vcpu.exit_qualification) & 0xFF;
tmrptr = &lapic->tmr[0]; tmrptr = &lapic->tmr[0];
idx = vector / 32; idx = vector / 32;
@ -2347,7 +2348,7 @@ int apicv_write_exit_handler(struct vcpu *vcpu)
int error, handled, offset; int error, handled, offset;
struct vlapic *vlapic = NULL; struct vlapic *vlapic = NULL;
qual = exec_vmread(VMX_EXIT_QUALIFICATION); qual = vcpu->arch_vcpu.exit_qualification;
offset = (qual & 0xFFF); offset = (qual & 0xFFF);
handled = 1; handled = 1;

View File

@ -125,9 +125,11 @@ static const struct vm_exit_dispatch dispatch_table[] = {
[VMX_EXIT_REASON_TPR_BELOW_THRESHOLD] = { [VMX_EXIT_REASON_TPR_BELOW_THRESHOLD] = {
.handler = unhandled_vmexit_handler}, .handler = unhandled_vmexit_handler},
[VMX_EXIT_REASON_APIC_ACCESS] = { [VMX_EXIT_REASON_APIC_ACCESS] = {
.handler = apicv_access_exit_handler}, .handler = apicv_access_exit_handler,
.need_exit_qualification = 1},
[VMX_EXIT_REASON_VIRTUALIZED_EOI] = { [VMX_EXIT_REASON_VIRTUALIZED_EOI] = {
.handler = apicv_virtualized_eoi_exit_handler}, .handler = apicv_virtualized_eoi_exit_handler,
.need_exit_qualification = 1},
[VMX_EXIT_REASON_GDTR_IDTR_ACCESS] = { [VMX_EXIT_REASON_GDTR_IDTR_ACCESS] = {
.handler = unhandled_vmexit_handler}, .handler = unhandled_vmexit_handler},
[VMX_EXIT_REASON_LDTR_TR_ACCESS] = { [VMX_EXIT_REASON_LDTR_TR_ACCESS] = {
@ -151,7 +153,8 @@ static const struct vm_exit_dispatch dispatch_table[] = {
[VMX_EXIT_REASON_XSETBV] = { [VMX_EXIT_REASON_XSETBV] = {
.handler = unhandled_vmexit_handler}, .handler = unhandled_vmexit_handler},
[VMX_EXIT_REASON_APIC_WRITE] = { [VMX_EXIT_REASON_APIC_WRITE] = {
.handler = apicv_write_exit_handler} .handler = apicv_write_exit_handler,
.need_exit_qualification = 1}
}; };
struct vm_exit_dispatch *vmexit_handler(struct vcpu *vcpu) struct vm_exit_dispatch *vmexit_handler(struct vcpu *vcpu)