qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-ppc@nongnu.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] KVM: Don't assume that mpstate exists with in-kernel PIC always
Date: Wed, 24 Apr 2013 22:49:49 +0200	[thread overview]
Message-ID: <1366836589-20822-1-git-send-email-agraf@suse.de> (raw)

On PPC, we don't support MP state. So far it's not necessary and I'm
not convinced yet that we really need to support it ever.

However, the current idle logic in QEMU assumes that an in-kernel PIC
also means we support MP state. This assumption is not true anymore.

Let's split up the two cases into two different variables. That way
PPC can expose an in-kernel PIC, while not implementing MP state.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Jan Kiszka <jan.kiszka@siemens.com>
---
 cpus.c               |    2 +-
 include/sysemu/kvm.h |   10 ++++++++++
 kvm-all.c            |    2 ++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/cpus.c b/cpus.c
index e919dd7..4a871c0 100644
--- a/cpus.c
+++ b/cpus.c
@@ -73,7 +73,7 @@ static bool cpu_thread_is_idle(CPUArchState *env)
         return true;
     }
     if (!cpu->halted || qemu_cpu_has_work(cpu) ||
-        kvm_async_interrupts_enabled()) {
+        (kvm_async_interrupts_enabled() && kvm_mpstate_enabled())) {
         return false;
     }
     return true;
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 8a9ebda..fbfb7f0 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -42,6 +42,7 @@
 extern bool kvm_allowed;
 extern bool kvm_kernel_irqchip;
 extern bool kvm_async_interrupts_allowed;
+extern bool kvm_mpstate_allowed;
 extern bool kvm_irqfds_allowed;
 extern bool kvm_msi_via_irqfd_allowed;
 extern bool kvm_gsi_routing_allowed;
@@ -72,6 +73,14 @@ extern bool kvm_gsi_routing_allowed;
 #define kvm_async_interrupts_enabled() (kvm_async_interrupts_allowed)
 
 /**
+ * kvm_supports_mpstate:
+ *
+ * Returns: true if the kvm side supports MP states which is
+ * required to indicate to kvm that a vcpu is currently halted
+ */
+#define kvm_mpstate_enabled() (kvm_mpstate_allowed)
+
+/**
  * kvm_irqfds_enabled:
  *
  * Returns: true if we can use irqfds to inject interrupts into
@@ -101,6 +110,7 @@ extern bool kvm_gsi_routing_allowed;
 #define kvm_enabled()           (0)
 #define kvm_irqchip_in_kernel() (false)
 #define kvm_async_interrupts_enabled() (false)
+#define kvm_supports_mpstate() (false)
 #define kvm_irqfds_enabled() (false)
 #define kvm_msi_via_irqfd_enabled() (false)
 #define kvm_gsi_routing_allowed() (false)
diff --git a/kvm-all.c b/kvm-all.c
index 130cdbc..f19a439 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -106,6 +106,7 @@ struct KVMState
 KVMState *kvm_state;
 bool kvm_kernel_irqchip;
 bool kvm_async_interrupts_allowed;
+bool kvm_mpstate_allowed;
 bool kvm_irqfds_allowed;
 bool kvm_msi_via_irqfd_allowed;
 bool kvm_gsi_routing_allowed;
@@ -1219,6 +1220,7 @@ static int kvm_irqchip_create(KVMState *s)
      * interrupt delivery (though the reverse is not necessarily true)
      */
     kvm_async_interrupts_allowed = true;
+    kvm_mpstate_allowed = true;
 
     kvm_init_irq_routing(s);
 
-- 
1.6.0.2

             reply	other threads:[~2013-04-24 20:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 20:49 Alexander Graf [this message]
2013-04-25  8:31 ` [Qemu-devel] [PATCH] KVM: Don't assume that mpstate exists with in-kernel PIC always Jan Kiszka
  -- strict thread matches above, loose matches on Subject: below --
2013-04-25  9:06 Alexander Graf
2013-04-25 16:13 ` Jan Kiszka
2013-04-25 16:46   ` Alexander Graf
2013-04-25 16:53     ` Jan Kiszka
2013-04-25 16:45 Alexander Graf

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=1366836589-20822-1-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).