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
This commit is contained in:
Anthony Liguori 2013-04-16 10:28:36 -05:00
commit 398973fe1f
14 changed files with 145 additions and 56 deletions

View file

@ -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,

View file

@ -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,