From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJuHu-00079d-13 for qemu-devel@nongnu.org; Fri, 18 Jul 2008 14:02:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJuHt-00079O-08 for qemu-devel@nongnu.org; Fri, 18 Jul 2008 14:02:37 -0400 Received: from [199.232.76.173] (port=50721 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJuHs-00079L-Q4 for qemu-devel@nongnu.org; Fri, 18 Jul 2008 14:02:36 -0400 Received: from savannah.gnu.org ([199.232.41.3]:50514 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KJuHs-0004YX-81 for qemu-devel@nongnu.org; Fri, 18 Jul 2008 14:02:36 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KJuHr-00054i-OO for qemu-devel@nongnu.org; Fri, 18 Jul 2008 18:02:35 +0000 Received: from ths by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KJuHr-00054d-BS for qemu-devel@nongnu.org; Fri, 18 Jul 2008 18:02:35 +0000 MIME-Version: 1.0 Errors-To: ths Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Thiemo Seufer Message-Id: Date: Fri, 18 Jul 2008 18:02:35 +0000 Subject: [Qemu-devel] [4892] Various NICs: Fix suspend/resume of multiple instances, by Jan Kiszka. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4892 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4892 Author: ths Date: 2008-07-18 18:02:34 +0000 (Fri, 18 Jul 2008) Log Message: ----------- Various NICs: Fix suspend/resume of multiple instances, by Jan Kiszka. Modified Paths: -------------- trunk/hw/e1000.c trunk/hw/eepro100.c trunk/hw/ne2000.c trunk/hw/pcnet.c trunk/hw/rtl8139.c trunk/vl.c Modified: trunk/hw/e1000.c =================================================================== --- trunk/hw/e1000.c 2008-07-18 18:01:29 UTC (rev 4891) +++ trunk/hw/e1000.c 2008-07-18 18:02:34 UTC (rev 4892) @@ -76,7 +76,6 @@ PCIDevice dev; VLANClientState *vc; NICInfo *nd; - uint32_t instance; uint32_t mmio_base; int mmio_index; @@ -814,7 +813,6 @@ int i, j; pci_device_save(&s->dev, f); - qemu_put_be32s(f, &s->instance); qemu_put_be32s(f, &s->mmio_base); qemu_put_be32s(f, &s->rxbuf_size); qemu_put_be32s(f, &s->rxbuf_min_shift); @@ -859,7 +857,8 @@ if ((ret = pci_device_load(&s->dev, f)) < 0) return ret; - qemu_get_be32s(f, &s->instance); + if (version_id == 1) + qemu_get_be32s(f, &i); /* once some unused instance id */ qemu_get_be32s(f, &s->mmio_base); qemu_get_be32s(f, &s->rxbuf_size); qemu_get_be32s(f, &s->rxbuf_min_shift); @@ -958,7 +957,6 @@ { E1000State *d; uint8_t *pci_conf; - static int instance; uint16_t checksum = 0; char *info_str = "e1000"; int i; @@ -989,8 +987,6 @@ pci_register_io_region((PCIDevice *)d, 1, IOPORT_SIZE, PCI_ADDRESS_SPACE_IO, ioport_map); - d->instance = instance++; - d->nd = nd; memmove(d->eeprom_data, e1000_eeprom_template, sizeof e1000_eeprom_template); @@ -1016,5 +1012,5 @@ d->nd->macaddr[0], d->nd->macaddr[1], d->nd->macaddr[2], d->nd->macaddr[3], d->nd->macaddr[4], d->nd->macaddr[5]); - register_savevm(info_str, d->instance, 1, nic_save, nic_load, d); + register_savevm(info_str, -1, 2, nic_save, nic_load, d); } Modified: trunk/hw/eepro100.c =================================================================== --- trunk/hw/eepro100.c 2008-07-18 18:01:29 UTC (rev 4891) +++ trunk/hw/eepro100.c 2008-07-18 18:02:34 UTC (rev 4892) @@ -1792,8 +1792,7 @@ qemu_register_reset(nic_reset, s); - /* XXX: instance number ? */ - register_savevm(name, 0, 3, nic_save, nic_load, s); + register_savevm(name, -1, 3, nic_save, nic_load, s); } void pci_i82551_init(PCIBus * bus, NICInfo * nd, int devfn) Modified: trunk/hw/ne2000.c =================================================================== --- trunk/hw/ne2000.c 2008-07-18 18:01:29 UTC (rev 4891) +++ trunk/hw/ne2000.c 2008-07-18 18:02:34 UTC (rev 4892) @@ -753,7 +753,7 @@ s->macaddr[4], s->macaddr[5]); - register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s); + register_savevm("ne2000", -1, 2, ne2000_save, ne2000_load, s); } /***********************************************************/ @@ -823,6 +823,5 @@ s->macaddr[4], s->macaddr[5]); - /* XXX: instance number ? */ - register_savevm("ne2000", 0, 3, ne2000_save, ne2000_load, s); + register_savevm("ne2000", -1, 3, ne2000_save, ne2000_load, s); } Modified: trunk/hw/pcnet.c =================================================================== --- trunk/hw/pcnet.c 2008-07-18 18:01:29 UTC (rev 4891) +++ trunk/hw/pcnet.c 2008-07-18 18:02:34 UTC (rev 4892) @@ -1916,7 +1916,7 @@ d->vc = NULL; } pcnet_h_reset(d); - register_savevm("pcnet", 0, 2, pcnet_save, pcnet_load, d); + register_savevm("pcnet", -1, 2, pcnet_save, pcnet_load, d); } /* PCI interface */ Modified: trunk/hw/rtl8139.c =================================================================== --- trunk/hw/rtl8139.c 2008-07-18 18:01:29 UTC (rev 4891) +++ trunk/hw/rtl8139.c 2008-07-18 18:02:34 UTC (rev 4892) @@ -3454,8 +3454,7 @@ s->cplus_txbuffer_len = 0; s->cplus_txbuffer_offset = 0; - /* XXX: instance number ? */ - register_savevm("rtl8139", 0, 3, rtl8139_save, rtl8139_load, s); + register_savevm("rtl8139", -1, 3, rtl8139_save, rtl8139_load, s); #if RTL8139_ONBOARD_TIMER s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s); Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2008-07-18 18:01:29 UTC (rev 4891) +++ trunk/vl.c 2008-07-18 18:02:34 UTC (rev 4892) @@ -6081,7 +6081,9 @@ static SaveStateEntry *first_se; /* TODO: Individual devices generally have very little idea about the rest - of the system, so instance_id should be removed/replaced. */ + of the system, so instance_id should be removed/replaced. + Meanwhile pass -1 as instance_id if you do not already have a clearly + distinguishing id for all instances of your device class. */ int register_savevm(const char *idstr, int instance_id, int version_id,