public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: [PATCH] qemu-kvm: Fix GSI handling with in-kernel irqchip
Date: Mon, 06 Feb 2012 12:20:53 +0100	[thread overview]
Message-ID: <4F2FB795.7060504@siemens.com> (raw)

Interrupt routing with in-kernel irqchip was always a mess. Now this
increased after latest upstream merge: we started to call ioapic_set_irq
also for kernel-handled interrupts.

Reduce this mess again by using the upstream kvm_piix3_gsi_handler. It
is aware of the PIIX3-specific routing in KVM mode and won't call into
the user space APIC model (as we do not raise IRQs >= ISA_NUM_IRQS with
the PIIX3).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/pc_piix.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index a88f0a5..76f1fc7 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -90,6 +90,7 @@ static void kvm_piix3_setup_irq_routing(bool pci_enabled)
     }
 #endif /* CONFIG_KVM */
 }
+#endif
 
 static void kvm_piix3_gsi_handler(void *opaque, int n, int level)
 {
@@ -102,7 +103,6 @@ static void kvm_piix3_gsi_handler(void *opaque, int n, int level)
         qemu_set_irq(s->ioapic_irq[n], level);
     }
 }
-#endif
 
 static void ioapic_init(GSIState *gsi_state)
 {
@@ -194,14 +194,13 @@ static void pc_init1(MemoryRegion *system_memory,
     }
 
     gsi_state = g_malloc0(sizeof(*gsi_state));
-#ifdef UNUSED_UPSTREAM_KVM
     if (kvm_enabled() && kvm_irqchip_in_kernel()) {
+#ifdef UNUSED_UPSTREAM_KVM
         kvm_piix3_setup_irq_routing(pci_enabled);
+#endif
         gsi = qemu_allocate_irqs(kvm_piix3_gsi_handler, gsi_state,
                                  GSI_NUM_PINS);
-    } else
-#endif
-    {
+    } else {
         gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
     }
 
@@ -221,6 +220,7 @@ static void pc_init1(MemoryRegion *system_memory,
         isa_bus = isa_bus_new(NULL, system_io);
         no_hpet = 1;
     }
+    isa_bus_irqs(isa_bus, gsi);
 
 #ifdef UNUSED_UPSTREAM_KVM
     if (kvm_enabled() && kvm_irqchip_in_kernel()) {
@@ -240,13 +240,6 @@ static void pc_init1(MemoryRegion *system_memory,
     if (pci_enabled) {
         ioapic_init(gsi_state);
     }
-    if (!(kvm_enabled() && kvm_irqchip_in_kernel())) {
-        gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
-    } else {
-        gsi = i8259;
-    }
-
-    isa_bus_irqs(isa_bus, gsi);
 
     pc_register_ferr_irq(gsi[13]);
 
-- 
1.7.3.4

                 reply	other threads:[~2012-02-06 11:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4F2FB795.7060504@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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