aboutsummaryrefslogtreecommitdiff
path: root/hw/i8254_common.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2012-03-02 20:28:47 +0100
committerAvi Kivity <avi@redhat.com>2012-03-07 12:27:41 +0200
commit3fbc1c0c1309a6cc2a0699fbf5e286d32250a0be (patch)
treeee9d258fe42de8410774ff2ea556e06ecdf0f24c /hw/i8254_common.c
parentd11e859e4afe9b8b12f4478ab4ae3204d2d665ce (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_common.c')
-rw-r--r--hw/i8254_common.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/i8254_common.c b/hw/i8254_common.c
index 6373e878fe..a03d7cd458 100644
--- a/hw/i8254_common.c
+++ b/hw/i8254_common.c
@@ -211,6 +211,7 @@ static const VMStateDescription vmstate_pit_channel = {
static int pit_load_old(QEMUFile *f, void *opaque, int version_id)
{
PITCommonState *pit = opaque;
+ PITCommonClass *c = PIT_COMMON_GET_CLASS(pit);
PITChannelState *s;
int i;
@@ -234,11 +235,13 @@ static int pit_load_old(QEMUFile *f, void *opaque, int version_id)
qemu_get_8s(f, &s->gate);
s->count_load_time = qemu_get_be64(f);
s->irq_disabled = 0;
- if (s->irq_timer) {
+ if (i == 0) {
s->next_transition_time = qemu_get_be64(f);
- qemu_get_timer(f, s->irq_timer);
}
}
+ if (c->post_load) {
+ c->post_load(pit);
+ }
return 0;
}
@@ -275,7 +278,8 @@ static const VMStateDescription vmstate_pit_common = {
VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
vmstate_pit_channel, PITChannelState),
- VMSTATE_TIMER(channels[0].irq_timer, PITCommonState),
+ VMSTATE_INT64(channels[0].next_transition_time,
+ PITCommonState), /* formerly irq_timer */
VMSTATE_END_OF_LIST()
}
};