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@xxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html