* [PATCH] pl031: Update last RTCLR value on write in case it's read back
@ 2024-02-22 0:03 Jessica Clarke
2024-02-22 10:10 ` Alex Bennée
2024-02-22 16:22 ` Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Jessica Clarke @ 2024-02-22 0:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Jessica Clarke, qemu-arm, Peter Maydell
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.
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
---
hw/rtc/pl031.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c
index 837b0bdf9b..563bb4b446 100644
--- a/hw/rtc/pl031.c
+++ b/hw/rtc/pl031.c
@@ -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);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pl031: Update last RTCLR value on write in case it's read back
2024-02-22 0:03 [PATCH] pl031: Update last RTCLR value on write in case it's read back Jessica Clarke
@ 2024-02-22 10:10 ` Alex Bennée
2024-02-22 16:22 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2024-02-22 10:10 UTC (permalink / raw)
To: Jessica Clarke; +Cc: qemu-devel, qemu-arm, Peter Maydell
Jessica Clarke <jrtc27@jrtc27.com> writes:
> 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.
>
> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pl031: Update last RTCLR value on write in case it's read back
2024-02-22 0:03 [PATCH] pl031: Update last RTCLR value on write in case it's read back Jessica Clarke
2024-02-22 10:10 ` Alex Bennée
@ 2024-02-22 16:22 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2024-02-22 16:22 UTC (permalink / raw)
To: Jessica Clarke; +Cc: qemu-devel, qemu-arm
On Thu, 22 Feb 2024 at 00:04, Jessica Clarke <jrtc27@jrtc27.com> wrote:
>
> 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.
>
> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
> ---
Thanks for the patch -- looks like this bug has been present since
the first version of the pl031 emulation was added back in 2007...
Applied to target-arm.next.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-22 16:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-22 0:03 [PATCH] pl031: Update last RTCLR value on write in case it's read back Jessica Clarke
2024-02-22 10:10 ` Alex Bennée
2024-02-22 16:22 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).