qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] Add pci_bus_reset() function.


From: Dor Laor
Subject: Re: [Qemu-devel] [PATCH 2/3] Add pci_bus_reset() function.
Date: Tue, 09 Jun 2009 00:42:16 +0300
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Gleb Natapov wrote:
On Mon, Jun 08, 2009 at 05:35:11PM +0300, Avi Kivity wrote:
Gleb Natapov wrote:
To reset internal irq handling data structures.

Signed-off-by: Gleb Natapov <address@hidden>
Signed-off-by: Yaniv Kamay <address@hidden>
---
 hw/pci.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 02b335f..89fefdf 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -88,6 +88,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 < PCI_DEVICES_MAX; i++) {
+        if (bus->devices[i])
+            memset(bus->devices[i]->irq_state, 0,
+                   sizeof(bus->devices[i]->irq_state));
+    }
+}
+
Shouldn't each device's reset function bring its line low, thus zeroing the irq_state naturally?

If not, we have a bug somewhere. Note we have exactly the same issue with save/restore.

They should, but I haven't found one that does.
virtio does and so do many others. Sad thing is that all should do it since the line is shared.
e1000 and rtl8139 do not register a reset handler.

Maybe we should make it a required callback for pci_qdev_register? or better
have every (pci?) device register several callback together.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]