aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/virt.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-03-20 11:01:36 +0100
committerMichael S. Tsirkin <mst@redhat.com>2020-03-29 09:52:13 -0400
commit17e89077b7e3bc1d96540e21ddc7451c3e077049 (patch)
tree47310cda860c2d8308496883b98b7beba9847160 /hw/arm/virt.c
parent9d283f85d755285bf1b1bfcb1ab275239dbf2c7b (diff)
downloadqemu-17e89077b7e3bc1d96540e21ddc7451c3e077049.zip
qemu-17e89077b7e3bc1d96540e21ddc7451c3e077049.tar.gz
qemu-17e89077b7e3bc1d96540e21ddc7451c3e077049.tar.bz2
acpi: add acpi=OnOffAuto machine property to x86 and arm virt
Remove the global acpi_enabled bool and replace it with an acpi OnOffAuto machine property. qemu throws an error now if you use -no-acpi while the machine type you are using doesn't support acpi in the first place. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20200320100136.11717-1-kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/arm/virt.c')
-rw-r--r--hw/arm/virt.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 94f93dd..7dc96ab 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -67,6 +67,7 @@
#include "kvm_arm.h"
#include "hw/firmware/smbios.h"
#include "qapi/visitor.h"
+#include "qapi/qapi-visit-common.h"
#include "standard-headers/linux/input.h"
#include "hw/arm/smmuv3.h"
#include "hw/acpi/acpi.h"
@@ -1844,7 +1845,7 @@ static void machvirt_init(MachineState *machine)
create_pcie(vms);
- if (has_ged && aarch64 && firmware_loaded && acpi_enabled) {
+ if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)) {
vms->acpi_dev = create_acpi_ged(vms);
} else {
create_gpio(vms);
@@ -1934,6 +1935,31 @@ static void virt_set_its(Object *obj, bool value, Error **errp)
vms->its = value;
}
+bool virt_is_acpi_enabled(VirtMachineState *vms)
+{
+ if (vms->acpi == ON_OFF_AUTO_OFF) {
+ return false;
+ }
+ return true;
+}
+
+static void virt_get_acpi(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ VirtMachineState *vms = VIRT_MACHINE(obj);
+ OnOffAuto acpi = vms->acpi;
+
+ visit_type_OnOffAuto(v, name, &acpi, errp);
+}
+
+static void virt_set_acpi(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ VirtMachineState *vms = VIRT_MACHINE(obj);
+
+ visit_type_OnOffAuto(v, name, &vms->acpi, errp);
+}
+
static char *virt_get_gic_version(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -2113,7 +2139,7 @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,
if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
VirtMachineState *vms = VIRT_MACHINE(machine);
- if (!vms->bootinfo.firmware_loaded || !acpi_enabled) {
+ if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) {
return HOTPLUG_HANDLER(machine);
}
}
@@ -2184,6 +2210,12 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
mc->numa_mem_supported = true;
mc->auto_enable_numa_with_memhp = true;
mc->default_ram_id = "mach-virt.ram";
+
+ object_class_property_add(oc, "acpi", "OnOffAuto",
+ virt_get_acpi, virt_set_acpi,
+ NULL, NULL, &error_abort);
+ object_class_property_set_description(oc, "acpi",
+ "Enable ACPI", &error_abort);
}
static void virt_instance_init(Object *obj)