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 <like.yan@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yan, Like 2019-06-03 17:18:48 +08:00 committed by Eddie Dong
parent ac6c5dce81
commit 771f15cd6b
4 changed files with 71 additions and 66 deletions

View File

@ -915,7 +915,6 @@ main(int argc, char *argv[])
break; break;
case CMD_OPT_LAPIC_PT: case CMD_OPT_LAPIC_PT:
lapic_pt = true; lapic_pt = true;
break;
case CMD_OPT_RTVM: case CMD_OPT_RTVM:
is_rtvm = true; is_rtvm = true;
break; break;

View File

@ -1598,29 +1598,31 @@ pci_bus_write_dsdt(int bus)
dsdt_line(" ,, , AddressRangeMemory, TypeStatic)"); dsdt_line(" ,, , AddressRangeMemory, TypeStatic)");
dsdt_line(" })"); dsdt_line(" })");
count = pci_count_lintr(bus); if (!is_rtvm) {
if (count != 0) { count = pci_count_lintr(bus);
dsdt_indent(2); if (count != 0) {
dsdt_line("Name (PPRT, Package ()"); dsdt_indent(2);
dsdt_line("{"); dsdt_line("Name (PPRT, Package ()");
pci_walk_lintr(bus, pci_pirq_prt_entry, NULL); dsdt_line("{");
dsdt_line("})"); pci_walk_lintr(bus, pci_pirq_prt_entry, NULL);
dsdt_line("Name (APRT, Package ()"); dsdt_line("})");
dsdt_line("{"); dsdt_line("Name (APRT, Package ()");
pci_walk_lintr(bus, pci_apic_prt_entry, NULL); dsdt_line("{");
dsdt_line("})"); pci_walk_lintr(bus, pci_apic_prt_entry, NULL);
dsdt_line("Method (_PRT, 0, NotSerialized)"); dsdt_line("})");
dsdt_line("{"); dsdt_line("Method (_PRT, 0, NotSerialized)");
dsdt_line(" If (PICM)"); dsdt_line("{");
dsdt_line(" {"); dsdt_line(" If (PICM)");
dsdt_line(" Return (APRT)"); dsdt_line(" {");
dsdt_line(" }"); dsdt_line(" Return (APRT)");
dsdt_line(" Else"); dsdt_line(" }");
dsdt_line(" {"); dsdt_line(" Else");
dsdt_line(" Return (PPRT)"); dsdt_line(" {");
dsdt_line(" }"); dsdt_line(" Return (PPRT)");
dsdt_line("}"); dsdt_line(" }");
dsdt_unindent(2); dsdt_line("}");
dsdt_unindent(2);
}
} }
dsdt_indent(2); dsdt_indent(2);

View File

@ -33,6 +33,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <sys/errno.h> #include <sys/errno.h>
#include "dm.h"
#include "vmmapi.h" #include "vmmapi.h"
#include "acpi.h" #include "acpi.h"
#include "inout.h" #include "inout.h"
@ -262,20 +263,21 @@ pci_lpc_write_dsdt(struct pci_vdev *dev)
ldp->handler(); ldp->handler();
} }
dsdt_line(""); if(!is_rtvm) {
dsdt_line("Device (PIC)"); dsdt_line("");
dsdt_line("{"); dsdt_line("Device (PIC)");
dsdt_line(" Name (_HID, EisaId (\"PNP0000\"))"); dsdt_line("{");
dsdt_line(" Name (_CRS, ResourceTemplate ()"); dsdt_line(" Name (_HID, EisaId (\"PNP0000\"))");
dsdt_line(" {"); dsdt_line(" Name (_CRS, ResourceTemplate ()");
dsdt_indent(2); dsdt_line(" {");
dsdt_fixed_ioport(IO_ICU1, 2); dsdt_indent(2);
dsdt_fixed_ioport(IO_ICU2, 2); dsdt_fixed_ioport(IO_ICU1, 2);
dsdt_fixed_irq(2); dsdt_fixed_ioport(IO_ICU2, 2);
dsdt_unindent(2); dsdt_fixed_irq(2);
dsdt_line(" })"); dsdt_unindent(2);
dsdt_line("}"); dsdt_line(" })");
dsdt_line("}");
}
dsdt_line(""); dsdt_line("");
dsdt_line("Device (TIMR)"); dsdt_line("Device (TIMR)");
dsdt_line("{"); dsdt_line("{");

View File

@ -280,36 +280,38 @@ basl_fwrite_madt(FILE *fp, struct vmctx *ctx)
EFPRINTF(fp, "\n"); EFPRINTF(fp, "\n");
} }
/* Always a single IOAPIC entry, with ID 0 */ if (!is_rtvm) {
EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n"); /* Always a single IOAPIC entry, with ID 0 */
EFPRINTF(fp, "[0001]\t\tLength : 0C\n"); EFPRINTF(fp, "[0001]\t\tSubtable Type : 01\n");
/* iasl expects a hex value for the i/o apic id */ EFPRINTF(fp, "[0001]\t\tLength : 0C\n");
EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0); /* iasl expects a hex value for the i/o apic id */
EFPRINTF(fp, "[0001]\t\tReserved : 00\n"); EFPRINTF(fp, "[0001]\t\tI/O Apic ID : %02x\n", 0);
EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n"); EFPRINTF(fp, "[0001]\t\tReserved : 00\n");
EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n"); EFPRINTF(fp, "[0004]\t\tAddress : fec00000\n");
EFPRINTF(fp, "\n"); EFPRINTF(fp, "[0004]\t\tInterrupt : 00000000\n");
EFPRINTF(fp, "\n");
/* Legacy IRQ0 is connected to pin 2 of the IOAPIC */ /* Legacy IRQ0 is connected to pin 2 of the IOAPIC */
EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n");
EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); EFPRINTF(fp, "[0001]\t\tLength : 0A\n");
EFPRINTF(fp, "[0001]\t\tBus : 00\n"); EFPRINTF(fp, "[0001]\t\tBus : 00\n");
EFPRINTF(fp, "[0001]\t\tSource : 00\n"); EFPRINTF(fp, "[0001]\t\tSource : 00\n");
EFPRINTF(fp, "[0004]\t\tInterrupt : 00000002\n"); EFPRINTF(fp, "[0004]\t\tInterrupt : 00000002\n");
EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n"); EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n");
EFPRINTF(fp, "\t\t\tPolarity : 1\n"); EFPRINTF(fp, "\t\t\tPolarity : 1\n");
EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n"); EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n");
EFPRINTF(fp, "\n"); EFPRINTF(fp, "\n");
EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n"); EFPRINTF(fp, "[0001]\t\tSubtable Type : 02\n");
EFPRINTF(fp, "[0001]\t\tLength : 0A\n"); EFPRINTF(fp, "[0001]\t\tLength : 0A\n");
EFPRINTF(fp, "[0001]\t\tBus : 00\n"); EFPRINTF(fp, "[0001]\t\tBus : 00\n");
EFPRINTF(fp, "[0001]\t\tSource : %02X\n", SCI_INT); EFPRINTF(fp, "[0001]\t\tSource : %02X\n", SCI_INT);
EFPRINTF(fp, "[0004]\t\tInterrupt : %08X\n", SCI_INT); EFPRINTF(fp, "[0004]\t\tInterrupt : %08X\n", SCI_INT);
EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 000D\n"); EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 000D\n");
EFPRINTF(fp, "\t\t\tPolarity : 1\n"); EFPRINTF(fp, "\t\t\tPolarity : 1\n");
EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n"); EFPRINTF(fp, "\t\t\tTrigger Mode : 3\n");
EFPRINTF(fp, "\n"); EFPRINTF(fp, "\n");
}
/* Local APIC NMI is connected to LINT 1 on all CPUs */ /* Local APIC NMI is connected to LINT 1 on all CPUs */
EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n"); EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n");