From: Jan Kiszka <jan.kis...@siemens.com>

Avoid passing a non-PCI IRQ to ich9_gsi_to_pirq. It's wrong and triggers
an assertion.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
Signed-off-by: Jason Baron <jba...@redhat.com>
---
 hw/q35.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/q35.c b/hw/q35.c
index 09e8bd7..8b6a2e5 100644
--- a/hw/q35.c
+++ b/hw/q35.c
@@ -657,9 +657,11 @@ static void ich9_lpc_update_apic(ICH9_LPCIrqState 
*irq_state, int gsi)
 {
     GMCH_PCIHost *s = container_of(irq_state, GMCH_PCIHost, irq_state);
     ICH9_LPCState *lpc = irq_state->lpc;
-    int level;
+    int level = 0;
 
-    level = pci_bus_get_irq_level(s->host.pci.bus, ich9_gsi_to_pirq(gsi));
+    if (gsi >= ICH9_LPC_PIC_NUM_PINS) {
+        level |= pci_bus_get_irq_level(s->host.pci.bus, ich9_gsi_to_pirq(gsi));
+    }
     if (gsi == ich9_lpc_sci_irq(lpc)) {
         level |= lpc->sci_level;
     }
-- 
1.7.1


Reply via email to