timer changes for 3.18
Subsystems (9)
Linus,
please pull the latest timers-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-core-for-linus
Nothing really exciting this time:
- A few fixlets in the NOHZ code
- A new ARM SoC timer abomination. One should expect that we have enough of them already, but they insist on inventing new ones.
- The usual bunch of ARM SoC timer updates. That feels like herding cats.
Thanks,
tglx
------------------>
Carlo Caione (2):
ARM: meson: documentation: Add timer documentation
ARM: meson6: clocksource: Add Meson6 timer support
Dan Carpenter (1):
timerfd: Remove an always true check
Gael Portay (1):
clocksource: tcb_clksrc: Sanitize IRQ request
Hao Liu (1):
clocksource: sirf: Disable counter before re-setting it
Michal Simek (1):
clocksource: cadence_ttc: Add support for 32bit mode
Nathan Lynch (3):
clocksource: arm_arch_timer: Change clocksource name if CP15 unavailable
clocksource: arm_arch_timer: Enable counter access for 32-bit ARM
clocksource: arm_arch_timer: Consolidate arch_timer_evtstrm_enable
Simon Horman (3):
clocksource: sh_cmt: Document SoC specific bindings
clocksource: sh_mtu2: Document r7s72100 binding
clocksource: sh_tmu: Document r8a7779 binding
Stefan Agner (1):
clocksource: vf_pit_timer: Support shutdown mode
Sudeep Holla (1):
clocksource: arm_arch_timer: Discard unavailable timers correctly
Viresh Kumar (2):
nohz: Fix spurious periodic tick behaviour in low-res dynticks mode
nohz: Avoid tick's double reprogramming in highres mode
.../bindings/timer/amlogic,meson6-timer.txt | 15 ++ .../devicetree/bindings/timer/renesas,cmt.txt | 44 +++++- .../devicetree/bindings/timer/renesas,mtu2.txt | 7 +- .../devicetree/bindings/timer/renesas,tmu.txt | 7 +- arch/arm/include/asm/arch_timer.h | 25 --- arch/arm64/include/asm/arch_timer.h | 31 ---- drivers/clocksource/Kconfig | 3 + drivers/clocksource/Makefile | 1 + drivers/clocksource/arm_arch_timer.c | 64 +++++++- drivers/clocksource/cadence_ttc_timer.c | 15 +- drivers/clocksource/meson6_timer.c | 167 +++++++++++++++++++++ drivers/clocksource/tcb_clksrc.c | 13 +- drivers/clocksource/timer-marco.c | 5 +- drivers/clocksource/vf_pit_timer.c | 4 + fs/timerfd.c | 3 +- kernel/time/tick-sched.c | 8 + 16 files changed, 323 insertions(+), 89 deletions(-) create mode 100644 Documentation/devicetree/bindings/timer/amlogic,meson6-timer.txt create mode 100644 drivers/clocksource/meson6_timer.c
Documentation/devicetree/bindings/timer/amlogic,meson6-timer.txt new file +15 -0
@@ -0,0 +1,15 @@ +Amlogic Meson6 SoCs Timer Controller + +Required properties: + +- compatible : should be "amlogic,meson6-timer" +- reg : Specifies base physical address and size of the registers. +- interrupts : The interrupt of the first timer + +Example: + +timer@c1109940 { + compatible = "amlogic,meson6-timer"; + reg = <0xc1109940 0x14>; + interrupts = <0 10 1>; +};
Documentation/devicetree/bindings/timer/renesas,cmt.txt +38 -6
60 lines not on this page · raw message
Documentation/devicetree/bindings/timer/renesas,mtu2.txt +5 -2
@@ -8,7 +8,10 @@ are independent. The MTU2 hardware supports five channels indexed from 0 to 4. Required Properties: - - compatible: must contain "renesas,mtu2" + - compatible: must be one or more of the following: + - "renesas,mtu2-r7s72100" for the r7s72100 MTU2 + - "renesas,mtu2" for any MTU2 + This is a fallback for the above renesas,mtu2-* entries - reg: base address and length of the registers block for the timer module.
@@ -26,7 +29,7 @@ Required Properties: Example: R7S72100 (RZ/A1H) MTU2 node mtu2: timer@fcff0000 { - compatible = "renesas,mtu2"; + compatible = "renesas,mtu2-r7s72100", "renesas,mtu2"; reg = <0xfcff0000 0x400>; interrupts = <0 139 IRQ_TYPE_LEVEL_HIGH>, <0 146 IRQ_TYPE_LEVEL_HIGH>,
Documentation/devicetree/bindings/timer/renesas,tmu.txt +5 -2
@@ -8,7 +8,10 @@ are independent. The TMU hardware supports up to three channels. Required Properties: - - compatible: must contain "renesas,tmu" + - compatible: must contain one or more of the following: + - "renesas,tmu-r8a7779" for the r8a7779 TMU + - "renesas,tmu" for any TMU. + This is a fallback for the above renesas,tmu-* entries - reg: base address and length of the registers block for the timer module.
@@ -27,7 +30,7 @@ Optional Properties: Example: R8A7779 (R-Car H1) TMU0 node tmu0: timer@ffd80000 { - compatible = "renesas,tmu"; + compatible = "renesas,tmu-r8a7779", "renesas,tmu"; reg = <0xffd80000 0x30>; interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>, <0 33 IRQ_TYPE_LEVEL_HIGH>,
arch/arm/include/asm/arch_timer.h +0 -25
@@ -99,31 +99,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) asmvolatile ("mcr p15, 0, %0, c14, c1, 0" : :"r" (cntkctl)); } -static inline void arch_counter_set_user_access (void ) -{ -u32 cntkctl =arch_timer_get_cntkctl (); - -/* Disable user access to both physical/virtual counters/timers */ -/* Also disable virtual event stream */ - cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN - |ARCH_TIMER_USR_VT_ACCESS_EN - |ARCH_TIMER_VIRT_EVT_EN - |ARCH_TIMER_USR_VCT_ACCESS_EN - |ARCH_TIMER_USR_PCT_ACCESS_EN ); -arch_timer_set_cntkctl (cntkctl); -} - -static inline void arch_timer_evtstrm_enable (int divider) -{ -u32 cntkctl =arch_timer_get_cntkctl (); - cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK ; -/* Set the divider and enable virtual event stream */ - cntkctl |= (divider <<ARCH_TIMER_EVT_TRIGGER_SHIFT ) - |ARCH_TIMER_VIRT_EVT_EN ; -arch_timer_set_cntkctl (cntkctl); - elf_hwcap |=HWCAP_EVTSTRM ; -} -#endif #endif
arch/arm64/include/asm/arch_timer.h +0 -31
@@ -104,37 +104,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl) asmvolatile ("msr cntkctl_el1, %0" : :"r" (cntkctl)); } -static inline void arch_counter_set_user_access (void ) -{ -u32 cntkctl =arch_timer_get_cntkctl (); - -/* Disable user access to the timers and the physical counter */ -/* Also disable virtual event stream */ - cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN - |ARCH_TIMER_USR_VT_ACCESS_EN - |ARCH_TIMER_VIRT_EVT_EN - |ARCH_TIMER_USR_PCT_ACCESS_EN ); - -/* Enable user access to the virtual counter */ - cntkctl |=ARCH_TIMER_USR_VCT_ACCESS_EN ; - -arch_timer_set_cntkctl (cntkctl); -} - -static inline void arch_timer_evtstrm_enable (int divider) -{ -u32 cntkctl =arch_timer_get_cntkctl (); - cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK ; -/* Set the divider and enable virtual event stream */ - cntkctl |= (divider <<ARCH_TIMER_EVT_TRIGGER_SHIFT ) - |ARCH_TIMER_VIRT_EVT_EN ; -arch_timer_set_cntkctl (cntkctl); - elf_hwcap |=HWCAP_EVTSTRM ; -#ifdef CONFIG_COMPAT - compat_elf_hwcap |=COMPAT_HWCAP_EVTSTRM ; -#endif -} -static inline u64 arch_counter_get_cntvct (void ) {u64 cval;
drivers/clocksource/Kconfig +3 -0
@@ -30,6 +30,9 @@ config ARMADA_370_XP_TIMER bool select CLKSRC_OF +config MESON6_TIMER + bool + config ORION_TIMER select CLKSRC_OF select CLKSRC_MMIO
drivers/clocksource/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o obj-$(CONFIG_ARCH_U300) += timer-u300.o obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o obj-$(CONFIG_SUN5I_HSTIMER) += timer-sun5i.o +obj-$(CONFIG_MESON6_TIMER) += meson6_timer.o obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o obj-$(CONFIG_ARCH_NSPIRE) += zevio-timer.o
drivers/clocksource/arm_arch_timer.c +58 -6
98 lines not on this page · raw message
drivers/clocksource/cadence_ttc_timer.c +10 -5
@@ -25,7 +25,7 @@#include <linux/sched_clock.h> /* -* This driver configures the 2 16-bit count-up timers as follows: +* This driver configures the 2 16/32-bit count-up timers as follows: * * T1: Timer 1, clocksource for generic timekeeping * T2: Timer 2, clockevent source for hrtimers
@@ -321,7 +321,8 @@ static int ttc_rate_change_clocksource_cb(struct notifier_block *nb,return NOTIFY_DONE ; } -static void __init ttc_setup_clocksource (struct clk *clk,void __iomem *base) +static void __init ttc_setup_clocksource (struct clk *clk,void __iomem *base, +u32 timer_width) {struct ttc_timer_clocksource *ttccs;int err;
@@ -351,7 +352,7 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) ttccs->cs.name ="ttc_clocksource" ; ttccs->cs.rating =200 ; ttccs->cs.read = __ttc_clocksource_read; - ttccs->cs.mask =CLOCKSOURCE_MASK (16 ); + ttccs->cs.mask =CLOCKSOURCE_MASK (timer_width); ttccs->cs.flags =CLOCK_SOURCE_IS_CONTINUOUS ;/*
@@ -372,7 +373,8 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) } ttc_sched_clock_val_reg = base +TTC_COUNT_VAL_OFFSET ; -sched_clock_register (ttc_sched_clock_read,16 , ttccs->ttc.freq /PRESCALE ); +sched_clock_register (ttc_sched_clock_read, timer_width, + ttccs->ttc.freq /PRESCALE ); } static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
@@ -467,6 +469,7 @@ static void __init ttc_timer_init(struct device_node *timer)struct clk *clk_cs, *clk_ce;static int initialized;int clksel; +u32 timer_width =16 ;if (initialized)return ;
@@ -490,6 +493,8 @@ static void __init ttc_timer_init(struct device_node *timer)BUG (); } +of_property_read_u32 (timer,"timer-width" , &timer_width); + clksel =readl_relaxed (timer_baseaddr +TTC_CLK_CNTRL_OFFSET ); clksel = !!(clksel &TTC_CLK_CNTRL_CSRC_MASK ); clk_cs =of_clk_get (timer, clksel);
@@ -506,7 +511,7 @@ static void __init ttc_timer_init(struct device_node *timer)BUG (); } -ttc_setup_clocksource (clk_cs, timer_baseaddr); +ttc_setup_clocksource (clk_cs, timer_baseaddr, timer_width);ttc_setup_clockevent (clk_ce, timer_baseaddr +4 , irq);pr_info ("%s #0 at %p, irq=%d\n" , timer->name, timer_baseaddr, irq);
drivers/clocksource/meson6_timer.c new file +167 -0
167 lines not on this page · raw message
drivers/clocksource/tcb_clksrc.c +4 -9
@@ -178,12 +178,6 @@ static irqreturn_t ch2_irq(int irq, void *handle)return IRQ_NONE ; } -static struct irqaction tc_irqaction = { - .name ="tc_clkevt" , - .flags =IRQF_TIMER , - .handler = ch2_irq, -}; -static int __init setup_clkevents (struct atmel_tc *tc,int clk32k_divisor_idx) {int ret;
@@ -198,15 +192,16 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx) clkevt.regs = tc->regs; clkevt.clk = t2_clk; - tc_irqaction.dev_id = &clkevt; timer_clock = clk32k_divisor_idx; clkevt.clkevt.cpumask =cpumask_of (0 ); - ret =setup_irq (irq, &tc_irqaction); -if (ret) + ret =request_irq (irq, ch2_irq,IRQF_TIMER ,"tc_clkevt" , &clkevt); +if (ret) { +clk_disable_unprepare (t2_clk);return ret; + }clockevents_config_and_register (&clkevt.clkevt,32768 ,1 ,0xffff );
drivers/clocksource/timer-marco.c +4 -1
@@ -63,7 +63,7 @@ static inline void sirfsoc_timer_count_disable(int idx)/* enable count and interrupt */ static inline void sirfsoc_timer_count_enable (int idx) { -writel_relaxed (readl_relaxed (sirfsoc_timer_base +SIRFSOC_TIMER_32COUNTER_0_CTRL +4 * idx) |0x7 , +writel_relaxed (readl_relaxed (sirfsoc_timer_base +SIRFSOC_TIMER_32COUNTER_0_CTRL +4 * idx) |0x3 , sirfsoc_timer_base +SIRFSOC_TIMER_32COUNTER_0_CTRL +4 * idx); }
@@ -103,6 +103,9 @@ static int sirfsoc_timer_set_next_event(unsigned long delta, {int cpu =smp_processor_id (); +/* disable timer first, then modify the related registers */ +sirfsoc_timer_count_disable (cpu); +writel_relaxed (0 , sirfsoc_timer_base +SIRFSOC_TIMER_COUNTER_0 +4 * cpu); writel_relaxed(delta, sirfsoc_timer_base + SIRFSOC_TIMER_MATCH_0 +
drivers/clocksource/vf_pit_timer.c +4 -0
@@ -93,6 +93,10 @@ static void pit_set_mode(enum clock_event_mode mode,case CLOCK_EVT_MODE_PERIODIC :pit_set_next_event (cycle_per_jiffy, evt);break ; +case CLOCK_EVT_MODE_SHUTDOWN : +case CLOCK_EVT_MODE_UNUSED : +pit_timer_disable (); +break ;default :break ; }
fs/timerfd.c +1 -2
@@ -333,8 +333,7 @@ static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long argspin_lock_irq (&ctx->wqh.lock);if (!timerfd_canceled (ctx)) { ctx->ticks = ticks; -if (ticks) -wake_up_locked (&ctx->wqh); +wake_up_locked (&ctx->wqh); }else ret = -ECANCELED ;spin_unlock_irq (&ctx->wqh.lock);
kernel/time/tick-sched.c +8 -0
@@ -968,6 +968,10 @@ static void tick_nohz_handler(struct clock_event_device *dev)tick_sched_do_timer (now);tick_sched_handle (ts, regs); +/* No need to reprogram if we are running tickless */ +if (unlikely (ts->tick_stopped)) +return ; +while (tick_nohz_reprogram (ts, now)) { now =ktime_get ();tick_do_update_jiffies64 (now);
@@ -1095,6 +1099,10 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)if (regs)tick_sched_handle (ts, regs); +/* No need to reprogram if we are in idle or full dynticks mode */ +if (unlikely (ts->tick_stopped)) +return HRTIMER_NORESTART ; +hrtimer_forward (timer, now, tick_period);return HRTIMER_RESTART ;
Quoted 8 lines · Thomas Gleixner
please pull the latest timers-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittimers-core-for-linusNothing really exciting this time:
- A few fixlets in the NOHZ code
.. but apparently *still* not the fixes from Frederic for the issue that people are complaining about killing their machines in 3.17.
WTF? What happened to those?
Linus
Quoted 6 lines · Linus Torvalds
Quoted 5 lines · Thomas Gleixner
please pull the latest timers-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittimers-core-for-linus
Quoted 8 lines
Quoted 3 lines
Nothing really exciting this time:
- A few fixlets in the NOHZ code
.. but apparently *still* not the fixes from Frederic for the issue that people are complaining about killing their machines in 3.17.
WTF? What happened to those?
Thomas just pulled these in -tip today. I'm pretty sure he plans to make a 2nd timers pile after this one during the merge window. We just found a non-trivial conflict in my branch against the RCU tree so this probably needs a bit of last minute adjustment and testing.
Ingo Molnar
maintainerQuoted 15 lines · Frederic Weisbecker
Quoted 14 lines · Linus Torvalds
Quoted 8 lines · Thomas Gleixner
please pull the latest timers-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittimers-core-for-linusNothing really exciting this time:
- A few fixlets in the NOHZ code
.. but apparently *still* not the fixes from Frederic for the issue that people are complaining about killing their machines in 3.17.
Quoted 7 lines
Quoted 1 line
WTF? What happened to those?
Thomas just pulled these in -tip today. I'm pretty sure he plans to make a 2nd timers pile after this one during the merge window. We just found a non-trivial conflict in my branch against the RCU tree so this probably needs a bit of last minute adjustment and testing.
Thomas won't be around until next week, I'll send these fixes later today.
Thanks,
Ingo