[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 47/77] pci: Don't call pci_irq_handler() for a negativ
From: |
Benjamin Herrenschmidt |
Subject: |
[Qemu-ppc] [PATCH 47/77] pci: Don't call pci_irq_handler() for a negative intx |
Date: |
Wed, 11 Nov 2015 11:28:00 +1100 |
Under some circumstances, pci_intx() can return -1 (when the interrupt
pin in the config space is 0 which normally means no interrupt).
I have seen cases of pci_set_irq() being called on such devices, in
turn causing pci_irq_handler() to be called with "-1" as an argument
which doesn't seem like a terribly good idea.
Signed-off-by: Benjamin Herrenschmidt <address@hidden>
---
hw/pci/pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 7003f7c..b364eff 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1298,7 +1298,9 @@ qemu_irq pci_allocate_irq(PCIDevice *pci_dev)
void pci_set_irq(PCIDevice *pci_dev, int level)
{
int intx = pci_intx(pci_dev);
- pci_irq_handler(pci_dev, intx, level);
+ if (intx >= 0) {
+ pci_irq_handler(pci_dev, intx, level);
+ }
}
/* Special hooks used by device assignment */
--
2.5.0
- [Qemu-ppc] [PATCH 33/77] ppc/xics: Make the ICSState a list, (continued)
[Qemu-ppc] [PATCH 41/77] ppc/pnv: Add LPC controller and hook it up with a UART and RTC, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 47/77] pci: Don't call pci_irq_handler() for a negative intx,
Benjamin Herrenschmidt <=
[Qemu-ppc] [PATCH 46/77] pci: Use the new pci_can_add_device() to enforce devfn_min/max, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 43/77] ppc/pnv: Add OCC model stub with interrupt support, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 42/77] ppc/pnv: Add cut down PSI bridge model and hookup external interrupt, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 50/77] ppc: Update LPCR definitions, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 49/77] ppc/pnv: Create a default PCI layout, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 51/77] ppc: Use a helper to filter writes to LPCR, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 53/77] ppc: Add proper real mode translation support, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 52/77] ppc: Cosmetic, align some comments, Benjamin Herrenschmidt, 2015/11/10
[Qemu-ppc] [PATCH 63/77] ppc: Initialize AMOR in PAPR mode, Benjamin Herrenschmidt, 2015/11/10