hv: add ioapic reset function

ioapic reset function will be called when doing guest reset.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yin Fengwei 2018-06-28 17:37:40 +08:00 committed by lijinxia
parent 8b9fb3780a
commit 2a819366ae
2 changed files with 12 additions and 3 deletions

View File

@ -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,

View File

@ -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);