cpu: Register VMStateDescription through CPUState

In comparison to DeviceClass::vmsd, CPU VMState is split in two,
"cpu_common" and "cpu", and uses cpu_index as instance_id instead of -1.
Therefore add a CPU-specific CPUClass::vmsd field.

Unlike the legacy CPUArchState registration, rather register CPUState.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Update VMStateDescription to X86CPU

Expose vmstate_cpu as vmstate_x86_cpu and hook it up to CPUClass::vmsd.
Adapt opaques and VMState fields to X86CPU. Drop cpu_{save,load}().

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-lm32: Update VMStateDescription to LM32CPU

Expose vmstate_cpu as vmstate_lm32_cpu and hook it up to CPUClass::vmsd.
Adapt VMState fields to LM32CPU. Drop cpu_{save,load}().

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-alpha: Register VMStateDescription for AlphaCPU

Commit b758aca1f6cdb175634812b79f5560c36c902d00 (target-alpha: Enable
the alpha-softmmu target.) introduced cpu_{save,load}() functions but
didn't define CPU_SAVE_VERSION, so they were never registered.

Drop cpu_{save,load}() and register the VMStateDescription via CPUClass.
This operates on the AlphaCPU object instead of CPUAlphaState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-openrisc: Register VMStateDescription for OpenRISCCPU

Since commit e67db06e9f6d7e514ee2a9b9b769ecd42977f6fb (target-or32: Add
target stubs and QOM cpu) a VMStateDescription existed, but
CPU_SAVE_VERSION was not set, so it was never registered.

Register it through CPUState.
Use a version_id of 1 and specify minimum versions as well.

Cc: Jia Liu <proljc@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Guard cpu_{save,load}() definitions

A few targets already managed to implement cpu_save() and cpu_load()
without defining CPU_SAVE_VERSION that causes them to be registered.

Guard the prototypes with CPU_SAVE_VERSION to avoid this happening again
until all targets are converted to VMState or QIDL.

Signed-off-by: Andreas Färber <afaerber@suse.de>