From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Various NICs: Fix suspend/resume of multiple instances
Date: Wed, 16 Jul 2008 19:20:11 +0200 [thread overview]
Message-ID: <487E2DCB.2090902@siemens.com> (raw)
We ran into the issue that restoring two (or more) instances of the same
NIC does not work. The reason is that the same instance number is passed
to register_savevm by many NIC emulations. Patch below addresses this
for eepro100, ne2000, pcnet and rtl8139 (I just quickly checked the set
available for x86).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/eepro100.c | 4 ++--
hw/ne2000.c | 3 ++-
hw/pcnet.c | 4 +++-
hw/rtl8139.c | 4 ++--
4 files changed, 9 insertions(+), 6 deletions(-)
Index: b/hw/pcnet.c
===================================================================
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1896,6 +1896,8 @@ static int pcnet_load(QEMUFile *f, void
static void pcnet_common_init(PCNetState *d, NICInfo *nd, const char *info_str)
{
+ static int instance;
+
d->poll_timer = qemu_new_timer(vm_clock, pcnet_poll_timer, d);
d->nd = nd;
@@ -1916,7 +1918,7 @@ static void pcnet_common_init(PCNetState
d->vc = NULL;
}
pcnet_h_reset(d);
- register_savevm("pcnet", 0, 2, pcnet_save, pcnet_load, d);
+ register_savevm("pcnet", instance++, 2, pcnet_save, pcnet_load, d);
}
/* PCI interface */
Index: b/hw/eepro100.c
===================================================================
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1745,6 +1745,7 @@ static void nic_save(QEMUFile * f, void
static void nic_init(PCIBus * bus, NICInfo * nd,
const char *name, uint32_t device)
{
+ static int instance;
PCIEEPRO100State *d;
EEPRO100State *s;
@@ -1792,8 +1793,7 @@ static void nic_init(PCIBus * bus, NICIn
qemu_register_reset(nic_reset, s);
- /* XXX: instance number ? */
- register_savevm(name, 0, 3, nic_save, nic_load, s);
+ register_savevm(name, instance++, 3, nic_save, nic_load, s);
}
void pci_i82551_init(PCIBus * bus, NICInfo * nd, int devfn)
Index: b/hw/ne2000.c
===================================================================
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -720,6 +720,7 @@ static int ne2000_load(QEMUFile* f,void*
void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd)
{
+ static int instance;
NE2000State *s;
s = qemu_mallocz(sizeof(NE2000State));
@@ -753,7 +754,7 @@ void isa_ne2000_init(int base, qemu_irq
s->macaddr[4],
s->macaddr[5]);
- register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s);
+ register_savevm("ne2000", instance++, 2, ne2000_save, ne2000_load, s);
}
/***********************************************************/
Index: b/hw/rtl8139.c
===================================================================
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3402,6 +3402,7 @@ static void rtl8139_timer(void *opaque)
void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn)
{
+ static int instance;
PCIRTL8139State *d;
RTL8139State *s;
uint8_t *pci_conf;
@@ -3454,8 +3455,7 @@ void pci_rtl8139_init(PCIBus *bus, NICIn
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", instance++, 3, rtl8139_save, rtl8139_load, s);
#if RTL8139_ONBOARD_TIMER
s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s);
next reply other threads:[~2008-07-16 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-16 17:20 Jan Kiszka [this message]
2008-07-16 23:44 ` [Qemu-devel] [PATCH] Various NICs: Fix suspend/resume of multiple instances Paul Brook
2008-07-17 8:15 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=487E2DCB.2090902@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.