kvm: x86: Save/restore KVM-specific CPU states

Save and restore all so far neglected KVM-specific CPU states. Handling
the TSC stabilizes migration in KVM mode. The interrupt_bitmap and
mp_state are currently unused, but will become relevant for in-kernel
irqchip support. By including proper saving/restoring already, we avoid
having to increment CPU_SAVE_VERSION later on once again.

v2:
 - initialize mp_state runnable (for the boot CPU)

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Jan Kiszka 2009-05-02 02:18:38 +02:00 committed by Anthony Liguori
parent d33a1810d7
commit f8d926e9cd
5 changed files with 49 additions and 3 deletions

View file

@ -126,6 +126,8 @@ int kvm_arch_init_vcpu(CPUState *env)
uint32_t limit, i, j, cpuid_i;
uint32_t unused;
env->mp_state = KVM_MP_STATE_RUNNABLE;
cpuid_i = 0;
cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused);
@ -648,6 +650,14 @@ int kvm_arch_put_registers(CPUState *env)
if (ret < 0)
return ret;
ret = kvm_put_mp_state(env);
if (ret < 0)
return ret;
ret = kvm_get_mp_state(env);
if (ret < 0)
return ret;
return 0;
}