aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2018-07-16 14:59:30 +0200
committerPeter Maydell <peter.maydell@linaro.org>2018-07-17 13:12:49 +0100
commit32db1b58caa72f2ae582560f1937b21ea9ee0646 (patch)
tree08866d04d4bf84a4c0a2016b4e1bfdfcb0fa8551 /hw/intc
parentb2bc349822fa27c7da4e04535c5dda2cb035965b (diff)
hw/*/realview: Fix introspection problem with 'realview_mpcore' & 'realview_gic'
echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \ "'arguments':{'typename':'realview_mpcore'}}" \ "{'execute': 'human-monitor-command', " \ "'arguments': {'command-line': 'info qtree'}}" | \ valgrind -q aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio [...] ==2654== Invalid read of size 8 ==2654== at 0x61878A: qdev_print (qdev-monitor.c:686) ==2654== by 0x61878A: qbus_print (qdev-monitor.c:719) ==2654== by 0x452B38: handle_hmp_command (monitor.c:3446) ==2654== by 0x452D70: qmp_human_monitor_command (monitor.c:821) [...] Use sysbus_init_child_obj() to fix it. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-id: 1531745974-17187-14-git-send-email-thuth@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/realview_gic.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/intc/realview_gic.c b/hw/intc/realview_gic.c
index 50bbab66ee..7f2ff85c83 100644
--- a/hw/intc/realview_gic.c
+++ b/hw/intc/realview_gic.c
@@ -54,16 +54,13 @@ static void realview_gic_init(Object *obj)
{
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
RealViewGICState *s = REALVIEW_GIC(obj);
- DeviceState *gicdev;
memory_region_init(&s->container, OBJECT(s),
"realview-gic-container", 0x2000);
sysbus_init_mmio(sbd, &s->container);
- object_initialize(&s->gic, sizeof(s->gic), TYPE_ARM_GIC);
- gicdev = DEVICE(&s->gic);
- qdev_set_parent_bus(gicdev, sysbus_get_default());
- qdev_prop_set_uint32(gicdev, "num-cpu", 1);
+ sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic), TYPE_ARM_GIC);
+ qdev_prop_set_uint32(DEVICE(&s->gic), "num-cpu", 1);
}
static void realview_gic_class_init(ObjectClass *oc, void *data)