On Thu, Jan 24, 2013 at 11:37:30AM +0800, Feng Tang wrote: > > I think hard numbers would be needed to show the rtc layer is > > causing major issues for space constrained kernels, so this > > trade-off could be properly prioritized. Having duplicate code paths > > in standard kernels is wasteful as well.
> Another thing is currently the CONFIG_RTC_XXX is selectable option for > kernel, if we push the read_persistent_clock() from kernel code down to > rtc driver layer, then some of the CONFIG_RTC_XXX have to be always 'y' All my space constrained embedded kernels (ARM, PPC) already need CONFIG_RTC.. Configurations that can still access the RTC without CONFIG_RTC seem to be very limited, the notable one is x86 - and I don't think 14k is going to be a problem for any modern embedded x86 systems. CONFIG_RTC_xx doesn't have to be forced to yes, it is like any other driver, if you don't have/load a RTC driver then you don't get a RTC, *shrug* > > >IIRC, some EFI backed x86 system's read_persistent_clock() is > > >implemented by EFI's runtime gettime service. > > Interesting, does the rtc driver not support this? > > x86's read_persistent_clock() is actually implemented with > retval = x86_platform.get_wallclock() > > And for x86_32 platform, the efi.c has code to set > x86_platform.get_wallclock() > to efi_get_time() which is efi's runtime service. > > I don't know the detail how it works, but I think it could co-exist with a > rtc driver if there is. Like the CMOS path, it completely duplicates the code in the EFI RTC driver, so it should co-exist. The locking seems to be handled by the EFI stuff: unsigned long efi_get_time(void) { efi_status_t status; efi_time_t eft; efi_time_cap_t cap; status = efi.get_time(&eft, &cap); if (status != EFI_SUCCESS) pr_err("Oops: efitime: can't read time!\n"); return mktime(eft.year, eft.month, eft.day, eft.hour, eft.minute, eft.second); } vs: static int efi_read_time(struct device *dev, struct rtc_time *tm) { efi_status_t status; efi_time_t eft; efi_time_cap_t cap; status = efi.get_time(&eft, &cap); if (status != EFI_SUCCESS) { /* should never happen */ printk(KERN_ERR "efitime: can't read time\n"); return -EINVAL; } convert_from_efi_time(&eft, tm); return rtc_valid_tm(tm); } Jason -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/