public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: kvm@vger.kernel.org
Subject: [PATCH 2/2] kvm: qemu: initialize irq routing table
Date: Wed, 14 Jan 2009 15:53:11 +0200	[thread overview]
Message-ID: <1231941191-966-3-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1231941191-966-1-git-send-email-avi@redhat.com>

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 qemu/qemu-kvm.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index e4fba78..e67b698 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -783,6 +783,8 @@ static int destroy_region_works = 0;
 int kvm_qemu_create_context(void)
 {
     int r;
+    int i;
+
     if (!kvm_irqchip) {
         kvm_disable_irqchip_creation(kvm_context);
     }
@@ -805,6 +807,28 @@ int kvm_qemu_create_context(void)
 #ifdef TARGET_I386
     destroy_region_works = kvm_destroy_memory_region_works(kvm_context);
 #endif
+
+    if (kvm_irqchip && kvm_has_gsi_routing(kvm_context)) {
+        kvm_clear_gsi_routes(kvm_context);
+        for (i = 0; i < 8; ++i) {
+            if (i == 2)
+                continue;
+            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_MASTER, i);
+            if (r < 0)
+                return r;
+        }
+        for (i = 8; i < 16; ++i) {
+            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
+            if (r < 0)
+                return r;
+        }
+        for (i = 0; i < 24; ++i) {
+            r = kvm_add_irq_route(kvm_context, i, KVM_IRQCHIP_IOAPIC, i);
+            if (r < 0)
+                return r;
+        }
+        kvm_commit_irq_routes(kvm_context);
+    }
     return 0;
 }
 
-- 
1.6.0.6


      parent reply	other threads:[~2009-01-14 13:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 13:53 [PATCH 0/2] irq routing userspace Avi Kivity
2009-01-14 13:53 ` [PATCH 1/2] kvm: libkvm: support for irq routing Avi Kivity
2009-01-15  6:17   ` Sheng Yang
2009-01-15  6:20     ` Sheng Yang
2009-01-15  9:59       ` Avi Kivity
2009-01-15 10:05         ` Sheng Yang
2009-01-15 10:10           ` Avi Kivity
2009-01-15  9:58     ` Avi Kivity
2009-01-14 13:53 ` Avi Kivity [this message]

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=1231941191-966-3-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=sheng@linux.intel.com \
    /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