* [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset
@ 2014-03-31 18:31 Cole Robinson
2014-03-31 18:32 ` Paolo Bonzini
2014-03-31 18:53 ` Michael S. Tsirkin
0 siblings, 2 replies; 4+ messages in thread
From: Cole Robinson @ 2014-03-31 18:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Cole Robinson, Michael S. Tsirkin
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>
---
hw/pci/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 8f722dd..2a9f08e 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) |
--
1.8.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset
2014-03-31 18:31 [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset Cole Robinson
@ 2014-03-31 18:32 ` Paolo Bonzini
2014-03-31 18:53 ` Michael S. Tsirkin
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-03-31 18:32 UTC (permalink / raw)
To: Cole Robinson, qemu-devel; +Cc: Michael S. Tsirkin
Il 31/03/2014 20:31, Cole Robinson ha scritto:
> 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>
> ---
> hw/pci/pci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 8f722dd..2a9f08e 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) |
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset
2014-03-31 18:31 [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset Cole Robinson
2014-03-31 18:32 ` Paolo Bonzini
@ 2014-03-31 18:53 ` Michael S. Tsirkin
2014-03-31 19:09 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-03-31 18:53 UTC (permalink / raw)
To: Cole Robinson; +Cc: Paolo Bonzini, qemu-devel, peter.maydell
On Mon, Mar 31, 2014 at 02:31:44PM -0400, Cole Robinson wrote:
> 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>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Peter, could you pick this up for RC3 if not too late?
> ---
> hw/pci/pci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 8f722dd..2a9f08e 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) |
> --
> 1.8.5.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset
2014-03-31 18:53 ` Michael S. Tsirkin
@ 2014-03-31 19:09 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2014-03-31 19:09 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Paolo Bonzini, QEMU Developers, Cole Robinson
On 31 March 2014 19:53, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Mon, Mar 31, 2014 at 02:31:44PM -0400, Cole Robinson wrote:
>> 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>
>
>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>
> Peter, could you pick this up for RC3 if not too late?
Applied to master, thanks.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-31 19:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-31 18:31 [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset Cole Robinson
2014-03-31 18:32 ` Paolo Bonzini
2014-03-31 18:53 ` Michael S. Tsirkin
2014-03-31 19:09 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).