diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2013-02-04 05:03:03 -0500 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2013-02-04 05:03:03 -0500 |
| commit | 90889a635a9b5488624bccce3ff6b2eec68c007b (patch) | |
| tree | 8ddde1e04060bd65ca2aafb09b38066cb7d69b4d | |
| parent | a9037430c6c784165a940a90bcd29f886834c8e7 (diff) | |
| parent | 6f16eebe1ff82176339a0439c98ebec9768b0ee2 (diff) | |
Merge branch 'fortglx/3.9/time' of git://git.linaro.org/people/jstultz/linux into timers/core
Trivial conflict in arch/x86/Kconfig
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| -rw-r--r-- | MAINTAINERS | 2 | ||||
| -rw-r--r-- | arch/powerpc/kernel/time.c | 2 | ||||
| -rw-r--r-- | arch/x86/Kconfig | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/tsc.c | 3 | ||||
| -rw-r--r-- | drivers/rtc/Kconfig | 12 | ||||
| -rw-r--r-- | drivers/rtc/Makefile | 1 | ||||
| -rw-r--r-- | drivers/rtc/class.c | 7 | ||||
| -rw-r--r-- | drivers/rtc/systohc.c | 44 | ||||
| -rw-r--r-- | fs/pstore/ram.c | 10 | ||||
| -rw-r--r-- | include/linux/rtc.h | 1 | ||||
| -rw-r--r-- | include/linux/time.h | 12 | ||||
| -rw-r--r-- | kernel/posix-timers.c | 2 | ||||
| -rw-r--r-- | kernel/time/Kconfig | 5 | ||||
| -rw-r--r-- | kernel/time/ntp.c | 16 | ||||
| -rw-r--r-- | kernel/time/timekeeping.c | 45 |
15 files changed, 141 insertions, 22 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 212c255b9347..f5bda78792d9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -6598,7 +6598,7 @@ F: drivers/dma/dw_dmac_regs.h | |||
| 6598 | F: drivers/dma/dw_dmac.c | 6598 | F: drivers/dma/dw_dmac.c |
| 6599 | 6599 | ||
| 6600 | TIMEKEEPING, NTP | 6600 | TIMEKEEPING, NTP |
| 6601 | M: John Stultz <johnstul@us.ibm.com> | 6601 | M: John Stultz <john.stultz@linaro.org> |
| 6602 | M: Thomas Gleixner <tglx@linutronix.de> | 6602 | M: Thomas Gleixner <tglx@linutronix.de> |
| 6603 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core | 6603 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core |
| 6604 | S: Supported | 6604 | S: Supported |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 127361e093f4..aaba2e05a417 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
| @@ -668,7 +668,7 @@ int update_persistent_clock(struct timespec now) | |||
| 668 | struct rtc_time tm; | 668 | struct rtc_time tm; |
| 669 | 669 | ||
| 670 | if (!ppc_md.set_rtc_time) | 670 | if (!ppc_md.set_rtc_time) |
| 671 | return 0; | 671 | return -ENODEV; |
| 672 | 672 | ||
| 673 | to_tm(now.tv_sec + 1 + timezone_offset, &tm); | 673 | to_tm(now.tv_sec + 1 + timezone_offset, &tm); |
| 674 | tm.tm_year -= 1900; | 674 | tm.tm_year -= 1900; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 225543bf45a5..97b023f0cbe8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -106,6 +106,7 @@ config X86 | |||
| 106 | select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC) | 106 | select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC) |
| 107 | select GENERIC_TIME_VSYSCALL if X86_64 | 107 | select GENERIC_TIME_VSYSCALL if X86_64 |
| 108 | select KTIME_SCALAR if X86_32 | 108 | select KTIME_SCALAR if X86_32 |
| 109 | select ALWAYS_USE_PERSISTENT_CLOCK | ||
| 109 | select GENERIC_STRNCPY_FROM_USER | 110 | select GENERIC_STRNCPY_FROM_USER |
| 110 | select GENERIC_STRNLEN_USER | 111 | select GENERIC_STRNLEN_USER |
| 111 | select HAVE_CONTEXT_TRACKING if X86_64 | 112 | select HAVE_CONTEXT_TRACKING if X86_64 |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 06ccb5073a3f..4b9ea101fe3b 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
| @@ -623,7 +623,8 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) | |||
| 623 | ns_now = __cycles_2_ns(tsc_now); | 623 | ns_now = __cycles_2_ns(tsc_now); |
| 624 | 624 | ||
| 625 | if (cpu_khz) { | 625 | if (cpu_khz) { |
| 626 | *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz; | 626 | *scale = ((NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR) + |
| 627 | cpu_khz / 2) / cpu_khz; | ||
| 627 | *offset = ns_now - mult_frac(tsc_now, *scale, | 628 | *offset = ns_now - mult_frac(tsc_now, *scale, |
| 628 | (1UL << CYC2NS_SCALE_FACTOR)); | 629 | (1UL << CYC2NS_SCALE_FACTOR)); |
| 629 | } | 630 | } |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 923a9da9c829..5e44eaabf457 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -20,14 +20,24 @@ if RTC_CLASS | |||
| 20 | config RTC_HCTOSYS | 20 | config RTC_HCTOSYS |
| 21 | bool "Set system time from RTC on startup and resume" | 21 | bool "Set system time from RTC on startup and resume" |
| 22 | default y | 22 | default y |
| 23 | depends on !ALWAYS_USE_PERSISTENT_CLOCK | ||
| 23 | help | 24 | help |
| 24 | If you say yes here, the system time (wall clock) will be set using | 25 | If you say yes here, the system time (wall clock) will be set using |
| 25 | the value read from a specified RTC device. This is useful to avoid | 26 | the value read from a specified RTC device. This is useful to avoid |
| 26 | unnecessary fsck runs at boot time, and to network better. | 27 | unnecessary fsck runs at boot time, and to network better. |
| 27 | 28 | ||
| 29 | config RTC_SYSTOHC | ||
| 30 | bool "Set the RTC time based on NTP synchronization" | ||
| 31 | default y | ||
| 32 | depends on !ALWAYS_USE_PERSISTENT_CLOCK | ||
| 33 | help | ||
| 34 | If you say yes here, the system time (wall clock) will be stored | ||
| 35 | in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11 | ||
| 36 | minutes if userspace reports synchronized NTP status. | ||
| 37 | |||
| 28 | config RTC_HCTOSYS_DEVICE | 38 | config RTC_HCTOSYS_DEVICE |
| 29 | string "RTC used to set the system time" | 39 | string "RTC used to set the system time" |
| 30 | depends on RTC_HCTOSYS = y | 40 | depends on RTC_HCTOSYS = y || RTC_SYSTOHC = y |
| 31 | default "rtc0" | 41 | default "rtc0" |
| 32 | help | 42 | help |
| 33 | The RTC device that will be used to (re)initialize the system | 43 | The RTC device that will be used to (re)initialize the system |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 4418ef3f9ecc..ec2988b00a44 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
| @@ -6,6 +6,7 @@ ccflags-$(CONFIG_RTC_DEBUG) := -DDEBUG | |||
| 6 | 6 | ||
| 7 | obj-$(CONFIG_RTC_LIB) += rtc-lib.o | 7 | obj-$(CONFIG_RTC_LIB) += rtc-lib.o |
| 8 | obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o | 8 | obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o |
| 9 | obj-$(CONFIG_RTC_SYSTOHC) += systohc.o | ||
| 9 | obj-$(CONFIG_RTC_CLASS) += rtc-core.o | 10 | obj-$(CONFIG_RTC_CLASS) += rtc-core.o |
| 10 | rtc-core-y := class.o interface.o | 11 | rtc-core-y := class.o interface.o |
| 11 | 12 | ||
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 5143629dedbd..26388f182594 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
| @@ -50,6 +50,10 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) | |||
| 50 | struct rtc_device *rtc = to_rtc_device(dev); | 50 | struct rtc_device *rtc = to_rtc_device(dev); |
| 51 | struct rtc_time tm; | 51 | struct rtc_time tm; |
| 52 | struct timespec delta, delta_delta; | 52 | struct timespec delta, delta_delta; |
| 53 | |||
| 54 | if (has_persistent_clock()) | ||
| 55 | return 0; | ||
| 56 | |||
| 53 | if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) | 57 | if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) |
| 54 | return 0; | 58 | return 0; |
| 55 | 59 | ||
| @@ -88,6 +92,9 @@ static int rtc_resume(struct device *dev) | |||
| 88 | struct timespec new_system, new_rtc; | 92 | struct timespec new_system, new_rtc; |
| 89 | struct timespec sleep_time; | 93 | struct timespec sleep_time; |
| 90 | 94 | ||
| 95 | if (has_persistent_clock()) | ||
| 96 | return 0; | ||
| 97 | |||
| 91 | rtc_hctosys_ret = -ENODEV; | 98 | rtc_hctosys_ret = -ENODEV; |
| 92 | if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) | 99 | if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) |
| 93 | return 0; | 100 | return 0; |
diff --git a/drivers/rtc/systohc.c b/drivers/rtc/systohc.c new file mode 100644 index 000000000000..bf3e242ccc5c --- /dev/null +++ b/drivers/rtc/systohc.c | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software; you can redistribute it and/or modify it | ||
| 3 | * under the terms of the GNU General Public License version 2 as published by | ||
| 4 | * the Free Software Foundation. | ||
| 5 | * | ||
| 6 | */ | ||
| 7 | #include <linux/rtc.h> | ||
| 8 | #include <linux/time.h> | ||
| 9 | |||
| 10 | /** | ||
| 11 | * rtc_set_ntp_time - Save NTP synchronized time to the RTC | ||
| 12 | * @now: Current time of day | ||
| 13 | * | ||
| 14 | * Replacement for the NTP platform function update_persistent_clock | ||
| 15 | * that stores time for later retrieval by rtc_hctosys. | ||
| 16 | * | ||
| 17 | * Returns 0 on successful RTC update, -ENODEV if a RTC update is not | ||
| 18 | * possible at all, and various other -errno for specific temporary failure | ||
| 19 | * cases. | ||
| 20 | * | ||
| 21 | * If temporary failure is indicated the caller should try again 'soon' | ||
| 22 | */ | ||
| 23 | int rtc_set_ntp_time(struct timespec now) | ||
| 24 | { | ||
| 25 | struct rtc_device *rtc; | ||
| 26 | struct rtc_time tm; | ||
| 27 | int err = -ENODEV; | ||
| 28 | |||
| 29 | if (now.tv_nsec < (NSEC_PER_SEC >> 1)) | ||
| 30 | rtc_time_to_tm(now.tv_sec, &tm); | ||
| 31 | else | ||
| 32 | rtc_time_to_tm(now.tv_sec + 1, &tm); | ||
| 33 | |||
| 34 | rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | ||
| 35 | if (rtc) { | ||
| 36 | /* rtc_hctosys exclusively uses UTC, so we call set_time here, | ||
| 37 | * not set_mmss. */ | ||
| 38 | if (rtc->ops && (rtc->ops->set_time || rtc->ops->set_mmss)) | ||
| 39 | err = rtc_set_time(rtc, &tm); | ||
| 40 | rtc_class_close(rtc); | ||
| 41 | } | ||
| 42 | |||
| 43 | return err; | ||
| 44 | } | ||
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 7003e5266f25..288f068740f6 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
| @@ -167,12 +167,16 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, | |||
