From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUh0i-0000cK-IN for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:32:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUh0b-0003w4-J2 for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:32:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUh0b-0003vn-BI for qemu-devel@nongnu.org; Mon, 31 Mar 2014 14:32:33 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2VIWWlH011494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 31 Mar 2014 14:32:32 -0400 Message-ID: <5339B4BD.50706@redhat.com> Date: Mon, 31 Mar 2014 20:32:29 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <7da1ad94ce027183b4049c2de370cb191b0073c1.1396290569.git.crobinso@redhat.com> In-Reply-To: <7da1ad94ce027183b4049c2de370cb191b0073c1.1396290569.git.crobinso@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.0] pci: Fix clearing IRQs on reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cole Robinson , qemu-devel@nongnu.org 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 > --- > 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