Re: [RFC][PATCH]x86/RTC: introduce a new generic rtc_ops for x86

From: Feng Tang
Date: Wed Aug 12 2009 - 01:43:22 EST


On Tue, 11 Aug 2009 16:45:29 +0800
Ingo Molnar <mingo@xxxxxxx> wrote:
> > -#include <asm/mc146818rtc.h>
> > -#ifdef CONFIG_X86_32
> > -#include <linux/efi.h>
> > +struct arch_rtc_dev_ops {
> > + unsigned long (*get_wall_time)(void);
> > + int (*set_wall_time)(unsigned long);
> > +};
> > +extern struct arch_rtc_dev_ops *x86_rtc_ops;
>
> looks like the right direction at first glance. What's the
> management interface around the driver (there's none at the moment)?
> Set up at early boot time and never changed afterwards?
Currently there is no management interface around it, the structure works
the way like x86_quirks, as EFI/mc146818 are kindly fixed and can't be
dynamically detected.

>
> Have you looked at other architectures (MIPS, ARM, etc.) to see how
> they abstracted away their RTC functionality?
I did a quick look at other architectures, and didn't see a nice abstracted
way for RTC.

In kernel early boot phase, read_persistent_clock() is called to get the HW
time, x86 implements the API by calling get_wall_time(), but just a few other
architectures implement their own read_persistent_clock() if they have rtc
devices/services that could be accessed in early boot phase, like some of
MIPS/PowerPC/s390...(ARM doesn't). So it would be difficult to ask all
architectures to use the arch_rtc_dev_ops structure.

But as kernel needs the HW time anyway, some arch/platforms implements
their rtc driver in drivers/rtc/ not in arch/.../kernel/, which will get HW
time and set it to the system time in late boot phase using late_initcall

Thanks,
Feng
>
> Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/