qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 21/22] [RfC] acpi: add per machine type acpi default


From: Gerd Hoffmann
Subject: [PATCH v3 21/22] [RfC] acpi: add per machine type acpi default
Date: Wed, 20 May 2020 15:20:02 +0200

Allow setting acpi default value for each machine type.

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 include/hw/i386/x86.h |  1 +
 hw/i386/x86.c         | 21 ++++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index b52285481687..d2fffa8252ff 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -37,6 +37,7 @@ typedef struct {
     bool save_tsc_khz;
     /* Enables contiguous-apic-ID mode */
     bool compat_apic_id_mode;
+    bool acpi_default;
 } X86MachineClass;
 
 typedef struct {
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index ac7a0a958781..3a56a157c5f0 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -940,10 +940,22 @@ static void x86_machine_set_smm(Object *obj, Visitor *v, 
const char *name,
 
 bool x86_machine_is_acpi_enabled(X86MachineState *x86ms)
 {
-    if (x86ms->acpi == ON_OFF_AUTO_OFF) {
-        return false;
+    X86MachineClass *x86mc = X86_MACHINE_GET_CLASS(x86ms);
+    bool enabled;
+
+    switch (x86ms->acpi) {
+    case ON_OFF_AUTO_ON:
+        enabled = true;
+        break;
+    case ON_OFF_AUTO_OFF:
+        enabled = false;
+        break;
+    case ON_OFF_AUTO_AUTO:
+    default:
+        enabled = x86mc->acpi_default;
+        break;
     }
-    return true;
+    return enabled;
 }
 
 static void x86_machine_get_acpi(Object *obj, Visitor *v, const char *name,
@@ -991,6 +1003,9 @@ static void x86_machine_class_init(ObjectClass *oc, void 
*data)
     x86mc->save_tsc_khz = true;
     nc->nmi_monitor_handler = x86_nmi;
 
+    /* acpi is on by default */
+    x86mc->acpi_default = true;
+
     object_class_property_add(oc, X86_MACHINE_MAX_RAM_BELOW_4G, "size",
         x86_machine_get_max_ram_below_4g, x86_machine_set_max_ram_below_4g,
         NULL, NULL);
-- 
2.18.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]