summaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-05-02 02:18:38 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-22 10:50:34 -0500
commitaf7e2646013b478d209d133bb3138e7682bd70c2 (patch)
tree510d530bbec3c739cc23fcc248fe188738fd0b28 /kvm-all.c
parentb43f035e6d0f729c8491dedfa3373416d0d9ecad (diff)
downloadqemu-af7e2646013b478d209d133bb3138e7682bd70c2.tar.gz
qemu-af7e2646013b478d209d133bb3138e7682bd70c2.tar.bz2
qemu-af7e2646013b478d209d133bb3138e7682bd70c2.zip
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>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kvm-all.c b/kvm-all.c
index c9f09c7e18..c89e3b1cfe 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -181,6 +181,26 @@ err:
return ret;
}
+int kvm_put_mp_state(CPUState *env)
+{
+ struct kvm_mp_state mp_state = { .mp_state = env->mp_state };
+
+ return kvm_vcpu_ioctl(env, KVM_SET_MP_STATE, &mp_state);
+}
+
+int kvm_get_mp_state(CPUState *env)
+{
+ struct kvm_mp_state mp_state;
+ int ret;
+
+ ret = kvm_vcpu_ioctl(env, KVM_GET_MP_STATE, &mp_state);
+ if (ret < 0) {
+ return ret;
+ }
+ env->mp_state = mp_state.mp_state;
+ return 0;
+}
+
int kvm_sync_vcpus(void)
{
CPUState *env;