aboutsummaryrefslogtreecommitdiff
path: root/include/hw/timer
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-07-15 14:17:04 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-07-15 14:17:04 +0100
commit032cfe6a79c842a47cb8cc911c9961eb7ca51a98 (patch)
tree136e79cbb205528cabdadfc80788319358a7fbde /include/hw/timer
parent80734cbdcab6ddb8d45a75910e8f7e3841daca2c (diff)
downloadqemu-032cfe6a79c842a47cb8cc911c9961eb7ca51a98.zip
qemu-032cfe6a79c842a47cb8cc911c9961eb7ca51a98.tar.gz
qemu-032cfe6a79c842a47cb8cc911c9961eb7ca51a98.tar.bz2
pl031: Correctly migrate state when using -rtc clock=host
The PL031 RTC tracks the difference between the guest RTC and the host RTC using a tick_offset field. For migration, however, we currently always migrate the offset between the guest and the vm_clock, even if the RTC clock is not the same as the vm_clock; this was an attempt to retain migration backwards compatibility. Unfortunately this results in the RTC behaving oddly across a VM state save and restore -- since the VM clock stands still across save-then-restore, regardless of how much real world time has elapsed, the guest RTC ends up out of sync with the host RTC in the restored VM. Fix this by migrating the raw tick_offset. To retain migration compatibility as far as possible, we have a new property migrate-tick-offset; by default this is 'true' and we will migrate the true tick offset in a new subsection; if the incoming data has no subsection we fall back to the old vm_clock-based offset information, so old->new migration compatibility is preserved. For complete new->old migration compatibility, the property is set to 'false' for 4.0 and earlier machine types (this will only affect 'virt-4.0' and below, as none of the other pl031-using machines are versioned). Reported-by: Russell King <rmk@armlinux.org.uk> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 20190709143912.28905-1-peter.maydell@linaro.org
Diffstat (limited to 'include/hw/timer')
-rw-r--r--include/hw/timer/pl031.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/hw/timer/pl031.h b/include/hw/timer/pl031.h
index 8857c24..8c3f555 100644
--- a/include/hw/timer/pl031.h
+++ b/include/hw/timer/pl031.h
@@ -33,6 +33,8 @@ typedef struct PL031State {
*/
uint32_t tick_offset_vmstate;
uint32_t tick_offset;
+ bool tick_offset_migrated;
+ bool migrate_tick_offset;
uint32_t mr;
uint32_t lr;