ppc/kvm: have the "family" CPU alias to point to TYPE_HOST_POWERPC_CPU
commit92e926e1e37aea7e1632535b6611ed4f62414af1
authorGreg Kurz <groug@kaod.org>
Wed, 5 Jul 2017 08:49:52 +0000 (5 10:49 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 11 Jul 2017 01:04:02 +0000 (11 11:04 +1000)
tree567613f5bcce1e74bf375d76ca65527115719e1e
parent2a0d90fed5b09e27854ac5ca2af836a8248c00c1
ppc/kvm: have the "family" CPU alias to point to TYPE_HOST_POWERPC_CPU

When running KVM on POWER, we allow the user to pass "-cpu POWERx" instead
of "-cpu host". This is achieved by patching the ppc_cpu_aliases[] array
so that "POWERx" points to the CPU class with the same PVR as the host CPU.
This causes CPUs to be instantiated from this CPU class instead of the
TYPE_HOST_POWERPC_CPU class which is used with "-cpu host". These CPUs thus
miss all the KVM specific tuning from kvmppc_host_cpu_class_init().

This currently causes QEMU with "-cpu POWER9" to fail when running KVM on a
POWER9 DD1 host:

qemu-system-ppc64: Register sync failed... If you're using kvm-hv.ko, only
 "-cpu host" is possible
kvm_init_vcpu failed: Invalid argument

Let's have the "POWERx" alias to point to TYPE_HOST_POWERPC_CPU directly,
so that "-cpu POWERx" instantiates CPUs from the same class as "-cpu host".

Signed-off-by: Greg Kurz <groug@kaod.org>
Tested-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target/ppc/kvm.c