hw/ppc/spapr_cpu_core: Add a proper check for spapr machine
commit2363d5ee231bf047479422d56d3b85b7d37a7c23
authorThomas Huth <thuth@redhat.com>
Thu, 24 Aug 2017 03:52:32 +0000 (24 05:52 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 7 Sep 2017 23:30:55 +0000 (8 09:30 +1000)
treefa23343d7b48d4e4af5a28d5385451e1fe2555ec
parent97c2acb5504ee0ab0a5efc39a06f9783220dba90
hw/ppc/spapr_cpu_core: Add a proper check for spapr machine

QEMU currently crashes when the user tries to add a spapr-cpu-core
on a non-pseries machine:

$ qemu-system-ppc64 -S -machine ppce500,accel=tcg \
                    -device POWER5+_v2.1-spapr-cpu-core
hw/ppc/spapr_cpu_core.c:178:spapr_cpu_core_realize_child:
Object 0x55cee1f55160 is not an instance of type spapr-machine
Aborted (core dumped)

So let's add a proper check for the correct machine time with
a more friendly error message here.

Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_cpu_core.c
scripts/device-crash-test