summaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-04-16 10:28:36 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-16 10:28:36 -0500
commit398973fe1f92e65f39f6a26dacc07baa0da632fc (patch)
tree5322bc672479a04956717b7502b8a72409e8647d /hw/core
parent095b9c4860b1351e4a0322e43708f39c79c1f34b (diff)
parentb21bfeead284cf212d88dfa25171fee122407bc2 (diff)
downloadqemu-398973fe1f92e65f39f6a26dacc07baa0da632fc.tar.gz
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
# By Igor Mammedov (8) and others # Via Andreas Färber * afaerber/qom-cpu: target-cris: Override do_interrupt for pre-v32 CPU cores qdev: Set device's parent before calling realize() down inheritance chain cpu: Pass CPUState to *cpu_synchronize_post*() target-i386: Split out CPU creation and features parsing target-i386/cpu.c: Coding style fixes ioapic: Replace FROM_SYSBUS() with QOM type cast kvmvapic: Replace FROM_SYSBUS() with QOM type cast target-i386: Split APIC creation from initialization in x86_cpu_realizefn() target-i386: Consolidate error propagation in x86_cpu_realizefn() qdev: Add qdev property for bool type target-i386: Improve -cpu ? features output target-i386: Fix including "host" in -cpu ? output
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/qdev-properties.c33
-rw-r--r--hw/core/qdev.c8
2 files changed, 37 insertions, 4 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index ddde18e6b4..ca1739ec84 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -120,6 +120,39 @@ PropertyInfo qdev_prop_bit = {
.set = set_bit,
};
+/* --- bool --- */
+
+static void get_bool(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ DeviceState *dev = DEVICE(obj);
+ Property *prop = opaque;
+ bool *ptr = qdev_get_prop_ptr(dev, prop);
+
+ visit_type_bool(v, ptr, name, errp);
+}
+
+static void set_bool(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ DeviceState *dev = DEVICE(obj);
+ Property *prop = opaque;
+ bool *ptr = qdev_get_prop_ptr(dev, prop);
+
+ if (dev->realized) {
+ qdev_prop_set_after_realize(dev, name, errp);
+ return;
+ }
+
+ visit_type_bool(v, ptr, name, errp);
+}
+
+PropertyInfo qdev_prop_bool = {
+ .name = "boolean",
+ .get = get_bool,
+ .set = set_bool,
+};
+
/* --- 8bit integer --- */
static void get_uint8(Object *obj, Visitor *v, void *opaque,
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index bab4ed7bf7..4eb01345df 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -684,10 +684,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++);
@@ -698,6 +694,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,