[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-4.22 1/5] x86/time: use RTC century byte when available
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Wed, 13 May 2026 16:51:30 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1PnMIYYDrjMoksVc8qk88Z6j3Av6oz9ZuhJER4OfKts=; b=xbTkgq1rI4ie2budUJf7DOfyyFE//E28LA8JZPpmJTp6PamD8rEh+zECOVR8n6J2J86pUjHJYTeoPqjktenZIBcAgVWr5S4a+fNI3TeiZDe9rhUuZiRKHoT5p7HiiB1q7awDVgQxoyp8EDqmhQiykMBzGnFjGCQw4PNbkJ+f4rEfd19FFZj/pBZeFPbyxVuQGxVh0ut/hYMgpr/wNPx2wwN0Eh8CAUuRuhJrtumJcxmt+JUWTShwGk/shqNOQ260QSzmuMkYOQEIfWljoE60CLSkdoCc9yextsouO1G4MT3WrSYa0sQyoXQZuTZY1odWrfij6dI5t/2cMsoXlayEww==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wZjWxCQUxkBMZorLwJZzw/oEGqnZFrQ9FgxFoylVOD+8SMOMMFO1mNHFFB/QihSqn9stU878KD8aeKyRG0OGT3OILwy4FUkwepVGVwpsntTk/3WmGrzEkcefv2T8tx8Ftnx/Sv/XwtFl87Zsa7ZAVu3AONb/z0NAQRfakNKVGAB4GKHmju9SRvADtKr/pYyPEetCkXX165ZbTapQPbW9TB3abt8Ocf0+pL0FxwxmlX7/Ri3FoWcy7u65WlkzuroeQFhnoKrz1tOc8I0DmDVTPq0O6pOWBT+BKtqSMSfNSiQEtMvjPYjPHy+0KycxfXp/mQFHNJRBdoMhLBrx/BOOVQ==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
- Delivery-date: Wed, 13 May 2026 14:51:51 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, May 13, 2026 at 12:36:26PM +0200, Jan Beulich wrote:
> On 13.05.2026 10:49, Roger Pau Monné wrote:
> > On Tue, May 12, 2026 at 04:58:43PM +0200, Jan Beulich wrote:
> >> @@ -1280,6 +1281,8 @@ static bool __get_cmos_time(struct rtc_t
> >> 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_t
> >>
> >> spin_unlock_irqrestore(&rtc_lock, flags);
> >>
> >> - if ( (rtc->year += 1900) < 1970 )
> >> + if ( century )
> >> + {
> >> + BCD_TO_BIN(century);
> >
> > Don't you need to move the BCD_TO_BIN() translation with the rest, so
> > it's not done unconditionally?
>
> No, the century field is always BCD.
Hm, then I guess Linux needs adjusting, as mc146818_set_time() only
converts the century to the BCD format conditionally on the control
register or RTC_ALWAYS_BCD.
I've found several sources only that as you mention also claim the
century value is unconditionally in BCD format.
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Thanks, Roger.
|