[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191003200127.GM575@piout.net>
Date: Thu, 3 Oct 2019 22:01:27 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Jinke Fan <fanjinke@...on.cn>
Cc: a.zummo@...ertech.it, puwen@...on.cn, thomas.lendacky@....com,
kim.phillips@....com, linux-rtc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH RFC] rtc: Fix the AltCentury value on AMD/Hygon
platform
On 24/09/2019 10:41:08+0800, Jinke Fan wrote:
> When using following operations:
> date -s "21190910 19:20:00"
> hwclock -w
> to change date from 2019 to 2119 for test, it will fail on Hygon
> Dhyana and AMD Zen CPUs, while the same operations run ok on Intel i7
> platform.
>
> MC146818 driver use function mc146818_set_time() to set register
> RTC_FREQ_SELECT(RTC_REG_A)'s bit4-bit6 field which means divider stage
> reset value on Intel platform to 0x7.
>
> While AMD/Hygon RTC_REG_A(0Ah)'s bit4 is defined as DV0 [Reference]:
> DV0 = 0 selects Bank 0, DV0 = 1 selects Bank 1. Bit5-bit6 is defined
> as reserved.
>
> DV0 is set to 1, it will select Bank 1, which will disable AltCentury
> register(0x32) access. As UEFI pass acpi_gbl_FADT.century 0x32
> (AltCentury), the CMOS write will be failed on code:
> CMOS_WRITE(century, acpi_gbl_FADT.century).
>
> Correct RTC_REG_A bank select bit(DV0) to 0 on AMD/Hygon CPUs, it will
> enable AltCentury(0x32) register writing and finally setup century as
> expected.
>
> Test results on AMD/Hygon machine show that it works as expected.
>
> Reference:
> https://www.amd.com/system/files/TechDocs/51192_Bolton_FCH_RRG.pdf
> section: 3.13 Real Time Clock (RTC)
>
> Signed-off-by: Jinke Fan <fanjinke@...on.cn>
> ---
> drivers/rtc/rtc-mc146818-lib.c | 9 +++++++--
> include/linux/mc146818rtc.h | 2 ++
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
Applied, thanks.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists