hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7
commitf640a5914f5179aa1af00df70da470e24e055e8d
authorThomas Huth <thuth@redhat.com>
Tue, 10 Apr 2018 12:02:25 +0000 (10 13:02 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 10 Apr 2018 12:02:25 +0000 (10 13:02 +0100)
tree109c3901ff98fd4c531ff732bfa53317161b0a80
parent8aabc5437ba5b69b8ea2f42deadbb9ea9be39b1f
hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7

QEMU currently exits unexpectedly when trying to introspect the fsl-imx6
and fsl-imx7 devices on systems with many SMP CPUs:

$ echo "{'execute':'qmp_capabilities'}"\
       "{'execute':'device-list-properties',"\
       " 'arguments':{'typename':'fsl,imx6'}}" \
       | arm-softmmu/qemu-system-arm -M virt,accel=qtest -qmp stdio -smp 8
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
 "package": "build-all"}, "capabilities": []}}
{"return": {}}
fsl,imx6: Only 4 CPUs are supported (8 requested)

And:

$ echo "{'execute':'qmp_capabilities'}"\
       "{'execute':'device-list-properties',"\
       " 'arguments':{'typename':'fsl,imx7'}}" \
       | arm-softmmu/qemu-system-arm -M raspi2,accel=qtest -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
 "package": "build-all"}, "capabilities": []}}
{"return": {}}
fsl,imx7: Only 2 CPUs are supported (4 requested)

This happens because these devices are doing an exit() from their
instance_init function - which should never be done since instance_init
can be called at any time for device introspection! Fix it by moving
the deadly check into the realize() function instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1522908551-14885-1-git-send-email-thuth@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/fsl-imx6.c
hw/arm/fsl-imx7.c