diff --git a/devicemodel/hw/platform/acpi/acpi.c b/devicemodel/hw/platform/acpi/acpi.c index 6950039fe..891f16321 100644 --- a/devicemodel/hw/platform/acpi/acpi.c +++ b/devicemodel/hw/platform/acpi/acpi.c @@ -272,17 +272,17 @@ basl_fwrite_madt(FILE *fp, struct vmctx *ctx) EFPRINTF(fp, "\n"); } - if (!is_rtvm) { - /* Always a single IOAPIC entry, with ID 0 */ - EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n"); - EFPRINTF(fp, "[0001]\t\tLength : 0C\n"); - /* iasl expects a hex value for the i/o apic id */ - EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0); - EFPRINTF(fp, "[0001]\t\tReserved : 00\n"); - EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n"); - EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n"); - EFPRINTF(fp, "\n"); + /* Always a single IOAPIC entry, with ID 0 */ + EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n"); + EFPRINTF(fp, "[0001]\t\tLength : 0C\n"); + /* iasl expects a hex value for the i/o apic id */ + EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0); + EFPRINTF(fp, "[0001]\t\tReserved : 00\n"); + EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n"); + EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n"); + EFPRINTF(fp, "\n"); + if (!is_rtvm) { /* Legacy IRQ0 is connected to pin 2 of the IOAPIC */ EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 4f9697e29..0dda5e486 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -471,10 +471,12 @@ int32_t create_vm(uint16_t vm_id, uint64_t pcpu_bitmap, struct acrn_vm_config *v /* vpic wire_mode default is INTR */ vm->wire_mode = VPIC_WIRE_INTR; - /* Init full emulated vIOAPIC instance */ - if (!is_lapic_pt_configured(vm)) { - vioapic_init(vm); - } + /* Init full emulated vIOAPIC instance: + * Present a virtual IOAPIC to guest, as a placeholder interrupt controller, + * even if the guest uses PT LAPIC. This is to satisfy the guest OSes, + * in some cases, though the functionality of vIOAPIC doesn't work. + */ + vioapic_init(vm); /* Populate return VM handle */ *rtn_vm = vm; diff --git a/hypervisor/dm/vioapic.c b/hypervisor/dm/vioapic.c index 6e936d286..9e967b2b3 100644 --- a/hypervisor/dm/vioapic.c +++ b/hypervisor/dm/vioapic.c @@ -150,7 +150,6 @@ vgsi_to_vioapic_and_vpin(const struct acrn_vm *vm, uint32_t vgsi, uint32_t *vpin * * @pre vgsi < get_vm_gsicount(vm) * @pre vm != NULL - * @pre vioapic->ready == true * @return None */ void @@ -204,11 +203,9 @@ vioapic_set_irqline_lock(const struct acrn_vm *vm, uint32_t vgsi, uint32_t opera struct acrn_single_vioapic *vioapic; vioapic = vgsi_to_vioapic_and_vpin(vm, vgsi, NULL); - if (vioapic->ready) { - spinlock_irqsave_obtain(&(vioapic->lock), &rflags); - vioapic_set_irqline_nolock(vm, vgsi, operation); - spinlock_irqrestore_release(&(vioapic->lock), rflags); - } + spinlock_irqsave_obtain(&(vioapic->lock), &rflags); + vioapic_set_irqline_nolock(vm, vgsi, operation); + spinlock_irqrestore_release(&(vioapic->lock), rflags); } static uint32_t @@ -420,7 +417,6 @@ vioapic_mmio_rw(struct acrn_single_vioapic *vioapic, uint64_t gpa, /* * @pre vm != NULL - * @pre vioapic->ready == true */ static void vioapic_process_eoi(struct acrn_single_vioapic *vioapic, uint32_t vector) @@ -537,7 +533,6 @@ vioapic_init(struct acrn_vm *vm) register_mmio_emulation_handler(vm, vioapic_mmio_access_handler, (uint64_t)vioapic->chipinfo.addr, (uint64_t)vioapic->chipinfo.addr + VIOAPIC_SIZE, (void *)vioapic, false); ept_del_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp, (uint64_t)vioapic->chipinfo.addr, VIOAPIC_SIZE); - vioapic->ready = true; } /* @@ -557,7 +552,6 @@ get_vm_gsicount(const struct acrn_vm *vm) /* * @pre handler_private_data != NULL - * @pre vioapic->ready == true */ int32_t vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data) { diff --git a/hypervisor/include/dm/vioapic.h b/hypervisor/include/dm/vioapic.h index 15e3bafba..6a157bca1 100644 --- a/hypervisor/include/dm/vioapic.h +++ b/hypervisor/include/dm/vioapic.h @@ -57,7 +57,6 @@ struct acrn_single_vioapic { spinlock_t lock; struct acrn_vm *vm; struct ioapic_info chipinfo; - bool ready; uint32_t ioregsel; union ioapic_rte rtbl[REDIR_ENTRIES_HW]; /* pin_state status bitmap: 1 - high, 0 - low */