[SRU][F/raspi][PATCH] rtc: class: support hctosys from modular RTC drivers

Juerg Haefliger juerg.haefliger at canonical.com
Wed May 5 07:10:49 UTC 2021


On Tue, 4 May 2021 18:42:41 +0100
Dimitri John Ledkov <dimitri.ledkov at canonical.com> wrote:

> On Tue, May 4, 2021 at 6:39 PM Krzysztof Kozlowski
> <krzysztof.kozlowski at canonical.com> wrote:
> >
> > On 04/05/2021 13:22, Dimitri John Ledkov wrote:  
> > > Hi,
> > >
> > > This will introduce a regression in certain configurations as
> > > mentioned on https://github.com/systemd/systemd/issues/17737
> > >
> > > I had a tentative patch to kernel to only advance time in rtc_hctosys
> > > only if it is newer than the one returned by ktime_get_real_ts64.  
> >
> > That's the mainline commit, so change for it (e.g. do not set the system
> > clock for modules) should go via upstream.
> >  
> > > However that went nowhere.
> > >
> > > If this is cherry picked, imho we must change config
> > > CONFIG_RTC_HCTOSYS or at least set it to something sane because
> > > currently on raspi it is set to CONFIG_RTC_HCTOSYS_DEVICE="rtc0" which
> > > always points at the non-battery backed RTC from the SOC.  
> >
> > RPi does not have a RTC, so whoever adds it via overlay, probably
> > chooses one with a battery. Otherwise there is no much point of having
> > RTC...  
> 
> That. I just don't know which RTC are available as rpi-hats and which
> dtb overlay they use and which rtc name they end up with.

The first to load will get rtc0 and that's what the kernel will use ('rtc0' is
set as a CONFIG option).


> If the properly working & battery backed RTC is added via overlay dtb
> and it ends up having rtc0 name, everything is fine. I just don't know
> if the overlays remove all other rtc nodes and like take over the rtc0
> name.

You can have multiple RTCs. If someone chooses to do that (why?) then whichever
is probed first ends up being rtc0. I don't think we need to handle the case of
multiple RTCs and try to determine which one to use.


> @juerg do rpi RTCs with batteries end up having rtc0 kernel name?

The first to load. I don't believe the driver knows if an RTC is battery backed
or not.


> or
> do they end up with something else? Also we must include them into the
> initrd as modules for UC20 cause otherwise it would be odd if the
> clock jumps after pivot to root & after NTP got network time.

Yes. But the same is true for server, isn't it? Adding the module is a separate
step and not under the kernels control. The question is if we should/need to
include all RTCs currently supported by the Pi or just add them as needed.

....Juerg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20210505/c039e9ad/attachment.sig>


More information about the kernel-team mailing list