[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
- Re: [PATCH v3 17/22] microvm/acpi: add acpi_dsdt_add_virtio() for x86, (continued)
- [PATCH v3 19/22] microvm/acpi: use seabios with acpi=on, Gerd Hoffmann, 2020/05/20
- [PATCH v3 05/22] acpi: make build_madt() more generic., Gerd Hoffmann, 2020/05/20
- [PATCH v3 18/22] microvm/acpi: use GSI 16-23 for virtio, Gerd Hoffmann, 2020/05/20
- [PATCH v3 10/22] acpi: ged: add control regs, Gerd Hoffmann, 2020/05/20
- [PATCH v3 16/22] microvm/acpi: add minimal acpi support, Gerd Hoffmann, 2020/05/20
- [PATCH v3 21/22] [RfC] acpi: add per machine type acpi default,
Gerd Hoffmann <=
- [PATCH v3 20/22] microvm/acpi: disable virtio-mmio cmdline hack, Gerd Hoffmann, 2020/05/20
- [PATCH v3 11/22] acpi: ged: add x86 device variant., Gerd Hoffmann, 2020/05/20
- [PATCH v3 22/22] [RfC] acpi: flip default to off for microvm, Gerd Hoffmann, 2020/05/20
- [PATCH v3 09/22] acpi: ged: rename event memory region, Gerd Hoffmann, 2020/05/20