Skip to content

Commit

Permalink
pl031: Update last RTCLR value on write in case it's read back
Browse files Browse the repository at this point in the history
The PL031 allows you to read RTCLR, which is meant to give you the last
value written. PL031State has an lr field which is used when reading
from RTCLR, and is present in the VM migration state, but we never
actually update it, so it always reads as its initial 0 value.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20240222000341.1562443-1-jrtc27@jrtc27.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 4d28d57)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
jrtc27 authored and Michael Tokarev committed Feb 27, 2024
1 parent e4e36e6 commit a0fb839
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hw/rtc/pl031.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ static void pl031_write(void * opaque, hwaddr offset,
g_autofree const char *qom_path = object_get_canonical_path(opaque);
struct tm tm;

s->lr = value;
s->tick_offset += value - pl031_get_count(s);

qemu_get_timedate(&tm, s->tick_offset);
Expand Down

0 comments on commit a0fb839

Please sign in to comment.