[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/22] qdev: set device's parent before calling real
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 20/22] qdev: set device's parent before calling realize() down inheritance chain. |
Date: |
Fri, 5 Apr 2013 16:37:14 +0200 |
Currently device_set_realized() sets parent only after device was realized,
But qdev_device_add() sets it before device is realized.
Make behavior consistent and alter device_set_realized() to behave like
qdev_device_add().
It will allow to set link<> properties in realize() method in classes
inherited from DEVICE.
Signed-off-by: Igor Mammedov <address@hidden>
---
* Usage examples
- conversion to CPU back-link property in APIC
- pre-allocate link<CPU[n]> at board level, and populate them
at realize time when CPUs are created.
---
hw/qdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index e2bb37d..b9bd6f5 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -671,10 +671,6 @@ static void device_set_realized(Object *obj, bool value,
Error **err)
Error *local_err = NULL;
if (value && !dev->realized) {
- if (dc->realize) {
- dc->realize(dev, &local_err);
- }
-
if (!obj->parent && local_err == NULL) {
static int unattached_count;
gchar *name = g_strdup_printf("device[%d]", unattached_count++);
@@ -685,6 +681,10 @@ static void device_set_realized(Object *obj, bool value,
Error **err)
g_free(name);
}
+ if (dc->realize) {
+ dc->realize(dev, &local_err);
+ }
+
if (qdev_get_vmsd(dev) && local_err == NULL) {
vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev,
dev->instance_id_alias,
--
1.8.1.4
- Re: [Qemu-devel] [PATCH 14/22] target-i386: introduce apic-id property, (continued)
- [Qemu-devel] [PATCH 09/22] introduce CPU hot-plug notifier, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 21/22] target-i386: expose all possible CPUs as /machine/icc-bridge/cpu[0..N] links, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 22/22] add cpu-add qmp command and implement CPU hot-add for target-i386, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 12/22] cpu: add helper cpu_exists(), to check if CPU with specified id exists, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 19/22] target-i386: move IOAPIC to ICC bus, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 20/22] qdev: set device's parent before calling realize() down inheritance chain.,
Igor Mammedov <=
- [Qemu-devel] [PATCH 19/22] target-i386: move APIC to ICC bus, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 15/22] introduce ICC bus/device/bridge, Igor Mammedov, 2013/04/05
- [Qemu-devel] [PATCH 05/22] cpu: call cpu_synchronize_post_init() from CPUClass.realize() if hotplugged, Igor Mammedov, 2013/04/05
- Re: [Qemu-devel] [PATCH 05/22] cpu: call cpu_synchronize_post_init() from CPUClass.realize() if hotplugged, Paolo Bonzini, 2013/04/09
- [Qemu-devel] [PATCH 18/22] target-i386: move IOAPIC to ICC bus, Igor Mammedov, 2013/04/05