diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-16 10:28:36 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-16 10:28:36 -0500 |
commit | 398973fe1f92e65f39f6a26dacc07baa0da632fc (patch) | |
tree | 5322bc672479a04956717b7502b8a72409e8647d /hw | |
parent | 095b9c4860b1351e4a0322e43708f39c79c1f34b (diff) | |
parent | b21bfeead284cf212d88dfa25171fee122407bc2 (diff) | |
download | qemu-398973fe1f92e65f39f6a26dacc07baa0da632fc.zip qemu-398973fe1f92e65f39f6a26dacc07baa0da632fc.tar.gz qemu-398973fe1f92e65f39f6a26dacc07baa0da632fc.tar.bz2 |
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')
-rw-r--r-- | hw/core/qdev-properties.c | 33 | ||||
-rw-r--r-- | hw/core/qdev.c | 8 | ||||
-rw-r--r-- | hw/i386/kvmvapic.c | 7 | ||||
-rw-r--r-- | hw/intc/ioapic_common.c | 2 |
4 files changed, 43 insertions, 7 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ddde18e..ca1739e 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 bab4ed7..4eb0134 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, diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index ed9b448..3a10c07 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -60,6 +60,9 @@ typedef struct VAPICROMState { bool rom_mapped_writable; } VAPICROMState; +#define TYPE_VAPIC "kvmvapic" +#define VAPIC(obj) OBJECT_CHECK(VAPICROMState, (obj), TYPE_VAPIC) + #define TPR_INSTR_ABS_MODRM 0x1 #define TPR_INSTR_MATCH_MODRM_REG 0x2 @@ -690,7 +693,7 @@ static const MemoryRegionOps vapic_ops = { static int vapic_init(SysBusDevice *dev) { - VAPICROMState *s = FROM_SYSBUS(VAPICROMState, dev); + VAPICROMState *s = VAPIC(dev); memory_region_init_io(&s->io, &vapic_ops, s, "kvmvapic", 2); sysbus_add_io(dev, VAPIC_IO_PORT, &s->io); @@ -806,7 +809,7 @@ static void vapic_class_init(ObjectClass *klass, void *data) } static const TypeInfo vapic_type = { - .name = "kvmvapic", + .name = TYPE_VAPIC, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(VAPICROMState), .class_init = vapic_class_init, diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c index 42c7adc..5c5bb3c 100644 --- a/hw/intc/ioapic_common.c +++ b/hw/intc/ioapic_common.c @@ -59,7 +59,7 @@ static int ioapic_dispatch_post_load(void *opaque, int version_id) static int ioapic_init_common(SysBusDevice *dev) { - IOAPICCommonState *s = FROM_SYSBUS(IOAPICCommonState, dev); + IOAPICCommonState *s = IOAPIC_COMMON(dev); IOAPICCommonClass *info; static int ioapic_no; |