hv: vacpi: add ioapic madt table

Add IOAPIC MADT table support so that guest could detect IOAPIC exist.

Tracked-On: #4623
Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
Li Fei1 2020-04-16 09:48:44 +08:00 committed by wenlingz
parent 1dccbdbaa2
commit 113f2f1e35
2 changed files with 8 additions and 1 deletions

View File

@ -87,6 +87,12 @@ static struct acpi_table_info acpi_table_template[CONFIG_MAX_VM_NUM] = {
.address = 0xFEE00000U, /* Local APIC Address */
.flags = 0x1U, /* PC-AT Compatibility=1 */
},
.ioapic_struct = {
.header.type = ACPI_MADT_TYPE_IOAPIC,
.header.length = sizeof(struct acpi_madt_ioapic),
.id = 0x1U,
.addr = VIOAPIC_BASE,
},
.lapic_nmi = {
.header.type = ACPI_MADT_TYPE_LOCAL_APIC_NMI,
.header.length = sizeof(struct acpi_madt_local_apic_nmi),
@ -166,7 +172,7 @@ void build_vacpi(struct acrn_vm *vm)
}
madt = &acpi_table_template[vm->vm_id].madt;
madt->header.length = sizeof(struct acpi_table_madt)
madt->header.length = sizeof(struct acpi_table_madt) + sizeof(struct acpi_madt_ioapic)
+ sizeof(struct acpi_madt_local_apic_nmi)
+ (sizeof(struct acpi_madt_local_apic) * (size_t)vm->hw.created_vcpus);
madt->header.checksum = calculate_checksum8(madt, madt->header.length);

View File

@ -66,6 +66,7 @@ struct acpi_table_info {
struct acpi_table_mcfg mcfg;
struct acpi_mcfg_allocation mcfg_entry; /* mcfg_entry msut be declared fellowing mcfg */
struct acpi_table_madt madt;
struct acpi_madt_ioapic ioapic_struct;
struct acpi_madt_local_apic_nmi lapic_nmi;
struct acpi_madt_local_apic lapic_array[MAX_PCPU_NUM];
} __packed;