From ea9ce8934c5d2cc8925359a6d8d45eb829a9f27f Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Mon, 26 Nov 2018 22:04:32 +0400 Subject: hw: apply accel compat properties without touching globals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Igor Mammedov Reviewed-by: Cornelia Huck Acked-by: Eduardo Habkost --- hw/core/qdev.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'hw/core/qdev.c') 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)); } -- cgit 1.4.1