All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] rtc: Prevent hctosys from using invalid RTC time
@ 2026-10-21  4:24 Akashdeep Kaur
  2026-10-21  4:24 ` [PATCH 1/2] rtc: Add flag for dynamic hctosys control Akashdeep Kaur
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Akashdeep Kaur @ 2026-10-21  4:24 UTC (permalink / raw)
  To: praneeth, nm, vigneshr, alexandre.belloni, linux-rtc,
	linux-kernel, sebin.francis
  Cc: s-tripathi1, vishalm, k-willis, a-kaur

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-21  7:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21  4:24 [PATCH 0/2] rtc: Prevent hctosys from using invalid RTC time Akashdeep Kaur
2026-10-21  4:24 ` [PATCH 1/2] rtc: Add flag for dynamic hctosys control Akashdeep Kaur
2026-10-21  4:37   ` sashiko-bot
2026-10-21  5:25     ` Akashdeep Kaur
2026-10-21  4:24 ` [PATCH 2/2] rtc: ti-k3: Mark RTC time as invalid without battery backup Akashdeep Kaur
2026-10-21  4:37   ` sashiko-bot
2026-10-21  7:13 ` [PATCH 0/2] rtc: Prevent hctosys from using invalid RTC time Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.