rtc: Prevent hctosys from using invalid RTC time
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | rtc: Add flag for dynamic hctosys controldrivers/ include/ | +22 | 1 reply | |
| 2/2 | rtc: ti-k3: Mark RTC time as invalid without battery backupdrivers/ | +7 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] rtc: Prevent hctosys from using invalid RTC time
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
Signature · 1 line
2.34.1