public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@sous-sol.org>
To: kvm@vger.kernel.org
Subject: [PATCH] kvm-userspace: fix compilation w/out KVM_CAP_MP_STATE
Date: Tue, 20 May 2008 18:24:24 -0700	[thread overview]
Message-ID: <20080521012423.GT30402@sequoia.sous-sol.org> (raw)

Add kvm_reset_mpstate inline function and only call it when
KVM_CAP_MP_STATE is defined.

qemu/qemu-kvm-x86.c:677: error: unknown field `mp_state' specified in initializer
qemu/qemu-kvm-x86.c:677: error: `KVM_MP_STATE_UNINITIALIZED' undeclared (first use in this function)
...

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
Note: could easily extend this to have an #else clause in libkvm.h
to simplify some of the ifdef-ery in qemu-kvm-x86.c.

 libkvm/libkvm.h     |    9 +++++++++
 qemu/qemu-kvm-x86.c |   10 +++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 31c0d59..63183b8 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -314,6 +314,15 @@ int kvm_get_mpstate(kvm_context_t kvm, int vcpu,
  */
 int kvm_set_mpstate(kvm_context_t kvm, int vcpu,
                     struct kvm_mp_state *mp_state);
+/*!
+ *  * \brief Reset VCPU MP state
+ *
+ */
+static inline int kvm_reset_mpstate(kvm_context_t kvm, int vcpu)
+{
+    struct kvm_mp_state mp_state = {.mp_state = KVM_MP_STATE_UNINITIALIZED};
+    return kvm_set_mpstate(kvm, vcpu, &mp_state);
+}
 #endif
 
 /*!
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 6cc08fc..197d761 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -674,13 +674,13 @@ int handle_tpr_access(void *opaque, int vcpu,
 
 void kvm_arch_cpu_reset(CPUState *env)
 {
-    struct kvm_mp_state mp_state = { .mp_state = KVM_MP_STATE_UNINITIALIZED };
-
     kvm_arch_load_regs(env);
     if (env->cpu_index != 0) {
-	if (kvm_irqchip_in_kernel(kvm_context))
-	    kvm_set_mpstate(kvm_context, env->cpu_index, &mp_state);
-	else {
+	if (kvm_irqchip_in_kernel(kvm_context)) {
+#ifdef KVM_CAP_MP_STATE
+	    kvm_reset_mpstate(kvm_context, env->cpu_index);
+#endif
+	} else {
 	    env->interrupt_request &= ~CPU_INTERRUPT_HARD;
 	    env->hflags |= HF_HALTED_MASK;
 	    env->exception_index = EXCP_HLT;

             reply	other threads:[~2008-05-21  1:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21  1:24 Chris Wright [this message]
2008-05-21 15:17 ` [PATCH] kvm-userspace: fix compilation w/out KVM_CAP_MP_STATE Avi Kivity

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=20080521012423.GT30402@sequoia.sous-sol.org \
    --to=chrisw@sous-sol.org \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox