summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-11-26 22:04:32 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-07 16:18:41 +0400
commitea9ce8934c5d2cc8925359a6d8d45eb829a9f27f (patch)
tree927bdc1c7297f53a40ea456884ebde99e60c39c3 /hw
parente59dbbac0364344a3ad84c3497a98c56003d3fb8 (diff)
downloadqemu-ea9ce8934c5d2cc8925359a6d8d45eb829a9f27f.zip
hw: apply accel compat properties without touching globals
Instead of registering compat properties as globals, let's keep them in their own array, to avoid mixing with user globals. Introduce object_apply_global_props() function, to apply compatibility properties from a GPtrArray. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/qdev.c9
-rw-r--r--hw/xen/xen-common.c9
2 files changed, 15 insertions, 3 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 6b3cc55b27..53b507164f 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -972,6 +972,15 @@ static void device_initfn(Object *obj)
static void device_post_init(Object *obj)
{
+ if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
+ MachineState *m = MACHINE(qdev_get_machine());
+ AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
+
+ if (ac->compat_props) {
+ object_apply_global_props(obj, ac->compat_props, &error_abort);
+ }
+ }
+
qdev_prop_set_globals(DEVICE(obj));
}
diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index 6ec14c73ca..4532aa8632 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/xen-common.c
@@ -174,18 +174,21 @@ static GlobalProperty xen_compat_props[] = {
.driver = "migration",
.property = "send-section-footer",
.value = "off",
- },
- { /* end of list */ },
+ }
};
static void xen_accel_class_init(ObjectClass *oc, void *data)
{
AccelClass *ac = ACCEL_CLASS(oc);
+
ac->name = "Xen";
ac->init_machine = xen_init;
ac->setup_post = xen_setup_post;
ac->allowed = &xen_allowed;
- ac->global_props = xen_compat_props;
+ ac->compat_props = g_ptr_array_new();
+
+ compat_props_add(ac->compat_props,
+ xen_compat_props, G_N_ELEMENTS(xen_compat_props));
}
#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")