summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2016-07-21 17:54:37 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-07-29 12:02:31 +1000
commitb63578bdb50243d05c48c3c94cc58ae446f2eb93 (patch)
tree6938d23077d52ffc415baf3416108dc8d05f7c1c
parent21a21b853a1bb606358af61e738abfb9aecbd720 (diff)
downloadqemu-b63578bdb50243d05c48c3c94cc58ae446f2eb93.tar.gz
qemu-b63578bdb50243d05c48c3c94cc58ae446f2eb93.tar.bz2
qemu-b63578bdb50243d05c48c3c94cc58ae446f2eb93.zip
spapr: init CPUState->cpu_index with index relative to core-id
It will enshure that cpu_index for a given cpu stays the same regardless of the order cpus has been created/deleted and so it would be possible to migrate QEMU instance with out of order created CPU. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--hw/ppc/spapr_cpu_core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index c04aaa47d7..1f3f4dd1e8 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -307,9 +307,13 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
sc->threads = g_malloc0(size * cc->nr_threads);
for (i = 0; i < cc->nr_threads; i++) {
char id[32];
+ CPUState *cs;
+
obj = sc->threads + i * size;
object_initialize(obj, size, typename);
+ cs = CPU(obj);
+ cs->cpu_index = cc->core_id + i;
snprintf(id, sizeof(id), "thread[%d]", i);
object_property_add_child(OBJECT(sc), id, obj, &local_err);
if (local_err) {