spapr: fix migration of ICPState objects from/to older QEMU
commit46f7afa3709664c7fbc643b2221fd27d5d7762d3
authorGreg Kurz <groug@kaod.org>
Wed, 14 Jun 2017 13:29:19 +0000 (14 15:29 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 30 Jun 2017 04:03:31 +0000 (30 14:03 +1000)
tree1da71747432b602ce53f539aec421f8651d6bd02
parentc95f6161de0b92efbdd64c9ddfdad58843b8760e
spapr: fix migration of ICPState objects from/to older QEMU

Commit 5bc8d26de20c ("spapr: allocate the ICPState object from under
sPAPRCPUCore") moved ICPState objects from the machine to CPU cores.
This is an improvement since we no longer allocate ICPState objects
that will never be used. But it has the side-effect of breaking
migration of older machine types from older QEMU versions.

This patch allows spapr to register dummy "icp/server" entries to vmstate.
These entries use a dedicated VMStateDescription that can swallow and
discard state of an incoming migration stream, and that don't send anything
on outgoing migration.

As for real ICPState objects, the instance_id is the cpu_index of the
corresponding vCPU, which happens to be equal to the generated instance_id
of older machine types.

The machine can unregister/register these entries when CPUs are dynamically
plugged/unplugged.

This is only available for pseries-2.9 and older machines, thanks to a
compat property.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr.c
include/hw/ppc/spapr.h