hw/sparc64/sun4u: Fix introspection by converting prom instance_init to realize
commit92b19880f7f9cf7f4a9e00dc3258b8d3aa363e9d
authorThomas Huth <thuth@redhat.com>
Thu, 5 Apr 2018 09:32:30 +0000 (5 11:32 +0200)
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Sun, 17 Jun 2018 10:12:41 +0000 (17 11:12 +0100)
tree4527c4d6dc25043ed7c3ea0630b099cf5c85180b
parent2ef2f16781af9dee6ba6517755e9073ba5799fa2
hw/sparc64/sun4u: Fix introspection by converting prom instance_init to realize

The instance_init function of devices should always succeed to be able
to introspect the device. However, the instance_init function of the
"openprom" device can currently fail, for example like this:

$ echo "{'execute':'qmp_capabilities'}"\
       "{'execute':'device-list-properties',"\
       " 'arguments':{'typename':'openprom'}}" \
       | sparc64-softmmu/qemu-system-sparc64 -M sun4v,accel=qtest -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
 "package": "build-all"}, "capabilities": []}}
{"return": {}}
RAMBlock "sun4u.prom" already registered, abort!
Aborted (core dumped)

This should not happen. Fix this problem by moving the affected code from
instance_init into a realize function instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
hw/sparc64/sun4u.c