09 May, 2019

1 commit


18 Mar, 2019

1 commit


27 Mar, 2018

1 commit


31 Oct, 2017

1 commit

  • ntp is currently hardwired to try and call the rtc set when wall clock
    tv_nsec is 0.5 seconds. This historical behaviour works well with certain
    PC RTCs, but is not universal to all rtc hardware.

    Change how this works by introducing the driver specific concept of
    set_offset_nsec, the delay between current wall clock time and the target
    time to set (with a 0 tv_nsecs).

    For x86-style CMOS set_offset_nsec should be -0.5 s which causes the last
    second to be written 0.5 s after it has started.

    For compat with the old rtc_set_ntp_time, the value is defaulted to
    + 0.5 s, which causes the next second to be written 0.5s before it starts,
    as things were before this patch.

    Testing shows many non-x86 RTCs would like set_offset_nsec ~= 0,
    so ultimately each RTC driver should set the set_offset_nsec according
    to its needs, and non x86 architectures should stop using
    update_persistent_clock64 in order to access this feature.
    Future patches will revise the drivers as needed.

    Since CMOS and RTC now have very different handling they are split
    into two dedicated code paths, sharing the support code, and ifdefs
    are replaced with IS_ENABLED.

    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Miroslav Lichvar
    Cc: Richard Cochran
    Cc: Prarit Bhargava
    Cc: Stephen Boyd
    Signed-off-by: Jason Gunthorpe
    Signed-off-by: John Stultz

    Jason Gunthorpe
     

25 Jun, 2015

1 commit

  • Currently, CONFIG_RTC_SYSTOHC uses CONFIG_RTC_HCTOSYS_DEVICE which
    is originally used by CONFIG_RTC_HCTOSYS, but this rtc device has
    some limiations, for example, it must be battery-backed, be able
    to work with irq off and through system suspension, etc.

    So add CONFIG_RTC_SYSTOHC_DEVICE used exclusively for CONFIG_RTC_SYSTOHC,
    it is more lenient compared to CONFIG_RTC_HCTOSYS_DEVICE, and could
    be assigned any available RTC in the system.

    Default value is CONFIG_RTC_HCTOSYS_DEVICE which is "rtc0" by default.
    After this patch, NTP will sync up "rtc0" by default.

    Cc: Paul Bolle
    Signed-off-by: Xunlei Pang
    Signed-off-by: Alexandre Belloni

    Xunlei Pang
     

03 Apr, 2015

2 commits

  • Currently the rtc_class_op's set_mmss() function takes a 32-bit
    second value (on 32-bit systems), which is problematic for dates
    past y2038.

    This patch provides a safe version named set_mmss64() using
    y2038 safe time64_t.

    After this patch, set_mmss() is deprecated and all its users
    will be fixed to use set_mmss64(), it can be removed when having
    no users.

    Signed-off-by: Xunlei Pang
    [jstultz: Add whitespace fix for checkpatch]
    Signed-off-by: John Stultz
    Acked-by: Alessandro Zummo
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1427945681-29972-8-git-send-email-john.stultz@linaro.org
    Signed-off-by: Ingo Molnar

    Xunlei Pang
     
  • As part of addressing in-kernel y2038 issues, this patch adds
    update_persistent_clock64() and replaces all the call sites of
    update_persistent_clock() with this function. This is a __weak
    implementation, which simply calls the existing y2038 unsafe
    update_persistent_clock().

    This allows architecture specific implementations to be
    converted independently, and eventually y2038-unsafe
    update_persistent_clock() can be removed after all its
    architecture specific implementations have been converted to
    update_persistent_clock64().

    Suggested-by: Arnd Bergmann
    Signed-off-by: Xunlei Pang
    Signed-off-by: John Stultz
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1427945681-29972-4-git-send-email-john.stultz@linaro.org
    Signed-off-by: Ingo Molnar

    Xunlei Pang
     

24 Jan, 2015

1 commit

  • rtc_set_ntp_time() uses timespec which is y2038-unsafe,
    so modify to use timespec64 which is y2038-safe, then
    replace rtc_time_to_tm() with rtc_time64_to_tm().

    Also adjust all its call sites(only NTP uses it) accordingly.

    Cc: pang.xunlei
    Cc: Arnd Bergmann
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Signed-off-by: Xunlei Pang
    Signed-off-by: John Stultz

    Xunlei Pang
     

16 Jan, 2013

1 commit

  • The purpose of this option is to allow ARM/etc systems that rely on the
    class RTC subsystem to have the same kind of automatic NTP based
    synchronization that we have on PC platforms. Today ARM does not
    implement update_persistent_clock and makes extensive use of the class
    RTC system.

    When enabled CONFIG_RTC_SYSTOHC will provide a generic
    rtc_update_persistent_clock that stores the current time in the RTC and
    is intended complement the existing CONFIG_RTC_HCTOSYS option that loads
    the RTC at boot.

    Like with RTC_HCTOSYS the platform's update_persistent_clock is used
    first, if it works. Platforms with mixed class RTC and non-RTC drivers
    need to return ENODEV when class RTC should be used. Such an update for
    PPC is included in this patch.

    Long term, implementations of update_persistent_clock should migrate to
    proper class RTC drivers and use CONFIG_RTC_SYSTOHC instead.

    Tested on ARM kirkwood and PPC405

    Signed-off-by: Jason Gunthorpe
    Signed-off-by: John Stultz

    Jason Gunthorpe