From patchwork Thu Jan 6 17:56:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 77758 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 E3A6EB7146 for ; Fri, 7 Jan 2011 05:15:59 +1100 (EST) Received: from localhost ([127.0.0.1]:39509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PauNQ-0002Ak-Ci for incoming@patchwork.ozlabs.org; Thu, 06 Jan 2011 13:15:56 -0500 Received: from [140.186.70.92] (port=32812 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PauBD-0003ts-KC for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:03:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PauBA-0006ac-D7 for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:03:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PauBA-0006Zy-16 for qemu-devel@nongnu.org; Thu, 06 Jan 2011 13:03:16 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p06I3F3v020763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Jan 2011 13:03:15 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p06I3EUQ014239; Thu, 6 Jan 2011 13:03:14 -0500 Received: from amt.cnet (vpn1-4-164.ams2.redhat.com [10.36.4.164]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p06I3Cjq019114; Thu, 6 Jan 2011 13:03:13 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 2EDA168A27B; Thu, 6 Jan 2011 15:59:50 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p06HxkPr011411; Thu, 6 Jan 2011 15:59:46 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Thu, 6 Jan 2011 15:56:40 -0200 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 34/35] 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 Signed-off-by: Marcelo Tosatti --- 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 :