This is a note to let you know that I've just added the patch titled rtc: mc146818: Dont test for bit 0-5 in Register D to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: rtc-mc146818-dont-test-for-bit-0-5-in-register-d.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 4ef1e2e1376fa1358435ab952fe3ad29ae1082a6 Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Date: Mon Feb 1 20:24:17 2021 +0100 rtc: mc146818: Dont test for bit 0-5 in Register D [ Upstream commit ebb22a05943666155e6da04407cc6e913974c78c ] The recent change to validate the RTC turned out to be overly tight. While it cures the problem on the reporters machine it breaks machines with Intel chipsets which use bit 0-5 of the D register. So check only for bit 6 being 0 which is the case on these Intel machines as well. Fixes: 211e5db19d15 ("rtc: mc146818: Detect and handle broken RTCs") Reported-by: Serge Belyshev <belyshev@xxxxxxxxxxxxxxxxx> Reported-by: Dirk Gouders <dirk@xxxxxxxxxxx> Reported-by: Borislav Petkov <bp@xxxxxxx> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Tested-by: Dirk Gouders <dirk@xxxxxxxxxxx> Tested-by: Len Brown <len.brown@xxxxxxxxx> Tested-by: Borislav Petkov <bp@xxxxxxx> Acked-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx> Link: https://lore.kernel.org/r/87zh0nbnha.fsf@xxxxxxxxxxxxxxxxxxxxxxx Stable-dep-of: cd17420ebea5 ("rtc: cmos: avoid UIP when writing alarm time") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index cce4b62ffdd0..8e8ce40f6440 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -808,8 +808,8 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) spin_lock_irq(&rtc_lock); - /* Ensure that the RTC is accessible. Bit 0-6 must be 0! */ - if ((CMOS_READ(RTC_VALID) & 0x7f) != 0) { + /* Ensure that the RTC is accessible. Bit 6 must be 0! */ + if ((CMOS_READ(RTC_VALID) & 0x40) != 0) { spin_unlock_irq(&rtc_lock); dev_warn(dev, "not accessible\n"); retval = -ENXIO; diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c index 7f01dc41271d..6ed2cd5d2bba 100644 --- a/drivers/rtc/rtc-mc146818-lib.c +++ b/drivers/rtc/rtc-mc146818-lib.c @@ -21,8 +21,8 @@ unsigned int mc146818_get_time(struct rtc_time *time) again: spin_lock_irqsave(&rtc_lock, flags); - /* Ensure that the RTC is accessible. Bit 0-6 must be 0! */ - if (WARN_ON_ONCE((CMOS_READ(RTC_VALID) & 0x7f) != 0)) { + /* Ensure that the RTC is accessible. Bit 6 must be 0! */ + if (WARN_ON_ONCE((CMOS_READ(RTC_VALID) & 0x40) != 0)) { spin_unlock_irqrestore(&rtc_lock, flags); memset(time, 0xff, sizeof(*time)); return 0;