[patch 1/7] qemu-kvm: move vapic enablement to kvm_arch_load_regs

Marcelo Tosatti
2010-03-09T00:49:30Z

[-- Attachment #1: move-update-vapic-to-load-regs --]
[-- Type: text/plain, Size: 1000 bytes --]

update_vapic is used for enabling vcpu's vapic on migration.
Use the new writeback states for that.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-kvm-tpr/qemu-kvm-x86.c
===================================================================
--- qemu-kvm-tpr.orig/qemu-kvm-x86.c
+++ qemu-kvm-tpr/qemu-kvm-x86.c
@@ -988,6 +988,10 @@ void kvm_arch_load_regs(CPUState *env, i
kvm_arch_load_mpstate(env);
kvm_load_lapic(env);
}
+ if (level == KVM_PUT_FULL_STATE) {
+ if (env->update_vapic)
+ kvm_tpr_enable_vapic(env);
+ }
if (kvm_irqchip_in_kernel()) {
/* Avoid deadlock: no user space IRQ will ever clear it. */
env->halted = 0;
@@ -1338,9 +1342,6 @@ int kvm_arch_halt(CPUState *env)

int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
{
- if (env->update_vapic) {
- kvm_tpr_enable_vapic(env);
- }
if (!kvm_irqchip_in_kernel())
kvm_set_cr8(env, cpu_get_apic_tpr(env));
return 0;