|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/time: use RTC century byte when available
commit 7cf331d913109dd1634ba2571bd080a6e5cbdeda
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon May 18 08:59:02 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon May 18 08:59:02 2026 +0200
x86/time: use RTC century byte when available
Without this the present logic will misbehave from 2070 onwards.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
xen/arch/x86/time.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 98e8ef19e4..6582235dcc 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1257,6 +1257,7 @@ struct rtc_time {
static bool __get_cmos_time(struct rtc_time *rtc)
{
s_time_t start, t1, t2;
+ unsigned int century = 0;
unsigned long flags;
spin_lock_irqsave(&rtc_lock, flags);
@@ -1280,6 +1281,8 @@ static bool __get_cmos_time(struct rtc_time *rtc)
rtc->day = CMOS_READ(RTC_DAY_OF_MONTH);
rtc->mon = CMOS_READ(RTC_MONTH);
rtc->year = CMOS_READ(RTC_YEAR);
+ if ( acpi_gbl_FADT.century && acpi_gbl_FADT.century < 0x80 )
+ century = CMOS_READ(acpi_gbl_FADT.century);
if ( RTC_ALWAYS_BCD || !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) )
{
@@ -1293,7 +1296,12 @@ static bool __get_cmos_time(struct rtc_time *rtc)
spin_unlock_irqrestore(&rtc_lock, flags);
- if ( (rtc->year += 1900) < 1970 )
+ if ( century )
+ {
+ BCD_TO_BIN(century);
+ rtc->year += century * 100;
+ }
+ else if ( (rtc->year += 1900) < 1970 )
rtc->year += 100;
return t1 <= SECONDS(1) && t2 < MILLISECS(3);
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |