All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: Fix GSI handling with in-kernel irqchip
@ 2012-02-06 11:20 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2012-02-06 11:20 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-02-06 11:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-06 11:20 [PATCH] qemu-kvm: Fix GSI handling with in-kernel irqchip Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.