summary refs log tree commit diff stats
path: root/hw/pci/pci.c
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2014-03-31 14:31:44 -0400
committerPeter Maydell <peter.maydell@linaro.org>2014-03-31 19:53:34 +0100
commit58b590148ca1b19f64f533d40e32b5acce5c21e7 (patch)
tree238f093e6ee30daf378397edd850617f4ad01872 /hw/pci/pci.c
parent7d4d7975e58b66de6a67ecb5aa9656653653a658 (diff)
downloadfocaccia-qemu-58b590148ca1b19f64f533d40e32b5acce5c21e7.tar.gz
focaccia-qemu-58b590148ca1b19f64f533d40e32b5acce5c21e7.zip
pci: Fix clearing IRQs on reset
irq_state is cleared before calling pci_device_deassert_intx, but the
latter misbehaves if the former isn't accurate. In this case, any raised
IRQs are not cleared, which hits an assertion in pcibus_reset:

qemu-system-x86_64: hw/pci/pci.c:250: pcibus_reset: Assertion
`bus->irq_count[i] == 0' failed.

pci_device_deassert_intx should clear irq_state anyways, so add
an assert.

This fixes migration with usb2 + usb-tablet.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 7da1ad94ce027183b4049c2de370cb191b0073c1.1396290569.git.crobinso@redhat.com
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/pci/pci.c')
-rw-r--r--hw/pci/pci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 8f722dd961..2a9f08eb0a 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -189,9 +189,9 @@ static void pci_do_device_reset(PCIDevice *dev)
 {
     int r;
 
-    dev->irq_state = 0;
-    pci_update_irq_status(dev);
     pci_device_deassert_intx(dev);
+    assert(dev->irq_state == 0);
+
     /* Clear all writable bits */
     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
                                  pci_get_word(dev->wmask + PCI_COMMAND) |