Skip to content

Commit f0d2291

Browse files
ywan170lijinxia
authored andcommitted
hv: vioapic: check vector prior to irr in EOI write emulation
Check the vector first to avoid unnecessary irr check. Signed-off-by: Yu Wang <yu1.wang@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent fc41629 commit f0d2291

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

hypervisor/arch/x86/guest/vioapic.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,8 @@ vioapic_write_eoi(struct vioapic *vioapic, uint32_t vector)
284284
for (pin = 0U; pin < pincount; pin++) {
285285
rte = vioapic->rtbl[pin];
286286

287-
if ((rte.full & IOAPIC_RTE_REM_IRR) == 0UL) {
288-
continue;
289-
}
290-
if ((rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC) != vector) {
287+
if (((rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC) != vector) ||
288+
((rte.full & IOAPIC_RTE_REM_IRR) == 0UL)) {
291289
continue;
292290
}
293291

@@ -492,12 +490,11 @@ vioapic_process_eoi(struct vm *vm, uint32_t vector)
492490
/* notify device to ack if assigned pin */
493491
for (pin = 0U; pin < pincount; pin++) {
494492
rte = vioapic->rtbl[pin];
495-
if ((rte.full & IOAPIC_RTE_REM_IRR) == 0UL) {
496-
continue;
497-
}
498-
if ((rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC) != vector) {
493+
if (((rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC) != vector) ||
494+
((rte.full & IOAPIC_RTE_REM_IRR) == 0UL)) {
499495
continue;
500496
}
497+
501498
ptdev_intx_ack(vm, pin, PTDEV_VPIN_IOAPIC);
502499
}
503500

@@ -508,10 +505,8 @@ vioapic_process_eoi(struct vm *vm, uint32_t vector)
508505
VIOAPIC_LOCK(vioapic);
509506
for (pin = 0U; pin < pincount; pin++) {
510507
rte = vioapic->rtbl[pin];
511-
if ((rte.full & IOAPIC_RTE_REM_IRR) == 0UL) {
512-
continue;
513-
}
514-
if ((rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC) != vector) {
508+
if (((rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC) != vector) ||
509+
((rte.full & IOAPIC_RTE_REM_IRR) == 0UL)) {
515510
continue;
516511
}
517512

0 commit comments

Comments
 (0)