From patchwork Wed Nov 14 20:54:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v4,11/14] q35: Fix non-PCI IRQ processing in ich9_lpc_update_apic Date: Wed, 14 Nov 2012 10:54:08 -0000 From: Jason Baron X-Patchwork-Id: 199029 Message-Id: <2c22baaff40131e9edf5ce9fd977982bd9123f88.1352922993.git.jbaron@redhat.com> To: anthony@codemonkey.ws, qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, armbru@redhat.com, agraf@suse.de, blauwirbel@gmail.com, yamahata@valinux.co.jp, juzhang@redhat.com, kevin@koconnor.net, kraxel@redhat.com, gsomlo@gmail.com, mkletzan@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, afaerber@suse.de From: Jan Kiszka Avoid passing a non-PCI IRQ to ich9_gsi_to_pirq. It's wrong and triggers an assertion. Reviewed-by: Paolo Bonzini Signed-off-by: Jan Kiszka Signed-off-by: Jason Baron --- hw/lpc_ich9.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/lpc_ich9.c b/hw/lpc_ich9.c index f8f06b3..2fc83a4 100644 --- a/hw/lpc_ich9.c +++ b/hw/lpc_ich9.c @@ -264,9 +264,11 @@ static int ich9_gsi_to_pirq(int gsi) static void ich9_lpc_update_apic(ICH9LPCState *lpc, int gsi) { - int level; + int level = 0; - level = pci_bus_get_irq_level(lpc->d.bus, ich9_gsi_to_pirq(gsi)); + if (gsi >= ICH9_LPC_PIC_NUM_PINS) { + level |= pci_bus_get_irq_level(lpc->d.bus, ich9_gsi_to_pirq(gsi)); + } if (gsi == ich9_lpc_sci_irq(lpc)) { level |= lpc->sci_level; }