Patchwork [v2,11/11] remove smp restriction from kvm

login
register
mail settings
Submitter Glauber Costa
Date Dec. 1, 2009, 12:51 p.m.
Message ID <1259671897-22232-12-git-send-email-glommer@redhat.com>
Download mbox | patch
Permalink /patch/39907/
State New
Headers show

Comments

Glauber Costa - Dec. 1, 2009, 12:51 p.m.
We don't support smp without irqchip in kernel, so only abort in
that situation

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 kvm-all.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 286d0ee..db5daf6 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -438,15 +438,23 @@  static int kvm_create_irqchip(KVMState *s)
 {
     int ret = 0;
 #if defined(CONFIG_IOTHREAD)
+    ret = -1;
     if (!kvm_check_extension(s, KVM_CAP_IRQCHIP))
-        return -1;
+        goto failed;
 
     ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
     if (ret < 0)
-        return ret;
+        goto failed;
 
     s->irqchip_in_kernel = 1;
+
+    return ret;
+failed:
 #endif
+    if (smp_cpus > 1) {
+        fprintf(stderr, "No SMP KVM support, use '-smp 1'\n");
+        ret = -EINVAL;
+    }
     return ret;
 }
 
@@ -459,11 +467,6 @@  int kvm_init(int smp_cpus)
     int ret;
     int i;
 
-    if (smp_cpus > 1) {
-        fprintf(stderr, "No SMP KVM support, use '-smp 1'\n");
-        return -EINVAL;
-    }
-
     s = qemu_mallocz(sizeof(KVMState));
 
 #ifdef KVM_CAP_SET_GUEST_DEBUG