ARM: twd: register clockevents device before enabling PPI
authorWill Deacon <will.deacon@arm.com>
Wed, 20 Jul 2011 13:18:46 +0000 (14:18 +0100)
committer黄涛 <huangtao@rock-chips.com>
Wed, 22 Feb 2012 06:09:45 +0000 (14:09 +0800)
The smp_twd clockevents driver currently enables the local timer PPI
before the clockevents device is registered. This can lead to a kernel
panic if a spurious timer interrupt is generated before registration
has completed since the kernel will treat it as an IPI timer.

This patch moves the clockevents device registration before the IRQ
unmasking so that we can always handle timer interrupts once they can
occur.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm/kernel/smp_twd.c

index 350a125f8cd690435a75f8565dbac00569d8194f..5d9e308a0909c4f07edd4b27b398bbf3618c526b 100644 (file)
@@ -190,10 +190,10 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
        clk->set_mode = twd_set_mode;
        clk->set_next_event = twd_set_next_event;
 
-       /* Make sure our local interrupt controller has this enabled */
-       gic_enable_ppi(clk->irq);
-
        __get_cpu_var(twd_ce) = clk;
 
        clockevents_config_and_register(clk, twd_timer_rate, 0xf, 0xffffffff);
+
+       /* Make sure our local interrupt controller has this enabled */
+       gic_enable_ppi(clk->irq);
 }