Skip to content

Commit

Permalink
hv: vlapic: move LVT IRQ vector check to vlapic_fire_lvt
Browse files Browse the repository at this point in the history
We could simple the vector check for LVT IRQ by move this check to
vlapic_fire_lvt when the IRQ is fixed mode.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
  • Loading branch information
lifeix authored and wenlingz committed Mar 5, 2019
1 parent 473d31c commit ca3d4fc
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions hypervisor/arch/x86/guest/vlapic.c
Expand Up @@ -793,9 +793,7 @@ vlapic_fire_lvt(struct acrn_vlapic *vlapic, uint32_t lvt)

switch (mode) {
case APIC_LVT_DM_FIXED:
if (vlapic_accept_intr(vlapic, vec, LAPIC_TRIG_EDGE)) {
vcpu_make_request(vcpu, ACRN_REQUEST_EVENT);
}
vlapic_set_intr(vcpu, vec, LAPIC_TRIG_EDGE);
break;
case APIC_LVT_DM_NMI:
vcpu_inject_nmi(vcpu);
Expand Down Expand Up @@ -969,7 +967,7 @@ vlapic_set_error(struct acrn_vlapic *vlapic, uint32_t mask)
static int32_t
vlapic_trigger_lvt(struct acrn_vlapic *vlapic, uint32_t lvt_index)
{
uint32_t lvt, vec, mode;
uint32_t lvt;
int32_t ret = 0;
struct acrn_vcpu *vcpu = vlapic->vcpu;

Expand Down Expand Up @@ -1027,13 +1025,7 @@ vlapic_trigger_lvt(struct acrn_vlapic *vlapic, uint32_t lvt_index)
}

if (ret == 0) {
vec = lvt & APIC_LVT_VECTOR;
mode = lvt & APIC_LVT_DM;
if ((mode == APIC_LVT_DM_FIXED) && (vec < 16U)) {
vlapic_set_error(vlapic, APIC_ESR_RECEIVE_ILLEGAL_VECTOR);
} else {
vlapic_fire_lvt(vlapic, lvt);
}
vlapic_fire_lvt(vlapic, lvt);
}
}
return ret;
Expand Down

0 comments on commit ca3d4fc

Please sign in to comment.