From patchwork Mon Dec 14 11:26:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 41086 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 66321B6F14 for ; Mon, 14 Dec 2009 22:27:13 +1100 (EST) Received: from localhost ([127.0.0.1]:49078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NK954-0006Bk-7F for incoming@patchwork.ozlabs.org; Mon, 14 Dec 2009 06:27:10 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NK94N-0006Bc-Fd for qemu-devel@nongnu.org; Mon, 14 Dec 2009 06:26:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NK94I-0006B2-On for qemu-devel@nongnu.org; Mon, 14 Dec 2009 06:26:26 -0500 Received: from [199.232.76.173] (port=34086 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NK94I-0006Az-HO for qemu-devel@nongnu.org; Mon, 14 Dec 2009 06:26:22 -0500 Received: from thoth.sbs.de ([192.35.17.2]:21592) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NK94H-0003Kf-Ur for qemu-devel@nongnu.org; Mon, 14 Dec 2009 06:26:22 -0500 Received: from mail3.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id nBEBQIZh006764; Mon, 14 Dec 2009 12:26:18 +0100 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id nBEBQH82027869; Mon, 14 Dec 2009 12:26:18 +0100 Message-ID: <4B2620D9.4000903@siemens.com> Date: Mon, 14 Dec 2009 12:26:17 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Anthony Liguori References: <4B1FEA8A.6000603@siemens.com> In-Reply-To: <4B1FEA8A.6000603@siemens.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Marcelo Tosatti , Avi Kivity , qemu-devel Subject: [Qemu-devel] [FOR 0.12][RESEND][PATCH] kvm: x86: Use separate exception_injected CPUState field 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 Marcelo correctly remarked that there are usage conflicts between QEMU core code and KVM /wrt exception_index. So spend a separate field and also save/restore it properly. Signed-off-by: Jan Kiszka --- NOTE: This obsoletes the meanwhile merge patch 4d6e3ac5d411c461d0fb4b1cd2ace854963c9e30, please revert it! target-i386/cpu.h | 1 + target-i386/kvm.c | 6 +++--- target-i386/machine.c | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 9ef1be4..afb4da5 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -694,6 +694,7 @@ typedef struct CPUX86State { /* For KVM */ uint32_t mp_state; + int32_t exception_injected; int32_t interrupt_injected; uint8_t soft_interrupt; uint8_t nmi_injected; diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 53955b4..de79eb7 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -720,8 +720,8 @@ static int kvm_put_vcpu_events(CPUState *env) return 0; } - events.exception.injected = (env->exception_index >= 0); - events.exception.nr = env->exception_index; + events.exception.injected = (env->exception_injected >= 0); + events.exception.nr = env->exception_injected; events.exception.has_error_code = env->has_error_code; events.exception.error_code = env->error_code; @@ -755,7 +755,7 @@ static int kvm_get_vcpu_events(CPUState *env) if (ret < 0) { return ret; } - env->exception_index = + env->exception_injected = events.exception.injected ? events.exception.nr : -1; env->has_error_code = events.exception.has_error_code; env->error_code = events.exception.error_code; diff --git a/target-i386/machine.c b/target-i386/machine.c index 2fb8fab..567e01e 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -448,6 +448,7 @@ static const VMStateDescription vmstate_cpu = { VMSTATE_INT32_V(interrupt_injected, CPUState, 9), VMSTATE_UINT32_V(mp_state, CPUState, 9), VMSTATE_UINT64_V(tsc, CPUState, 9), + VMSTATE_INT32_V(exception_injected, CPUState, 11), VMSTATE_UINT8_V(soft_interrupt, CPUState, 11), VMSTATE_UINT8_V(nmi_injected, CPUState, 11), VMSTATE_UINT8_V(nmi_pending, CPUState, 11),