Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hw/rtc/aspeed_rtc: Use 64-bit offset for holding time_t difference
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>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
  • Loading branch information
pm215 committed Aug 31, 2023
1 parent 279695a commit c0a6385
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions hw/rtc/aspeed_rtc.c
Expand Up @@ -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()
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/hw/rtc/aspeed_rtc.h
Expand Up @@ -18,7 +18,7 @@ struct AspeedRtcState {
qemu_irq irq;

uint32_t reg[0x18];
int offset;
int64_t offset;

};

Expand Down

0 comments on commit c0a6385

Please sign in to comment.