Skip to content

Commit 2a81936

Browse files
fyin1lijinxia
authored andcommitted
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>
1 parent 8b9fb37 commit 2a81936

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

hypervisor/arch/x86/guest/vioapic.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,16 @@ vioapic_process_eoi(struct vm *vm, uint32_t vector)
523523
VIOAPIC_UNLOCK(vioapic);
524524
}
525525

526+
void
527+
vioapic_reset(struct vioapic *vioapic)
528+
{
529+
int i;
530+
531+
/* Initialize all redirection entries to mask all interrupts */
532+
for (i = 0; i < vioapic_pincount(vioapic->vm); i++)
533+
vioapic->rtbl[i].reg = 0x0001000000010000UL;
534+
}
535+
526536
struct vioapic *
527537
vioapic_init(struct vm *vm)
528538
{
@@ -535,9 +545,7 @@ vioapic_init(struct vm *vm)
535545
vioapic->vm = vm;
536546
spinlock_init(&vioapic->mtx);
537547

538-
/* Initialize all redirection entries to mask all interrupts */
539-
for (i = 0; i < vioapic_pincount(vioapic->vm); i++)
540-
vioapic->rtbl[i].reg = 0x0001000000010000UL;
548+
vioapic_reset(vioapic);
541549

542550
register_mmio_emulation_handler(vm,
543551
vioapic_mmio_access_handler,

hypervisor/include/arch/x86/guest/vioapic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
struct vioapic *vioapic_init(struct vm *vm);
3838
void vioapic_cleanup(struct vioapic *vioapic);
39+
void vioapic_reset(struct vioapic *vioapic);
3940

4041
int vioapic_assert_irq(struct vm *vm, uint32_t irq);
4142
int vioapic_deassert_irq(struct vm *vm, uint32_t irq);

0 commit comments

Comments
 (0)