diff mbox

[09/10] Initialize in-kernel irqchip

Message ID 1267215141-13629-10-git-send-email-glommer@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Glauber Costa Feb. 26, 2010, 8:12 p.m. UTC
None
diff mbox

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 0527e0f..3038465 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -592,6 +592,25 @@  int kvm_set_irq(int irq, int level, int *status)
     return kvm_arch_set_irq(kvm_state, irq, level, status);
 }
 
+static int kvm_create_irqchip(KVMState *s)
+{
+    int ret = 0;
+
+    if (!kvm_use_kernel_chip)
+        return ret;
+#if defined(CONFIG_IOTHREAD)
+    if (!kvm_check_extension(s, KVM_CAP_IRQCHIP))
+        return -1;
+
+    ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
+    if (ret < 0)
+        return ret;
+
+    s->irqchip_in_kernel = 1;
+#endif
+    return ret;
+}
+
 int kvm_init(int smp_cpus)
 {
     static const char upgrade_note[] =
@@ -683,6 +702,10 @@  int kvm_init(int smp_cpus)
     s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS);
 #endif
 
+    ret = kvm_create_irqchip(s);
+    if (ret < 0)
+        goto err;
+
     ret = kvm_arch_init(s, smp_cpus);
     if (ret < 0)
         goto err;