Patchwork [RFC,3/3] acpi-build: disable acpi generation for compat

login
register
mail settings
Submitter Michael S. Tsirkin
Date June 13, 2013, 2:29 p.m.
Message ID <1371133655-10186-4-git-send-email-mst@redhat.com>
Download mbox | patch
Permalink /patch/251084/
State New
Headers show

Comments

Michael S. Tsirkin - June 13, 2013, 2:29 p.m.
When running with -M 1.5 and older, disable ACPI
table generation, and don't expose ACPI
tables to guest.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c |  4 ++++
 hw/i386/pc_piix.c    | 12 ++++++++++--
 hw/i386/pc_q35.c     | 12 ++++++++++--
 include/hw/i386/pc.h |  1 +
 4 files changed, 25 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 911c913..7e52457 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -966,6 +966,10 @@  void acpi_setup(PcGuestInfo *guest_info)
         ACPI_BUILD_DPRINTF(3, "No fw cfg. Boiling out.\n");
     }
 
+    if (!guest_info->has_acpi_build) {
+        ACPI_BUILD_DPRINTF(3, "ACPI build disabled. Boiling out.\n");
+    }
+
     table_data = g_array_new(false, true /* clear */, 1);
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e46f19a..eb11456 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -59,6 +59,7 @@  static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
 static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
 
 static bool has_pvpanic = true;
+static bool has_acpi_build = true;
 
 /* PC hardware initialisation */
 static void pc_init1(MemoryRegion *system_memory,
@@ -124,6 +125,7 @@  static void pc_init1(MemoryRegion *system_memory,
 
     guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
 
+    guest_info->has_acpi_build = has_acpi_build;
     guest_info->dsdt_code = AcpiDsdtAmlCode;
     guest_info->dsdt_size = sizeof AcpiDsdtAmlCode;
 
@@ -266,12 +268,18 @@  static void pc_init_pci(QEMUMachineInitArgs *args)
              initrd_filename, cpu_model, 1, 1);
 }
 
+static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
+{
+    has_acpi_build = false;
+    pc_init_pci(args);
+}
+
 static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
 {
     pc_sysfw_flash_vs_rom_bug_compatible = true;
     has_pvpanic = false;
     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
-    pc_init_pci(args);
+    pc_init_pci_1_5(args);
 }
 
 static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
@@ -365,7 +373,7 @@  static QEMUMachine pc_i440fx_machine_v1_6 = {
 static QEMUMachine pc_i440fx_machine_v1_5 = {
     .name = "pc-i440fx-1.5",
     .desc = "Standard PC (i440FX + PIIX, 1996)",
-    .init = pc_init_pci,
+    .init = pc_init_pci_1_5,
     .hot_add_cpu = pc_hot_add_cpu,
     .max_cpus = 255,
     .compat_props = (GlobalProperty[]) {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index c11118a..e101112 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -49,6 +49,7 @@ 
 #define MAX_SATA_PORTS     6
 
 static bool has_pvpanic = true;
+static bool has_acpi_build = true;
 
 /* PC hardware initialisation */
 static void pc_q35_init(QEMUMachineInitArgs *args)
@@ -109,6 +110,7 @@  static void pc_q35_init(QEMUMachineInitArgs *args)
     }
 
     guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
+    guest_info->has_acpi_build = has_acpi_build;
     guest_info->dsdt_code = Q35AcpiDsdtAmlCode;
     guest_info->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
 
@@ -216,12 +218,18 @@  static void pc_q35_init(QEMUMachineInitArgs *args)
     }
 }
 
+static void pc_q35_init_1_5(QEMUMachineInitArgs *args)
+{
+    has_acpi_build = false;
+    pc_q35_init(args);
+}
+
 static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
 {
     pc_sysfw_flash_vs_rom_bug_compatible = true;
     has_pvpanic = false;
     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
-    pc_q35_init(args);
+    pc_q35_init_1_5(args);
 }
 
 static QEMUMachine pc_q35_machine_v1_6 = {
@@ -237,7 +245,7 @@  static QEMUMachine pc_q35_machine_v1_6 = {
 static QEMUMachine pc_q35_machine_v1_5 = {
     .name = "pc-q35-1.5",
     .desc = "Standard PC (Q35 + ICH9, 2009)",
-    .init = pc_q35_init,
+    .init = pc_q35_init_1_5,
     .hot_add_cpu = pc_hot_add_cpu,
     .max_cpus = 255,
     .compat_props = (GlobalProperty[]) {
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 80c9e71..722d7d0 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -51,6 +51,7 @@  struct PcGuestInfo {
     uint64_t mcfg_base;
     const unsigned char *dsdt_code;
     unsigned dsdt_size;
+    bool has_acpi_build;
     FWCfgState *fw_cfg;
 };