From patchwork Tue Feb 2 08:19:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 76330 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o128KHYG032259 for ; Tue, 2 Feb 2010 08:20:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755359Ab0BBIUL (ORCPT ); Tue, 2 Feb 2010 03:20:11 -0500 Received: from goliath.siemens.de ([192.35.17.28]:18319 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754603Ab0BBITh (ORCPT ); Tue, 2 Feb 2010 03:19:37 -0500 Received: from mail2.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o128JGqa013871; Tue, 2 Feb 2010 09:19:16 +0100 Received: from localhost.localdomain ([139.25.173.39]) by mail2.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o128J7sX008551; Tue, 2 Feb 2010 09:19:16 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, Anthony Liguori , Alexander Graf , Glauber Costa , qemu-devel@nongnu.org Subject: [PATCH 17/21] qemu-kvm: Use VCPU event state for reset and vmsave/load Date: Tue, 2 Feb 2010 09:19:03 +0100 Message-Id: X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 02 Feb 2010 08:20:18 +0000 (UTC) diff --git a/kvm.h b/kvm.h index e4005d8..686ee33 100644 --- a/kvm.h +++ b/kvm.h @@ -53,8 +53,6 @@ int kvm_set_migration_log(int enable); int kvm_has_sync_mmu(void); int kvm_has_vcpu_events(void); -int kvm_put_vcpu_events(CPUState *env, int level); -int kvm_get_vcpu_events(CPUState *env); void kvm_setup_guest_memory(void *start, size_t size); diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 21476db..f484149 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -972,6 +972,8 @@ void kvm_arch_load_regs(CPUState *env, int level) if (level >= KVM_PUT_RESET_STATE) { kvm_arch_load_mpstate(env); } + + kvm_put_vcpu_events(env, level); } void kvm_load_tsc(CPUState *env) @@ -1141,6 +1143,7 @@ void kvm_arch_save_regs(CPUState *env) } } kvm_arch_save_mpstate(env); + kvm_get_vcpu_events(env); } static void do_cpuid_ent(struct kvm_cpuid_entry2 *e, uint32_t function, @@ -1215,7 +1218,7 @@ int kvm_arch_init_vcpu(CPUState *cenv) qemu_kvm_load_lapic(cenv); - cenv->interrupt_injected = -1; + kvm_arch_reset_vcpu(cenv); #ifdef KVM_CPUID_SIGNATURE /* Paravirtualization CPUIDs */ @@ -1381,7 +1384,6 @@ void kvm_arch_push_nmi(void *opaque) void kvm_arch_cpu_reset(CPUState *env) { kvm_arch_reset_vcpu(env); - kvm_put_vcpu_events(env, KVM_PUT_RESET_STATE); if (!cpu_is_bsp(env) && !kvm_irqchip_in_kernel()) { env->interrupt_request &= ~CPU_INTERRUPT_HARD; env->halted = 1; diff --git a/target-i386/kvm.c b/target-i386/kvm.c index fefd5a5..9bd2952 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -789,7 +789,7 @@ static int kvm_get_mp_state(CPUState *env) } #endif -int kvm_put_vcpu_events(CPUState *env, int level) +static int kvm_put_vcpu_events(CPUState *env, int level) { #ifdef KVM_CAP_VCPU_EVENTS struct kvm_vcpu_events events; @@ -825,7 +825,7 @@ int kvm_put_vcpu_events(CPUState *env, int level) #endif } -int kvm_get_vcpu_events(CPUState *env) +static int kvm_get_vcpu_events(CPUState *env) { #ifdef KVM_CAP_VCPU_EVENTS struct kvm_vcpu_events events; diff --git a/target-i386/machine.c b/target-i386/machine.c index 6fca559..bcc315b 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -5,7 +5,6 @@ #include "exec-all.h" #include "kvm.h" -#include "qemu-kvm.h" static const VMStateDescription vmstate_segment = { .name = "segment", @@ -322,10 +321,6 @@ static void cpu_pre_save(void *opaque) CPUState *env = opaque; int i; - if (kvm_enabled()) { - kvm_get_vcpu_events(env); - } - /* FPU */ env->fpus_vmstate = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; env->fptag_vmstate = 0; @@ -362,7 +357,6 @@ static int cpu_post_load(void *opaque, int version_id) if (kvm_enabled()) { kvm_load_tsc(env); - kvm_put_vcpu_events(env, KVM_PUT_FULL_STATE); } return 0;