x86/vRTC: support century field

Both ROMBIOS and SeaBIOS (with CONFIG_QEMU=y, as we build it) blindly
assume availability of this field (at its conventional index 0x32); OVMF
at least has code to inspect FADT. Hence we ought to have supported it
virtually forever.

As the index is beyond RTC_CMOS_SIZE, leverage the padding field in
struct hvm_hw_rtc to hold its value. Update the field only when involved
values are valid BCD century specifiers. Otherwise (for VMs migrated in
from an older hypervisor) leave handling to the DM.

This makes the Linux rtc-cmos driver report y3k compatibility.

In the new rtc_check(), besides checking the new fields also check the
pre-existing pad0 field.

While extending xen-hvmctx.c:dump_rtc() also add RTC offset there.

Fixes: 4ca1612143 ("[HVM] Move RTC emulation into the hypervisor")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger@xenproject.org>
This commit is contained in:
Jan Beulich committed 2026-09-02 15:14:08 +02:00
1 parent dc2382d1a5
commit f2ff80877f
6 files changed
+91 -10

No files matched your search

+5 -1
View File
@@ -33,6 +33,8 @@ struct acpi_20_facs Facs = {
#define ACPI_PM_TMR_BLK_BIT_WIDTH 0x20
#define ACPI_PM_TMR_BLK_BIT_OFFSET 0x00
#define CMOS_CENTURY 0x32 /* Conventional index used also without ACPI */
struct acpi_fadt Fadt = {
.header = {
.signature = ACPI_FADT_SIGNATURE,
@@ -88,7 +90,9 @@ struct acpi_fadt Fadt = {
.register_bit_width = ACPI_PM_TMR_BLK_BIT_WIDTH,
.register_bit_offset = ACPI_PM_TMR_BLK_BIT_OFFSET,
.address = ACPI_PM_TMR_BLK_ADDRESS_V1,
}
},
.century = CMOS_CENTURY,
};
struct acpi_20_rsdt Rsdt = {
+1 -1
View File
@@ -311,7 +311,7 @@ static void dump_rtc(void)
printf(" 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x, index 0x%02x\n",
r.cmos_data[8], r.cmos_data[9], r.cmos_data[10], r.cmos_data[11],
r.cmos_data[12], r.cmos_data[13], r.cmos_index);
printf(" century 0x%02x offset %"PRId64"\n", r.century, r.rtc_offset);
}
static void dump_hpet(void)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.