spapr: fix check of cpu alias name in spapr_get_cpu_core_type()
commite17a87792d4886d2a508672c1639df3c1d40f1d1
authorGreg Kurz <groug@kaod.org>
Mon, 3 Oct 2016 12:13:20 +0000 (3 14:13 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 6 Oct 2016 05:15:53 +0000 (6 16:15 +1100)
treeea5b701f50f65102917c3c94ad7319c7c5bae819
parentaa9026fd5e3d58cdaf3b28b60a4639f69c7bfff6
spapr: fix check of cpu alias name in spapr_get_cpu_core_type()

If the user passes an alias name and a property to -cpu, QEMU fails to
find the CPU definition and exits.

$ qemu-system-ppc64 -cpu POWER8E,compat=power7
qemu-system-ppc64: Unable to find sPAPR CPU Core definition

This happens because spapr_get_cpu_core_type() passes the full string from
the command line (i.e. "POWER8E,compat=power7") to ppc_cpu_lookup_alias(),
instead of the alias name piece only (i.e. "POWER8E").

The fix is to pass model_pieces[0] to ppc_cpu_lookup_alias().

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_cpu_core.c