Skip to content

Commit e5d3a49

Browse files
lifeixwenlingz
authored andcommitted
hv: vlapic: call vlapic_accept_intr directly in vlapic_set_error
LVT ERROR is an edge and fixed mode interrupt. We could call vlapic_accept_intr to fire it directly. Otherwise, if LVT ERR vector is invalid, an invalid interrupt will be accepted in IRR. Tracked-On: #1842 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
1 parent 2b35c07 commit e5d3a49

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ vlapic_fire_lvt(struct acrn_vlapic *vlapic, uint32_t lvt)
793793

794794
switch (mode) {
795795
case APIC_LVT_DM_FIXED:
796-
if (vlapic_accept_intr(vlapic, vec, false)) {
796+
if (vlapic_accept_intr(vlapic, vec, LAPIC_TRIG_EDGE)) {
797797
vcpu_make_request(vcpu, ACRN_REQUEST_EVENT);
798798
}
799799
break;
@@ -944,15 +944,22 @@ vlapic_process_eoi(struct acrn_vlapic *vlapic)
944944
static void
945945
vlapic_set_error(struct acrn_vlapic *vlapic, uint32_t mask)
946946
{
947-
uint32_t lvt;
947+
uint32_t lvt, vec;
948948

949949
vlapic->esr_pending |= mask;
950950
if (vlapic->esr_firing == 0) {
951951
vlapic->esr_firing = 1;
952952

953953
/* The error LVT always uses the fixed delivery mode. */
954954
lvt = vlapic_get_lvt(vlapic, APIC_OFFSET_ERROR_LVT);
955-
vlapic_fire_lvt(vlapic, lvt | APIC_LVT_DM_FIXED);
955+
if ((lvt & APIC_LVT_M) == 0U) {
956+
vec = lvt & APIC_LVT_VECTOR;
957+
if (vec >= 16U) {
958+
if (vlapic_accept_intr(vlapic, vec, LAPIC_TRIG_EDGE)) {
959+
vcpu_make_request(vlapic->vcpu, ACRN_REQUEST_EVENT);
960+
}
961+
}
962+
}
956963
vlapic->esr_firing = 0;
957964
}
958965
}

0 commit comments

Comments
 (0)