summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2019-07-10 11:52:53 +0800
committerJason Wang <jasowang@redhat.com>2019-07-29 16:29:30 +0800
commitf46efa9b0895a7ff8ed0b4e874aee52a49f2a878 (patch)
tree2fc9f3370beef37dbf12990d4a7536121eb4f774
parentfff3159900d2b95613a9cb75fc3703e67a674729 (diff)
downloadfocaccia-qemu-f46efa9b0895a7ff8ed0b4e874aee52a49f2a878.tar.gz
focaccia-qemu-f46efa9b0895a7ff8ed0b4e874aee52a49f2a878.zip
e1000: don't raise interrupt in pre_save()
We should not raise any interrupt after VM has been stopped but this
is what e1000 currently did when mit timer is active in
pre_save(). Fixing this by scheduling a timer in post_load() which can
make sure the interrupt was raised when VM is running.

Reported-and-tested-by: Longpeng <longpeng2@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
-rw-r--r--hw/net/e1000.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 1dc1466332..a023ceb27c 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1381,11 +1381,6 @@ static int e1000_pre_save(void *opaque)
     E1000State *s = opaque;
     NetClientState *nc = qemu_get_queue(s->nic);
 
-    /* If the mitigation timer is active, emulate a timeout now. */
-    if (s->mit_timer_on) {
-        e1000_mit_timer(s);
-    }
-
     /*
      * If link is down and auto-negotiation is supported and ongoing,
      * complete auto-negotiation immediately. This allows us to look
@@ -1423,7 +1418,8 @@ static int e1000_post_load(void *opaque, int version_id)
         s->mit_irq_level = false;
     }
     s->mit_ide = 0;
-    s->mit_timer_on = false;
+    s->mit_timer_on = true;
+    timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1);
 
     /* nc.link_down can't be migrated, so infer link_down according
      * to link status bit in mac_reg[STATUS].