All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Avi Kivity <avi@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [FOR 0.12][RESEND][PATCH] kvm: x86: Use separate exception_injected CPUState field
Date: Mon, 14 Dec 2009 12:26:17 +0100	[thread overview]
Message-ID: <4B2620D9.4000903@siemens.com> (raw)
In-Reply-To: <4B1FEA8A.6000603@siemens.com>

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 <jan.kiszka@siemens.com>
---

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),

      reply	other threads:[~2009-12-14 11:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09 18:20 [Qemu-devel] [PATCH] kvm: x86: Use separate exception_injected CPUState field Jan Kiszka
2009-12-14 11:26 ` Jan Kiszka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B2620D9.4000903@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.