]> git.proxmox.com Git - qemu.git/commitdiff
KVM: Don't assume that mpstate exists with in-kernel PIC always
authorAlexander Graf <agraf@suse.de>
Wed, 24 Apr 2013 20:24:12 +0000 (22:24 +0200)
committerAlexander Graf <agraf@suse.de>
Sun, 30 Jun 2013 23:11:13 +0000 (01:11 +0200)
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
include/sysemu/kvm.h
kvm-all.c

diff --git a/cpus.c b/cpus.c
index 86571f913c0b4c53f05da060882b76e8aa479057..20958e5a5919755e92b9f41201703b1921228104 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -71,7 +71,7 @@ static bool cpu_thread_is_idle(CPUState *cpu)
         return true;
     }
     if (!cpu->halted || qemu_cpu_has_work(cpu) ||
-        kvm_async_interrupts_enabled()) {
+        kvm_halt_in_kernel()) {
         return false;
     }
     return true;
index fe8bc4077ca73dd6b43a2b513990e4508d4ca4e5..24c8e9569cb75a4f536d5350e753b9d5be46c18c 100644 (file)
@@ -42,6 +42,7 @@
 extern bool kvm_allowed;
 extern bool kvm_kernel_irqchip;
 extern bool kvm_async_interrupts_allowed;
+extern bool kvm_halt_in_kernel_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_readonly_mem_allowed;
  */
 #define kvm_async_interrupts_enabled() (kvm_async_interrupts_allowed)
 
+/**
+ * kvm_halt_in_kernel
+ *
+ * Returns: true if halted cpus should still get a KVM_RUN ioctl to run
+ * inside of kernel space. This only works if MP state is implemented.
+ */
+#define kvm_halt_in_kernel() (kvm_halt_in_kernel_allowed)
+
 /**
  * kvm_irqfds_enabled:
  *
@@ -110,6 +119,7 @@ extern bool kvm_readonly_mem_allowed;
 #define kvm_enabled()           (0)
 #define kvm_irqchip_in_kernel() (false)
 #define kvm_async_interrupts_enabled() (false)
+#define kvm_halt_in_kernel() (false)
 #define kvm_irqfds_enabled() (false)
 #define kvm_msi_via_irqfd_enabled() (false)
 #define kvm_gsi_routing_allowed() (false)
index 7a1684ed788a0de3ca8cd5518f38ccde74f59c19..82ecebb784813512b40eb39fbea6f9950e3ae5dd 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -107,6 +107,7 @@ struct KVMState
 KVMState *kvm_state;
 bool kvm_kernel_irqchip;
 bool kvm_async_interrupts_allowed;
+bool kvm_halt_in_kernel_allowed;
 bool kvm_irqfds_allowed;
 bool kvm_msi_via_irqfd_allowed;
 bool kvm_gsi_routing_allowed;
@@ -1303,6 +1304,7 @@ static int kvm_irqchip_create(KVMState *s)
      * interrupt delivery (though the reverse is not necessarily true)
      */
     kvm_async_interrupts_allowed = true;
+    kvm_halt_in_kernel_allowed = true;
 
     kvm_init_irq_routing(s);