From patchwork Wed Feb 24 14:17:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 46127 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0180CB6F08 for ; Thu, 25 Feb 2010 01:52:06 +1100 (EST) Received: from localhost ([127.0.0.1]:52504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkIao-0004bj-Fz for incoming@patchwork.ozlabs.org; Wed, 24 Feb 2010 09:52:02 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkIYk-0003wE-2C for qemu-devel@nongnu.org; Wed, 24 Feb 2010 09:49:54 -0500 Received: from [199.232.76.173] (port=53216 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkIYj-0003vr-8e for qemu-devel@nongnu.org; Wed, 24 Feb 2010 09:49:53 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkIYg-0000t4-5n for qemu-devel@nongnu.org; Wed, 24 Feb 2010 09:49:52 -0500 Received: from goliath.siemens.de ([192.35.17.28]:23958) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NkIYf-0005PW-HK for qemu-devel@nongnu.org; Wed, 24 Feb 2010 09:49:49 -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 o1OEHwn2016340; Wed, 24 Feb 2010 15:17:58 +0100 Received: from localhost.localdomain (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail2.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o1OEHvk5006898; Wed, 24 Feb 2010 15:17:58 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Wed, 24 Feb 2010 15:17:54 +0100 Message-Id: <35e6f8913370cac63d9b67c1d920e7a0b9e06654.1267021065.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Gleb Natapov , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH v3 06/10] qemu-kvm: Use VCPU event state for reset and vmsave/load X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Push reading/writing of vcpu_events into kvm_arch_load/save_regs to avoid KVM-specific hooks in generic code. Signed-off-by: Jan Kiszka --- kvm.h | 2 -- qemu-kvm-x86.c | 6 ++++-- target-i386/kvm.c | 4 ++-- target-i386/machine.c | 6 ------ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/kvm.h b/kvm.h index 3ee307d..b3c3162 100644 --- a/kvm.h +++ b/kvm.h @@ -44,8 +44,6 @@ int kvm_log_stop(target_phys_addr_t phys_addr, ram_addr_t size); int kvm_has_sync_mmu(void); int kvm_has_vcpu_events(void); int kvm_has_robust_singlestep(void); -int kvm_put_vcpu_events(CPUState *env, int level); -int kvm_get_vcpu_events(CPUState *env); void kvm_cpu_register_phys_memory_client(void); diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index b0f9670..840c1c9 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -980,6 +980,8 @@ void kvm_arch_load_regs(CPUState *env, int level) env->halted = 0; } + kvm_put_vcpu_events(env, level); + /* must be last */ kvm_guest_debug_workarounds(env); } @@ -1153,6 +1155,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, @@ -1224,7 +1227,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 */ @@ -1391,7 +1394,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); kvm_reset_mpstate(env); if (!cpu_is_bsp(env) && !kvm_irqchip_in_kernel()) { env->interrupt_request &= ~CPU_INTERRUPT_HARD; diff --git a/target-i386/kvm.c b/target-i386/kvm.c index f1f44d3..74993de 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -786,7 +786,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; @@ -822,7 +822,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;