summaryrefslogtreecommitdiff
path: root/hw/core/machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core/machine.c')
-rw-r--r--hw/core/machine.c70
1 files changed, 51 insertions, 19 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 6dbbc85b9..e5a456f21 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -65,6 +65,9 @@ static void machine_set_kernel_irqchip(Object *obj, Visitor *v,
ms->kernel_irqchip_split = true;
break;
default:
+ /* The value was checked in visit_type_OnOffSplit() above. If
+ * we get here, then something is wrong in QEMU.
+ */
abort();
}
}
@@ -257,47 +260,47 @@ static void machine_set_usb(Object *obj, bool value, Error **errp)
ms->usb_disabled = !value;
}
-static bool machine_get_igd_gfx_passthru(Object *obj, Error **errp)
+static bool machine_get_graphics(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
- return ms->igd_gfx_passthru;
+ return ms->enable_graphics;
}
-static void machine_set_igd_gfx_passthru(Object *obj, bool value, Error **errp)
+static void machine_set_graphics(Object *obj, bool value, Error **errp)
{
MachineState *ms = MACHINE(obj);
- ms->igd_gfx_passthru = value;
+ ms->enable_graphics = value;
}
-static char *machine_get_firmware(Object *obj, Error **errp)
+static bool machine_get_igd_gfx_passthru(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
- return g_strdup(ms->firmware);
+ return ms->igd_gfx_passthru;
}
-static void machine_set_firmware(Object *obj, const char *value, Error **errp)
+static void machine_set_igd_gfx_passthru(Object *obj, bool value, Error **errp)
{
MachineState *ms = MACHINE(obj);
- g_free(ms->firmware);
- ms->firmware = g_strdup(value);
+ ms->igd_gfx_passthru = value;
}
-static bool machine_get_iommu(Object *obj, Error **errp)
+static char *machine_get_firmware(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
- return ms->iommu;
+ return g_strdup(ms->firmware);
}
-static void machine_set_iommu(Object *obj, bool value, Error **errp)
+static void machine_set_firmware(Object *obj, const char *value, Error **errp)
{
MachineState *ms = MACHINE(obj);
- ms->iommu = value;
+ g_free(ms->firmware);
+ ms->firmware = g_strdup(value);
}
static void machine_set_suppress_vmdesc(Object *obj, bool value, Error **errp)
@@ -382,6 +385,7 @@ static void machine_initfn(Object *obj)
ms->kvm_shadow_mem = -1;
ms->dump_guest_core = true;
ms->mem_merge = true;
+ ms->enable_graphics = true;
object_property_add_str(obj, "accel",
machine_get_accel, machine_set_accel, NULL);
@@ -460,6 +464,12 @@ static void machine_initfn(Object *obj)
object_property_set_description(obj, "usb",
"Set on/off to enable/disable usb",
NULL);
+ object_property_add_bool(obj, "graphics",
+ machine_get_graphics,
+ machine_set_graphics, NULL);
+ object_property_set_description(obj, "graphics",
+ "Set on/off to enable/disable graphics emulation",
+ NULL);
object_property_add_bool(obj, "igd-passthru",
machine_get_igd_gfx_passthru,
machine_set_igd_gfx_passthru, NULL);
@@ -472,12 +482,6 @@ static void machine_initfn(Object *obj)
object_property_set_description(obj, "firmware",
"Firmware image",
NULL);
- object_property_add_bool(obj, "iommu",
- machine_get_iommu,
- machine_set_iommu, NULL);
- object_property_set_description(obj, "iommu",
- "Set on/off to enable/disable Intel IOMMU (VT-d)",
- NULL);
object_property_add_bool(obj, "suppress-vmdesc",
machine_get_suppress_vmdesc,
machine_set_suppress_vmdesc, NULL);
@@ -550,6 +554,33 @@ bool machine_mem_merge(MachineState *machine)
return machine->mem_merge;
}
+static void machine_class_finalize(ObjectClass *klass, void *data)
+{
+ MachineClass *mc = MACHINE_CLASS(klass);
+
+ if (mc->compat_props) {
+ g_array_free(mc->compat_props, true);
+ }
+}
+
+void machine_register_compat_props(MachineState *machine)
+{
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
+ int i;
+ GlobalProperty *p;
+
+ if (!mc->compat_props) {
+ return;
+ }
+
+ for (i = 0; i < mc->compat_props->len; i++) {
+ p = g_array_index(mc->compat_props, GlobalProperty *, i);
+ /* Machine compat_props must never cause errors: */
+ p->errp = &error_abort;
+ qdev_prop_register_global(p);
+ }
+}
+
static const TypeInfo machine_info = {
.name = TYPE_MACHINE,
.parent = TYPE_OBJECT,
@@ -557,6 +588,7 @@ static const TypeInfo machine_info = {
.class_size = sizeof(MachineClass),
.class_init = machine_class_init,
.class_base_init = machine_class_base_init,
+ .class_finalize = machine_class_finalize,
.instance_size = sizeof(MachineState),
.instance_init = machine_initfn,
.instance_finalize = machine_finalize,