Skip to content

Commit 127c98f

Browse files
Cai Yulongacrnsi
authored andcommitted
hv: vioapic: fix interrupt lost and redundant interrupt
1. reset polarity of ptirq_remapping_info to zero. this help to set correct initial pin state, and fix the interrupt lost issue when assign a ptirq to uos. 2. since vioapic_generate_intr relys on rte, we should build rte before generating an interrput, this fix the redundant interrupt. Tracked-On: #3362 Signed-off-by: Cai Yulong <yulongc@hwtc.com.cn>
1 parent e720dda commit 127c98f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

hypervisor/arch/x86/guest/assign.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ static struct ptirq_remapping_info *add_intx_remapping(struct acrn_vm *vm, uint3
391391
if (is_sos_vm(entry->vm)) {
392392
entry->vm = vm;
393393
entry->virt_sid.value = virt_sid.value;
394+
entry->polarity = 0U;
394395
} else {
395396
pr_err("INTX pin%d already in vm%d with vpin%d, not able to add into vm%d with vpin%d",
396397
phys_pin, entry->vm->vm_id, entry->virt_sid.intx_id.pin, vm->vm_id, virt_pin);

hypervisor/dm/vioapic.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ static void vioapic_indirect_write(struct acrn_vioapic *vioapic, uint32_t addr,
326326
dev_dbg(ACRN_DBG_IOAPIC, "ioapic pin%hhu: redir table entry %#lx",
327327
pin, vioapic->rtbl[pin].full);
328328

329+
/* remap for ptdev */
330+
if ((new.bits.intr_mask == IOAPIC_RTE_MASK_CLR) || (last.bits.intr_mask == IOAPIC_RTE_MASK_CLR)) {
331+
/* VM enable intr */
332+
/* NOTE: only support max 256 pin */
333+
(void)ptirq_intx_pin_remap(vioapic->vm, pin, PTDEV_VPIN_IOAPIC);
334+
}
335+
329336
/*
330337
* Generate an interrupt if the following conditions are met:
331338
* - pin is not masked
@@ -338,13 +345,6 @@ static void vioapic_indirect_write(struct acrn_vioapic *vioapic, uint32_t addr,
338345
dev_dbg(ACRN_DBG_IOAPIC, "ioapic pin%hhu: asserted at rtbl write", pin);
339346
vioapic_generate_intr(vioapic, pin);
340347
}
341-
342-
/* remap for ptdev */
343-
if ((new.bits.intr_mask == IOAPIC_RTE_MASK_CLR) || (last.bits.intr_mask == IOAPIC_RTE_MASK_CLR)) {
344-
/* VM enable intr */
345-
/* NOTE: only support max 256 pin */
346-
(void)ptirq_intx_pin_remap(vioapic->vm, pin, PTDEV_VPIN_IOAPIC);
347-
}
348348
}
349349
}
350350
}

0 commit comments

Comments
 (0)