pci: Fix clearing IRQs on reset
PATCH 1/1 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.
--- hw/pci/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci/pci.c +2 -2
@@ -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) |
Signature · 1 line
1.8.5.3
Il 31/03/2014 20:31, Cole Robinson ha scritto:
Quoted 24 lines
irq_stateis cleared before callingpci_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 inpcibus_reset:qemu-system-x86_64:
hw/pci/pci.c:250:pcibus_reset: Assertion `bus->irq_count[i] == 0' failed.
pci_device_deassert_intxshould clearirq_stateanyways, so add an assert.This fixes migration with usb2 + usb-tablet.
Signed-off-by Cole Robinson <[email protected]>--- hw/pci/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/pci/pci.c +0
-0@@ -189,9 +189,9 @@ static void pci_do_device_reset(PCIDevice *dev) {
hw/pci/pci.c static void pci_do_device_reset(PCIDevice *dev) · line 197
Quoted 10 lines
hw/pci/pci.c +2
-2int 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) |
Quoted 7 lines · Cole Robinson
irq_stateis cleared before callingpci_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 inpcibus_reset:qemu-system-x86_64:
hw/pci/pci.c:250:pcibus_reset: Assertion `bus->irq_count[i] == 0' failed.
Quoted 6 lines
pci_device_deassert_intxshould clearirq_stateanyways, so add an assert.This fixes migration with usb2 + usb-tablet.
Signed-off-by Cole Robinson <[email protected]>
Peter, could you pick this up for RC3 if not too late?
Quoted 22 lines
--- hw/pci/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/pci/pci.c +2
-2@@ -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) |Signature · 1 line
1.8.5.3
Peter Maydell
AppliedQuoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Cole Robinson
irq_stateis cleared before callingpci_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 inpcibus_reset:qemu-system-x86_64:
hw/pci/pci.c:250:pcibus_reset: Assertion `bus->irq_count[i] == 0' failed.
pci_device_deassert_intxshould clearirq_stateanyways, so add an assert.
Quoted 8 lines
Quoted 3 lines
This fixes migration with usb2 + usb-tablet.
Signed-off-by Cole Robinson <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Peter, could you pick this up for RC3 if not too late?
Applied to master, thanks.
thanks
-- PMM