]> git.proxmox.com Git - mirror_qemu.git/commit
spapr: clock should count only if vm is running
authorLaurent Vivier <lvivier@redhat.com>
Fri, 27 Jan 2017 12:24:58 +0000 (13:24 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 30 Jan 2017 23:10:14 +0000 (10:10 +1100)
commit42043e4f1241eeb77f87f5816b5cf0b6e9583ed7
treeca574eb35c72dc637bfbf4d47d3d7bd3ea2f0159
parentd9d6e78ea82b16a44fca0adf642ca5d5dad429d0
spapr: clock should count only if vm is running

This is a port to ppc of the i386 commit:
    00f4d64 kvmclock: clock should count only if vm is running

We remove timebase_post_load function, and use the VM state
change handler to save and restore the guest_timebase (on stop
and continue).

We keep timebase_pre_save to reduce the clock difference on
migration like in:
    6053a86 kvmclock: reduce kvmclock difference on migration

Time base offset has originally been introduced by commit
    98a8b52 spapr: Add support for time base offset migration

So while VM is paused, the time is stopped. This allows to have
the same result with date (based on Time Base Register) and
hwclock (based on "get-time-of-day" RTAS call).

Moreover in TCG mode, the Time Base is always paused, so this
patch also adjust the behavior between TCG and KVM.

VM state field "time_of_the_day_ns" is now useless but we keep
it to be able to migrate to older version of the machine.

As vmstate_ppc_timebase structure (with timebase_pre_save() and
timebase_post_load() functions) was only used by vmstate_spapr,
we register the VM state change handler only in ppc_spapr_init().

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/ppc.c
hw/ppc/spapr.c
target/ppc/cpu-qom.h