[systemd-devel] Support machines with multiple RTCs?

Koen Kooi koen at dominion.thruhere.net
Tue Nov 22 12:18:02 PST 2011


Op 22 nov. 2011, om 18:28 heeft Kay Sievers het volgende geschreven:

> On Tue, Nov 22, 2011 at 18:10, Martin Langhoff
> <martin.langhoff at gmail.com> wrote:
>> I have just been perusing the systemd code, and wondering whether it
>> supports systems that have two RTCs (where usually only one of them is
>> the battery-backed clock, the other isn't battery backed but can wake
>> the system up).
>> 
>> Background: OLPC's new laptop, XO-1.75, is an ARM SoC that has exactly
>> that configuration. Linux kernels from 2.6.32 (and maybe earlier) can
>> handle multiple RTCs, and let you configure which one to use to sync
>> the clock in early boot (so userland doesn't have to).
>> 
>> I have just reported a related bug in Fedora's initscripts (
>> https://bugzilla.redhat.com/show_bug.cgi?id=756089 ), and a quick
>> check of systemd sources hints at similar trouble here...
>> 
>> Two key things seem to be missing:
>> 
>>  #1 -- check for the hctosys property. If _any_ rtc present in the
>> system has sysfs attribute hctosys == 1, it means that the kernel took
>> care of it all, and userland doesn't need to call hwclock, at all.
> 
> Systemd requires that the time was set by the kernel. It does not
> support any other config natively, that would be done by plugging-in
> hwclock like it was on non-systemd systems.
> 
> The kernel's hctosys is hard coded in the kernel config, right?
> 
>>  #2 -- is customary to prefer /dev/rtc if present -- so that we can
>> symlink to the right rtc from udev. src/util.c seems to hardcode rtc0.
> 
> Udev does that by default today:
>  SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc"

That looks to be specific to x86 RTCs, in my case when using the RTC of the PMIC on omap3/4 I get:

  looking at device '/devices/platform/omap/omap_i2c.1/i2c-1/1-004b/twl_rtc/rtc/rtc0':
    KERNEL=="rtc0"
    SUBSYSTEM=="rtc"
    DRIVER==""
    ATTR{name}=="twl_rtc"
    ATTR{date}=="2011-11-22"
    ATTR{time}=="20:17:03"
    ATTR{since_epoch}=="1321993023"
    ATTR{max_user_freq}=="64"
    ATTR{hctosys}=="1"
    ATTR{wakealarm}==""

regards,

Koen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20111122/12f22e6e/attachment.pgp>


More information about the systemd-devel mailing list