From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGy3Y-00085S-Oq for qemu-devel@nongnu.org; Wed, 17 Jun 2009 12:32:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGy3T-0007xI-Hh for qemu-devel@nongnu.org; Wed, 17 Jun 2009 12:32:11 -0400 Received: from [199.232.76.173] (port=41029 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGy3S-0007wm-Rc for qemu-devel@nongnu.org; Wed, 17 Jun 2009 12:32:06 -0400 Received: from mx2.redhat.com ([66.187.237.31]:32768) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGy3S-0008Jk-2E for qemu-devel@nongnu.org; Wed, 17 Jun 2009 12:32:06 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5HGW4DV031533 for ; Wed, 17 Jun 2009 12:32:04 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5HGW4Uc014530 for ; Wed, 17 Jun 2009 12:32:04 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5HGW3aR020692 for ; Wed, 17 Jun 2009 12:32:03 -0400 From: Gleb Natapov Date: Wed, 17 Jun 2009 19:32:00 +0300 Message-Id: <1245256322-30990-1-git-send-email-gleb@redhat.com> Subject: [Qemu-devel] [PATCH 1/3] Add pci_bus_reset() function. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org To reset internal irq handling data structures. Signed-off-by: Gleb Natapov Signed-off-by: Yaniv Kamay --- hw/pci.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 0a738db..140cdba 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -87,6 +87,21 @@ static int pcibus_load(QEMUFile *f, void *opaque, int version_id) return 0; } +static void pci_bus_reset(void *opaque) +{ + PCIBus *bus = (PCIBus *)opaque; + int i; + + for (i = 0; i < bus->nirq; i++) { + bus->irq_count[i] = 0; + } + for (i = 0; i < 256; i++) { + if (bus->devices[i]) + memset(bus->devices[i]->irq_state, 0, + sizeof(bus->devices[i]->irq_state)); + } +} + PCIBus *pci_register_bus(DeviceState *parent, const char *name, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, qemu_irq *pic, int devfn_min, int nirq) @@ -105,6 +120,7 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name, bus->next = first_bus; first_bus = bus; register_savevm("PCIBUS", nbus++, 1, pcibus_save, pcibus_load, bus); + qemu_register_reset(pci_bus_reset, 0, bus); return bus; } -- 1.6.2.1