summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* timekeeping: Provide ktime_mono_to_any()Thomas Gleixner2014-07-232-0/+29
| | | | | | | | ktime based conversion function to map a monotonic time stamp to a different CLOCK. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping; Use ktime based data for ktime_get_update_offsets_tick()Thomas Gleixner2014-07-231-6/+6
| | | | | | | No need to juggle with timespecs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Use ktime_t data for ktime_get_update_offsets_now()Thomas Gleixner2014-07-231-6/+4
| | | | | | | No need to juggle with timespecs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Use ktime_t based data for ktime_get_clocktai()Thomas Gleixner2014-07-232-16/+8
| | | | | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping; Use ktime_t based data for ktime_get_boottime()Thomas Gleixner2014-07-232-18/+11
| | | | | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Use ktime_t based data for ktime_get_real()Thomas Gleixner2014-07-232-16/+8
| | | | | | | Speed up the readout. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Provide ktime_get_with_offset()Thomas Gleixner2014-07-232-0/+36
| | | | | | | | Provide a helper function which lets us implement ktime_t based interfaces for real, boot and tai clocks. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Use ktime_t based data for ktime_get()Thomas Gleixner2014-07-231-4/+5
| | | | | | | | Speed up ktime_get() by using ktime_t based data. Text size shrinks by 64 bytes on x8664. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Provide internal ktime_t based dataThomas Gleixner2014-07-232-0/+25
| | | | | | | | | The ktime_t based interfaces are used a lot in performance critical code pathes. Add ktime_t based data so the interfaces don't have to convert from the xtime/timespec based data. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Use timekeeping_update() instead of memcpy()Thomas Gleixner2014-07-231-2/+1
| | | | | | | | We already have a function which does the right thing, that also makes sure that the coming ktime_t based cached values are getting updated. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Cache optimize struct timekeeperThomas Gleixner2014-07-232-126/+143
| | | | | | | | | | | struct timekeeper is quite badly sorted for the hot readout path. Most time access functions need to load two cache lines. Rearrange it so ktime_get() and getnstimeofday() are happy with a single cache line. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeper: Move tk_xtime to core codeThomas Gleixner2014-07-232-45/+43
| | | | | | | No users outside of the core. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Provide timespec64 based interfacesThomas Gleixner2014-07-233-33/+87
| | | | | | | | To convert callers of the core code to timespec64 we need to provide the proper interfaces. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* time: Consolidate the time accessor prototypesThomas Gleixner2014-07-239-58/+111
| | | | | | | | | Right now we have time related prototypes in 3 different header files. Move it to a single timekeeping header file and move the core internal stuff into a core private header. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Convert timekeeping core to use timespec64sJohn Stultz2014-07-236-87/+109
| | | | | | | | | | | | | Convert the core timekeeping logic to use timespec64s. This moves the 2038 issues out of the core logic and into all of the accessor functions. Future changes will need to push the timespec64s out to all timekeeping users, but that can be done interface by interface. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* time: More core infrastructure for timespec64John Stultz2014-07-233-0/+118
| | | | | | | | Helper and conversion functions for timespec64. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* time64: Add time64.h header and define struct timespec64John Stultz2014-07-232-14/+163
| | | | | | | | | | Define the timespec64 structure and standard helper functions. [ tglx: Make it 32bit only. 64bit really can map timespec to timespec64 ] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* ktime: Change ktime_set() to take 64bit seconds valueJohn Stultz2014-07-231-4/+3
| | | | | | | | | | | In order to support dates past 2038 on 32bit systems, ktime_set() needs to handle 64bit second values. [ tglx: Removed the BITS_PER_LONG check ] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* ktime: Sanitize ktime_to_us/ms conversionThomas Gleixner2014-07-233-10/+9
| | | | | | | | | | With the plain nanoseconds based ktime_t we can simply use ktime_divns() instead of going through loops and hoops of timespec/timeval conversion. Reported-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* ktime: Kill non-scalar ktime_t implementation for 2038John Stultz2014-07-239-246/+7
| | | | | | | | | | | | | | | | | | | | | | | | | The non-scalar ktime_t implementation is basically a timespec which has to be changed to support dates past 2038 on 32bit systems. This patch removes the non-scalar ktime_t implementation, forcing the scalar s64 nanosecond version on all architectures. This may have additional performance overhead on some 32bit systems when converting between ktime_t and timespec structures, however the majority of 32bit systems (arm and i386) were already using scalar ktime_t, so no performance regressions will be seen on those platforms. On affected platforms, I'm open to finding optimizations, including avoiding converting to timespecs where possible. [ tglx: We can now cleanup the ktime_t.tv64 mess, but thats a different issue and we can throw a coccinelle script at it ] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* hrtimer: Cleanup hrtimer accessors to the timekepeing stateJohn Stultz2014-07-234-29/+37
| | | | | | | | | | | | | | Rather then having two similar but totally different implementations that provide timekeeping state to the hrtimer code, try to unify the two implementations to be more simliar. Thus this clarifies ktime_get_update_offsets to ktime_get_update_offsets_now and changes get_xtime... to ktime_get_update_offsets_tick. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* timekeeping: Simplify arch_gettimeoffset()Thomas Gleixner2014-07-231-12/+6
| | | | | | | | | Provide a default stub function instead of having the extra conditional. Cuts binary size on a m68k build by ~100 bytes. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
* tile: Convert VDSO timekeeping to the precise mechanismThomas Gleixner2014-07-232-8/+8
| | | | | | | | | The code was only halfarsed converted to the new VSDO update mechanism and still uses the inaccurate base value which lacks the fractional part of xtime_nsec. Fix it up. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
* tools: add script to test udelayDavid Riley2014-07-231-0/+66
| | | | | | | | This script makes use of the udelay_test module to exercise udelay() and ensure that it is delaying long enough (as compared to ktime). Signed-off-by: David Riley <davidriley@chromium.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
* kernel: time: Add udelay_test module to validate udelayDavid Riley2014-07-233-0/+179
| | | | | | | | | | | | | | Create a module that allows udelay() to be executed to ensure that it is delaying at least as long as requested (with a little bit of error allowed). There are some configurations which don't have reliably udelay due to using a loop delay with cpufreq changes which should use a counter time based delay instead. This test aims to identify those configurations where timing is unreliable. Signed-off-by: David Riley <davidriley@chromium.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
* Merge branch 'clockevents/3.17' of ↵Thomas Gleixner2014-07-2327-513/+1116
|\ | | | | | | | | | | | | | | | | | | | | | | | | git://git.linaro.org/people/daniel.lezcano/linux into timers/core Pull clockevents from Danel Lezcano: * New timer driver for the Cirrus Logic CLPS711X SoC * New driver for the Mediatek SoC which includes: * A new function for of, acked by Rob Herring * Move the PXA driver to drivers/clocksource, add DT support * Optimization of the exynos_mct driver * DT support for the renesas timers family. * Some Kconfig and driver fixlets
| * clocksource: exynos_mct: Only use 32-bits where possibleDoug Anderson2014-07-232-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MCT has a nice 64-bit counter. That means that we _can_ register as a 64-bit clocksource and sched_clock. ...but that doesn't mean we should. The 64-bit counter is read by reading two 32-bit registers. That means reading needs to be something like: - Read upper half - Read lower half - Read upper half and confirm that it hasn't changed. That wouldn't be terrible, but: - THe MCT isn't very fast to access (hundreds of nanoseconds). - The clocksource is queried _all the time_. In total system profiles of real workloads on ChromeOS, we've seen exynos_frc_read() taking 2% or more of CPU time even after optimizing the 3 reads above to 2 (see below). The MCT is clocked at ~24MHz on all known systems. That means that the 32-bit half of the counter rolls over every ~178 seconds. This inspired an optimization in ChromeOS to cache the upper half between calls, moving 3 reads to 2. ...but we can do better! Having a 32-bit timer that flips every 178 seconds is more than sufficient for Linux. Let's just use the lower half of the MCT. Times on 5420 to do 1000000 gettimeofday() calls from userspace: * Original code: 1323852 us * ChromeOS cache upper half: 1173084 us * ChromeOS + ldmia to optimize: 1045674 us * Use lower 32-bit only (this code): 1014429 us As you can see, the time used doesn't increase linearly with the number of reads and we can make 64-bit work almost as fast as 32-bit with a bit of assembly code. But since there's no real gain for 64-bit, let's go with the simplest and fastest implementation. Note: with this change roughly half the time for gettimeofday() is spent in exynos_frc_read(). The rest is timer / system call overhead. Also note: this patch disables the use of the MCT on ARM64 systems until we've sorted out how to make "cycles_t" always 32-bit. Really ARM64 systems should be using arch timers anyway. Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: exynos_mct: Use readl_relaxed/writel_relaxedDoug Anderson2014-07-231-12/+12
| | | | | | | | | | | | | | | | | | Using the __raw functions is discouraged. Update the file to consistently use the proper functions. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * ARM: pxa: Add non device-tree timer link to clocksourceRobert Jarzmik2014-07-232-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | As clocksource pxa_timer was moved to clocksource framework, the pxa_timer initialization needs to be a bit amended, to pass the necessary informations to clocksource, ie : - the timer interrupt (mach specific) - the timer registers base (ditto) - the timer clockrate Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * ARM: pxa: Add CLKSRC_OF dependencyRobert Jarzmik2014-07-231-0/+1
| | | | | | | | | | | | | | Select CLKSRC_OF for PXA architectures. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: pxa: Add device-tree support for PXA timerRobert Jarzmik2014-07-231-36/+101
| | | | | | | | | | | | | | | | | | | | | | Add device-tree support to PXA platforms. The driver still needs to maintain backward non device-tree compatibility as well, which implies : - a non device-tree init function - a static registers base address in the driver Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: pxa: Move PXA timer to clocksource frameworkRobert Jarzmik2014-07-233-1/+2
| | | | | | | | | | | | | | | | Move time.c from arch/arm/mach-pxa/time.c to drivers/clocksource/pxa_timer.c. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: clps711x: Add DT bindings documentationAlexander Shiyan2014-07-231-0/+29
| | | | | | | | | | | | | | | | | | This patch adds DT binding documentation for the Cirrus Logic CLPS711X-based CPUs clocksource subsystem. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: clps711x: Add CLPS711X clocksource driverAlexander Shiyan2014-07-232-0/+132
| | | | | | | | | | | | | | | | | | | | This adds the clocksource driver for Cirrus Logic CLPS711X series SoCs. Designed primarily for migration CLPS711X subarch for multiplatform & DT, for this as the "OF" and "non-OF" calls implemented. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: sirf: Fix incorrect clock enable counter for timerZhiwu Song2014-07-232-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the clocksource driver, we didn't explicitly enable the clock. it makes the clk reference counter wrong. We didn't encounter any hang issue because the tick's clock input has been open and is shared by some other hardware components, but if we don't enable those components in kernel, in the stage of disabling unused clk in kernel boot, Linux tick hangs. This patch fixes it. it does an explicit prepare and enable to the clock input, and increases the usage counter of the clk. Signed-off-by: Zhiwu Song <Zhiwu.Song@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: Kconfig: Let EM_TIMER_STI depend on HAS_IOMEMChen Gang2014-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In 'em_sti.c', it will call devm_ioremap_resource() which need HAS_IOMEM. So need let EM_TIMER_STI depend on HAS_IOMEM, too. The related error (with allmodconfig under score): LD init/built-in.o em_sti.c:(.text.em_sti_probe+0x84): undefined reference to `devm_ioremap_resource' make: *** [vmlinux] Error 1 Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * vendor-prefixes: Add prefix for Mediatek Inc.Matthias Brugger2014-07-231-0/+1
| | | | | | | | | | | | Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * dt-bindings: Add mtk-timer bindingsMatthias Brugger2014-07-231-0/+17
| | | | | | | | | | | | | | | | | | | | Add binding documentation for the General Purpose Timer driver of the Mediatek SoCs. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: Add support for the Mediatek SoCsMatthias Brugger2014-07-233-0/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a clock source and clock event for the timer found on the Mediatek SoCs. The Mediatek General Purpose Timer block provides five 32 bit timers and one 64 bit timer. Two 32 bit timers are used by this driver: TIMER1: clock events supporting periodic and oneshot events TIMER2: clock source configured as a free running counter The General Purpose Timer block can be run with two clocks. A 13 MHz system clock and the RTC clock running at 32 KHz. This implementation uses the system clock with no clock source divider. The interrupts are shared between the different timers and have to be read back from a register. We just enable one interrupt for the clock event. The clock event timer is used by all cores. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * of: Provide a function to request and map memoryMatthias Brugger2014-07-234-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | A call to of_iomap does not request the memory region. This patch adds the function of_io_request_and_map which requests the memory region before mapping it. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Suggested-by: Thomas Gleixner <tglx@linutronix.de> Suggested-by: Rob Herring <robh@kernel.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * clocksource: sh_mtu2: Tidy up Kconfig typo for MTU2Kuninori Morimoto2014-07-231-1/+1
| | | | | | | | | | | | | | | | | | It should be "MTU2" instead of "TMU2" Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Wolfram Sang <wsa@sang-engineering.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
| * Merge branch 'clockevents/renesas-timers-dt' into clockevents/3.17Daniel Lezcano2014-07-237-327/+309
| |\
| | * clocksource: sh_mtu2: Add DT supportLaurent Pinchart2014-07-042-0/+47
| | | | | | | | | | | | | | | | | | | | | Document DT bindings and parse them in the MTU2 driver. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Wolfram Sang <wsa@sang-engineering.com>
| | * clocksource: sh_tmu: Add DT supportLaurent Pinchart2014-07-042-10/+80
| | | | | | | | | | | | | | | | | | | | | Document DT bindings and parse them in the TMU driver. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Simon Horman <horms+renesas@verge.net.au>
| | * clocksource: sh_cmt: Add DT supportLaurent Pinchart2014-07-042-18/+95
| | | | | | | | | | | | | | | | | | | | | Document DT bindings and parse them in the CMT driver. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Simon Horman <horms+renesas@verge.net.au>
| | * clocksource: shmobile: Remove unused sh_timer_config membersLaurent Pinchart2014-07-021-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | The name, channel_offset, timer_bit, clockevent_rating and clocksource_rating members are unused. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Simon Horman <horms+renesas@verge.net.au>
| | * clocksource: sh_mtu2: Replace global spinlock with a per-device spinlockLaurent Pinchart2014-07-021-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The global spinlock is used to protect the shared start/stop register. Now that all MTU2 channels are handled by a single device instance, use a per-device spinlock. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Wolfram Sang <wsa@sang-engineering.com>
| | * clocksource: sh_mtu2: Drop support for legacy platform dataLaurent Pinchart2014-07-021-99/+31
| | | | | | | | | | | | | | | | | | | | | | | | Now that all platforms have switched to the new-style platform data, drop support for the legacy version. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Wolfram Sang <wsa@sang-engineering.com>
| | * clocksource: sh_tmu: Replace global spinlock with a per-device spinlockLaurent Pinchart2014-07-021-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The global spinlock is used to protect the shared start/stop register. Now that all TMU channels are handled by a single device instance, use a per-device spinlock. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Simon Horman <horms+renesas@verge.net.au>
| | * clocksource: sh_tmu: Drop support for legacy platform dataLaurent Pinchart2014-07-021-67/+15
| | | | | | | | | | | | | | | | | | | | | | | | Now that all platforms have switched to the new-style platform data, drop support for the legacy version. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Simon Horman <horms+renesas@verge.net.au>
OpenPOWER on IntegriCloud