pseries: Fix incorrect calculation of threads per socket for chip-id
commit22419c2a90b859dcab49f9472259ad8a3ce091d6
authorDavid Gibson <david@gibson.dropbear.id.au>
Tue, 8 Sep 2015 01:21:31 +0000 (8 11:21 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 23 Sep 2015 00:51:10 +0000 (23 10:51 +1000)
tree11b279f791b10959042c13d56072692332f45d56
parent92d7a30cb3656f577f87b19042d9b66ff3b20e3b
pseries: Fix incorrect calculation of threads per socket for chip-id

The device tree presented to pseries machine type guests includes an
ibm,chip-id property which gives essentially the socket number of each
vcpu core (individual vcpu threads don't get a node in the device
tree).

To calculate this, it uses a vcpus_per_socket variable computed as
(smp_cpus / #sockets).  This is correct for the usual case where
smp_cpus == smp_threads * smp_cores * #sockets.

However, you can start QEMU with the number of cores and threads
mismatching the total number of vcpus (whether that _should_ be
permitted is a topic for another day).  It's a bit hard to say what
the "real" number of vcpus per socket here is, but for most purposes
(smp_threads * smp_cores) will more meaningfully match how QEMU
behaves with respect to socket boundaries.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
hw/ppc/spapr.c