diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2012-03-02 20:28:47 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-07 12:27:41 +0200 |
commit | 3fbc1c0c1309a6cc2a0699fbf5e286d32250a0be (patch) | |
tree | ee9d258fe42de8410774ff2ea556e06ecdf0f24c /hw/i8254.c | |
parent | d11e859e4afe9b8b12f4478ab4ae3204d2d665ce (diff) |
i8254: Open-code timer restore
Same as for the APIC: To enable migration between accelerated and
non-accelerated models, we need to arm the channel 0 timer only inside
the emulated PIT model. The common code just saves/restores that timer
to the the next_transition_time field.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/i8254.c')
-rw-r--r-- | hw/i8254.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/i8254.c b/hw/i8254.c index 9fde3449b2..77bd5e8222 100644 --- a/hw/i8254.c +++ b/hw/i8254.c @@ -300,6 +300,17 @@ static const MemoryRegionOps pit_ioport_ops = { .old_portio = pit_portio }; +static void pit_post_load(PITCommonState *s) +{ + PITChannelState *sc = &s->channels[0]; + + if (sc->next_transition_time != -1) { + qemu_mod_timer(sc->irq_timer, sc->next_transition_time); + } else { + qemu_del_timer(sc->irq_timer); + } +} + static int pit_initfn(PITCommonState *pit) { PITChannelState *s; @@ -329,6 +340,7 @@ static void pit_class_initfn(ObjectClass *klass, void *data) k->init = pit_initfn; k->set_channel_gate = pit_set_channel_gate; k->get_channel_info = pit_get_channel_info_common; + k->post_load = pit_post_load; dc->reset = pit_reset; dc->props = pit_properties; } |