diff --git a/hypervisor/arch/x86/guest/vioapic.c b/hypervisor/arch/x86/guest/vioapic.c index 84f9f94ba..febdc69e6 100644 --- a/hypervisor/arch/x86/guest/vioapic.c +++ b/hypervisor/arch/x86/guest/vioapic.c @@ -523,6 +523,16 @@ vioapic_process_eoi(struct vm *vm, uint32_t vector) VIOAPIC_UNLOCK(vioapic); } +void +vioapic_reset(struct vioapic *vioapic) +{ + int i; + + /* Initialize all redirection entries to mask all interrupts */ + for (i = 0; i < vioapic_pincount(vioapic->vm); i++) + vioapic->rtbl[i].reg = 0x0001000000010000UL; +} + struct vioapic * vioapic_init(struct vm *vm) { @@ -535,9 +545,7 @@ vioapic_init(struct vm *vm) vioapic->vm = vm; spinlock_init(&vioapic->mtx); - /* Initialize all redirection entries to mask all interrupts */ - for (i = 0; i < vioapic_pincount(vioapic->vm); i++) - vioapic->rtbl[i].reg = 0x0001000000010000UL; + vioapic_reset(vioapic); register_mmio_emulation_handler(vm, vioapic_mmio_access_handler, diff --git a/hypervisor/include/arch/x86/guest/vioapic.h b/hypervisor/include/arch/x86/guest/vioapic.h index 77d64af85..1aaf27ff5 100644 --- a/hypervisor/include/arch/x86/guest/vioapic.h +++ b/hypervisor/include/arch/x86/guest/vioapic.h @@ -36,6 +36,7 @@ struct vioapic *vioapic_init(struct vm *vm); void vioapic_cleanup(struct vioapic *vioapic); +void vioapic_reset(struct vioapic *vioapic); int vioapic_assert_irq(struct vm *vm, uint32_t irq); int vioapic_deassert_irq(struct vm *vm, uint32_t irq);