[PATCH 0/2] rtc: Prevent hctosys from using invalid RTC time
From: Akashdeep Kaur
Date: Wed Oct 21 2026 - 00:25:35 EST
The kernel's boot-time RTC synchronization blindly trusts the RTC
value when setting system time, but RTCs may have invalid time
depending on the boot path:
- On first cold boot: RTC may have lost power, time is invalid
- After low-power mode (RTC-only) cold boot: RTC retained power, time
is valid
On normal cold boot where bootloader or NTP has already established
correct time, boot-time sync (triggered when RTC driver loads as
module or probes at boot) can overwrite it with invalid RTC data,
causing time rollback to 1970. However, on boot from RTC-only power
mode, the RTC has valid time and boot-time sync should work to
restore system time from RTC.
This series adds a flag that drivers set dynamically per-boot to
indicate whether RTC has valid time. Drivers check at probe if RTC
retained power through this specific boot. Boot-time sync checks this
flag before setting system time. This enables correct behavior for
both boot paths while keeping PM suspend/resume compensation
unaffected.
---
Akashdeep Kaur (2):
rtc: Add flag for dynamic hctosys control
rtc: ti-k3: Mark RTC time as invalid without battery backup
drivers/rtc/class.c | 15 +++++++++++++++
drivers/rtc/rtc-ti-k3.c | 7 +++++++
include/linux/rtc.h | 7 +++++++
3 files changed, 29 insertions(+)
base-commit: 8f7df005a7564bd7ffa75da9c3085d5b996f1e16
--
2.34.1