From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Cédric Le Goater" <clg@kaod.org>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Joel Stanley" <joel@jms.id.au>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>
Subject: [PATCH for-8.2 3/4] hw/rtc/aspeed_rtc: Use 64-bit offset for holding time_t difference
Date: Thu, 20 Jul 2023 16:59:01 +0100 [thread overview]
Message-ID: <20230720155902.1590362-4-peter.maydell@linaro.org> (raw)
In-Reply-To: <20230720155902.1590362-1-peter.maydell@linaro.org>
In the aspeed_rtc device we store a difference between two time_t
values in an 'int'. This is not really correct when time_t could
be 64 bits. Enlarge the field to 'int64_t'.
This is a migration compatibility break for the aspeed boards.
While we are changing the vmstate, remove the accidental
duplicate of the offset field.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I took "bump the migration version" as the simplest approach
here, because I don't think we care about migration compat
in this case. If we do I can write the alternate version of
the patch...
---
include/hw/rtc/aspeed_rtc.h | 2 +-
hw/rtc/aspeed_rtc.c | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/hw/rtc/aspeed_rtc.h b/include/hw/rtc/aspeed_rtc.h
index df61e46059e..596dfebb46c 100644
--- a/include/hw/rtc/aspeed_rtc.h
+++ b/include/hw/rtc/aspeed_rtc.h
@@ -18,7 +18,7 @@ struct AspeedRtcState {
qemu_irq irq;
uint32_t reg[0x18];
- int offset;
+ int64_t offset;
};
diff --git a/hw/rtc/aspeed_rtc.c b/hw/rtc/aspeed_rtc.c
index f6da7b666d6..fa861e2d494 100644
--- a/hw/rtc/aspeed_rtc.c
+++ b/hw/rtc/aspeed_rtc.c
@@ -136,11 +136,10 @@ static const MemoryRegionOps aspeed_rtc_ops = {
static const VMStateDescription vmstate_aspeed_rtc = {
.name = TYPE_ASPEED_RTC,
- .version_id = 1,
+ .version_id = 2,
.fields = (VMStateField[]) {
VMSTATE_UINT32_ARRAY(reg, AspeedRtcState, 0x18),
- VMSTATE_INT32(offset, AspeedRtcState),
- VMSTATE_INT32(offset, AspeedRtcState),
+ VMSTATE_INT64(offset, AspeedRtcState),
VMSTATE_END_OF_LIST()
}
};
--
2.34.1
next prev parent reply other threads:[~2023-07-20 16:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 15:58 [PATCH for-8.2 0/4] rtc devices: Avoid putting time_t in 32-bit variables Peter Maydell
2023-07-20 15:58 ` [PATCH for-8.2 1/4] hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm() Peter Maydell
2023-07-21 9:03 ` Philippe Mathieu-Daudé
2023-07-21 9:09 ` Philippe Mathieu-Daudé
2023-07-21 9:42 ` Peter Maydell
2023-07-20 15:59 ` [PATCH for-8.2 2/4] hw/rtc/twl92230: Use int64_t for sec_offset and alm_sec Peter Maydell
2023-07-21 9:09 ` Philippe Mathieu-Daudé
2023-07-20 15:59 ` Peter Maydell [this message]
2023-07-20 16:42 ` [PATCH for-8.2 3/4] hw/rtc/aspeed_rtc: Use 64-bit offset for holding time_t difference Cédric Le Goater
2023-07-20 16:45 ` Peter Maydell
2023-07-20 16:58 ` Cédric Le Goater
2023-07-20 15:59 ` [PATCH for-8.2 4/4] rtc: Use time_t for passing and returning time offsets Peter Maydell
2023-07-21 9:18 ` Philippe Mathieu-Daudé
2023-07-21 9:03 ` [PATCH for-8.2 0/4] rtc devices: Avoid putting time_t in 32-bit variables Philippe Mathieu-Daudé
2023-07-21 9:45 ` Peter Maydell
2023-07-24 5:15 ` Markus Armbruster
2023-07-21 9:16 ` Philippe Mathieu-Daudé
2023-07-21 9:46 ` Peter Maydell
2023-07-24 14:01 ` Philippe Mathieu-Daudé
2023-08-29 15:50 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230720155902.1590362-4-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=hpoussin@reactos.org \
--cc=joel@jms.id.au \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).