From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Jinke Fan <fanjinke@hygon.cn>
Cc: a.zummo@towertech.it, puwen@hygon.cn, thomas.lendacky@amd.com,
kim.phillips@amd.com, linux-rtc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH RFC] rtc: Fix the AltCentury value on AMD/Hygon platform
Date: Thu, 3 Oct 2019 22:01:27 +0200 [thread overview]
Message-ID: <20191003200127.GM575@piout.net> (raw)
In-Reply-To: <20190924024108.51286-1-fanjinke@hygon.cn>
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@hygon.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
next prev parent reply other threads:[~2019-10-03 20:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 2:41 [RESEND PATCH RFC] rtc: Fix the AltCentury value on AMD/Hygon platform Jinke Fan
2019-10-03 20:01 ` Alexandre Belloni [this message]
2019-10-08 9:20 ` Jinke Fan
2019-10-08 9:24 ` Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191003200127.GM575@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=fanjinke@hygon.cn \
--cc=kim.phillips@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=puwen@hygon.cn \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).