From 771f15cd6b27a2003332622e17a01ace5ad3ad24 Mon Sep 17 00:00:00 2001 From: "Yan, Like" Date: Mon, 3 Jun 2019 17:18:48 +0800 Subject: [PATCH] dm: don't present ioapic and pic to RT VM Per ACRN RT VM design, there is no virtual IOAPIC and virtual PIC emulated for RT VM. This commit removes the entries of IOAPIC, PIC, PPRT and APRT in ACPI table for RT VM. Tracked-On: #3227 Signed-off-by: Yan, Like Reviewed-by: Eddie Dong Acked-by: Anthony Xu --- devicemodel/core/main.c | 1 - devicemodel/hw/pci/core.c | 48 ++++++++++++------------ devicemodel/hw/pci/lpc.c | 30 ++++++++------- devicemodel/hw/platform/acpi/acpi.c | 58 +++++++++++++++-------------- 4 files changed, 71 insertions(+), 66 deletions(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index eb37e4406..90629f54f 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -915,7 +915,6 @@ main(int argc, char *argv[]) break; case CMD_OPT_LAPIC_PT: lapic_pt = true; - break; case CMD_OPT_RTVM: is_rtvm = true; break; diff --git a/devicemodel/hw/pci/core.c b/devicemodel/hw/pci/core.c index 047fc90a3..a29b60c2d 100644 --- a/devicemodel/hw/pci/core.c +++ b/devicemodel/hw/pci/core.c @@ -1598,29 +1598,31 @@ pci_bus_write_dsdt(int bus) dsdt_line(" ,, , AddressRangeMemory, TypeStatic)"); dsdt_line(" })"); - count = pci_count_lintr(bus); - if (count != 0) { - dsdt_indent(2); - dsdt_line("Name (PPRT, Package ()"); - dsdt_line("{"); - pci_walk_lintr(bus, pci_pirq_prt_entry, NULL); - dsdt_line("})"); - dsdt_line("Name (APRT, Package ()"); - dsdt_line("{"); - pci_walk_lintr(bus, pci_apic_prt_entry, NULL); - dsdt_line("})"); - dsdt_line("Method (_PRT, 0, NotSerialized)"); - dsdt_line("{"); - dsdt_line(" If (PICM)"); - dsdt_line(" {"); - dsdt_line(" Return (APRT)"); - dsdt_line(" }"); - dsdt_line(" Else"); - dsdt_line(" {"); - dsdt_line(" Return (PPRT)"); - dsdt_line(" }"); - dsdt_line("}"); - dsdt_unindent(2); + if (!is_rtvm) { + count = pci_count_lintr(bus); + if (count != 0) { + dsdt_indent(2); + dsdt_line("Name (PPRT, Package ()"); + dsdt_line("{"); + pci_walk_lintr(bus, pci_pirq_prt_entry, NULL); + dsdt_line("})"); + dsdt_line("Name (APRT, Package ()"); + dsdt_line("{"); + pci_walk_lintr(bus, pci_apic_prt_entry, NULL); + dsdt_line("})"); + dsdt_line("Method (_PRT, 0, NotSerialized)"); + dsdt_line("{"); + dsdt_line(" If (PICM)"); + dsdt_line(" {"); + dsdt_line(" Return (APRT)"); + dsdt_line(" }"); + dsdt_line(" Else"); + dsdt_line(" {"); + dsdt_line(" Return (PPRT)"); + dsdt_line(" }"); + dsdt_line("}"); + dsdt_unindent(2); + } } dsdt_indent(2); diff --git a/devicemodel/hw/pci/lpc.c b/devicemodel/hw/pci/lpc.c index cc14d9759..3d42498c8 100644 --- a/devicemodel/hw/pci/lpc.c +++ b/devicemodel/hw/pci/lpc.c @@ -33,6 +33,7 @@ #include #include +#include "dm.h" #include "vmmapi.h" #include "acpi.h" #include "inout.h" @@ -262,20 +263,21 @@ pci_lpc_write_dsdt(struct pci_vdev *dev) ldp->handler(); } - dsdt_line(""); - dsdt_line("Device (PIC)"); - dsdt_line("{"); - dsdt_line(" Name (_HID, EisaId (\"PNP0000\"))"); - dsdt_line(" Name (_CRS, ResourceTemplate ()"); - dsdt_line(" {"); - dsdt_indent(2); - dsdt_fixed_ioport(IO_ICU1, 2); - dsdt_fixed_ioport(IO_ICU2, 2); - dsdt_fixed_irq(2); - dsdt_unindent(2); - dsdt_line(" })"); - dsdt_line("}"); - + if(!is_rtvm) { + dsdt_line(""); + dsdt_line("Device (PIC)"); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0000\"))"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_indent(2); + dsdt_fixed_ioport(IO_ICU1, 2); + dsdt_fixed_ioport(IO_ICU2, 2); + dsdt_fixed_irq(2); + dsdt_unindent(2); + dsdt_line(" })"); + dsdt_line("}"); + } dsdt_line(""); dsdt_line("Device (TIMR)"); dsdt_line("{"); diff --git a/devicemodel/hw/platform/acpi/acpi.c b/devicemodel/hw/platform/acpi/acpi.c index 72cb90346..c133982c9 100644 --- a/devicemodel/hw/platform/acpi/acpi.c +++ b/devicemodel/hw/platform/acpi/acpi.c @@ -280,36 +280,38 @@ basl_fwrite_madt(FILE *fp, struct vmctx *ctx) 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) { + /* 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"); - /* 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"); - EFPRINTF(fp, "[0001]\t\tBus : 00\n"); - EFPRINTF(fp, "[0001]\t\tSource : 00\n"); - EFPRINTF(fp, "[0004]\t\tInterrupt : 00000002\n"); - EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n"); - EFPRINTF(fp, "\t\t\tPolarity : 1\n"); - EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n"); - EFPRINTF(fp, "\n"); + /* 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"); + EFPRINTF(fp, "[0001]\t\tBus : 00\n"); + EFPRINTF(fp, "[0001]\t\tSource : 00\n"); + EFPRINTF(fp, "[0004]\t\tInterrupt : 00000002\n"); + EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n"); + EFPRINTF(fp, "\t\t\tPolarity : 1\n"); + EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n"); + EFPRINTF(fp, "\n"); - EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); - EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); - EFPRINTF(fp, "[0001]\t\tBus : 00\n"); - EFPRINTF(fp, "[0001]\t\tSource : %02X\n", SCI_INT); - EFPRINTF(fp, "[0004]\t\tInterrupt : %08X\n", SCI_INT); - EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 000D\n"); - EFPRINTF(fp, "\t\t\tPolarity : 1\n"); - EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n"); - EFPRINTF(fp, "\n"); + EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); + EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); + EFPRINTF(fp, "[0001]\t\tBus : 00\n"); + EFPRINTF(fp, "[0001]\t\tSource : %02X\n", SCI_INT); + EFPRINTF(fp, "[0004]\t\tInterrupt : %08X\n", SCI_INT); + EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 000D\n"); + EFPRINTF(fp, "\t\t\tPolarity : 1\n"); + EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n"); + EFPRINTF(fp, "\n"); + } /* Local APIC NMI is connected to LINT 1 on all CPUs */ EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n");