From patchwork Tue Jan 4 08:32:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 77411 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 4293DB7063 for ; Tue, 4 Jan 2011 19:44:51 +1100 (EST) Received: from localhost ([127.0.0.1]:43547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pa2Vc-0007St-AJ for incoming@patchwork.ozlabs.org; Tue, 04 Jan 2011 03:44:48 -0500 Received: from [140.186.70.92] (port=55876 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pa2K4-00017u-Qg for qemu-devel@nongnu.org; Tue, 04 Jan 2011 03:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pa2Jy-0004gY-0M for qemu-devel@nongnu.org; Tue, 04 Jan 2011 03:32:52 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:42658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pa2Jx-0004fz-IV for qemu-devel@nongnu.org; Tue, 04 Jan 2011 03:32:45 -0500 Received: from smtp04.web.de ( [172.20.0.225]) by fmmailgate02.web.de (Postfix) with ESMTP id EF7B0192E3DBE; Tue, 4 Jan 2011 09:32:44 +0100 (CET) Received: from [88.64.22.98] (helo=localhost.localdomain) by smtp04.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1Pa2Jw-00050n-03; Tue, 04 Jan 2011 09:32:44 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Tue, 4 Jan 2011 09:32:33 +0100 Message-Id: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX19pRuBQyJrdgRmis/22s1UTQDIqCTQLVsYwo9ss 5kgE+V6lKA5gDZh0Q1we/ZSw2mTcr6wwrjKfK76K7YTeKz0bsm 7I6keEB38= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH v3 21/21] kvm: x86: Implicitly clear nmi_injected/pending on reset 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 From: Jan Kiszka All CPUX86State variables before CPU_COMMON are automatically cleared on reset. Reorder nmi_injected and nmi_pending to avoid having to touch them explicitly. Signed-off-by: Jan Kiszka --- target-i386/cpu.h | 6 ++++-- target-i386/kvm.c | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index a457423..af701a4 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -699,6 +699,10 @@ typedef struct CPUX86State { uint32_t smbase; int old_exception; /* exception in flight */ + /* KVM states, automatically cleared on reset */ + uint8_t nmi_injected; + uint8_t nmi_pending; + CPU_COMMON /* processor features (e.g. for CPUID insn) */ @@ -726,8 +730,6 @@ typedef struct CPUX86State { int32_t exception_injected; int32_t interrupt_injected; uint8_t soft_interrupt; - uint8_t nmi_injected; - uint8_t nmi_pending; uint8_t has_error_code; uint32_t sipi_vector; uint32_t cpuid_kvm_features; diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 50d8ec8..79a1da8 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -520,8 +520,6 @@ void kvm_arch_reset_vcpu(CPUState *env) { env->exception_injected = -1; env->interrupt_injected = -1; - env->nmi_injected = 0; - env->nmi_pending = 0; env->xcr0 = 1; if (kvm_irqchip_in_kernel()) { env->mp_state = cpu_is_bsp(env) ? KVM_MP_STATE_RUNNABLE :