Skip to content

Commit

Permalink
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/sc…
Browse files Browse the repository at this point in the history
…m/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
 "The following trilogy of patches brings you:

   - fix for a long standing math overflow issue with HZ < 60

   - an onliner fix for a corner case in the dreaded tick broadcast
     mechanism affecting a certain range of AMD machines which are
     infested with the infamous automagic C1E power control misfeature

   - a fix for one of the ARM platforms which allows the kernel to
     proceed and boot instead of stupidly panicing for no good reason.
     The patch is slightly larger than necessary, but it's less ugly
     than the alternative 5 liner"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tick: Clear broadcast pending bit when switching to oneshot
  clocksource: Kona: Print warning rather than panic
  time: Fix overflow when HZ is smaller than 60
  • Loading branch information
Linus Torvalds committed Feb 16, 2014
2 parents 9bd01b9 + dd5fd9b commit 3a19c07
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
54 changes: 28 additions & 26 deletions drivers/clocksource/bcm_kona_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,6 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw)
return;
}

static void __init kona_timers_init(struct device_node *node)
{
u32 freq;
struct clk *external_clk;

external_clk = of_clk_get_by_name(node, NULL);

if (!IS_ERR(external_clk)) {
arch_timer_rate = clk_get_rate(external_clk);
clk_prepare_enable(external_clk);
} else if (!of_property_read_u32(node, "clock-frequency", &freq)) {
arch_timer_rate = freq;
} else {
panic("unable to determine clock-frequency");
}

/* Setup IRQ numbers */
timers.tmr_irq = irq_of_parse_and_map(node, 0);

/* Setup IO addresses */
timers.tmr_regs = of_iomap(node, 0);

kona_timer_disable_and_clear(timers.tmr_regs);
}

static int kona_timer_set_next_event(unsigned long clc,
struct clock_event_device *unused)
{
Expand Down Expand Up @@ -198,7 +173,34 @@ static struct irqaction kona_timer_irq = {

static void __init kona_timer_init(struct device_node *node)
{
kona_timers_init(node);
u32 freq;
struct clk *external_clk;

if (!of_device_is_available(node)) {
pr_info("Kona Timer v1 marked as disabled in device tree\n");
return;
}

external_clk = of_clk_get_by_name(node, NULL);

if (!IS_ERR(external_clk)) {
arch_timer_rate = clk_get_rate(external_clk);
clk_prepare_enable(external_clk);
} else if (!of_property_read_u32(node, "clock-frequency", &freq)) {
arch_timer_rate = freq;
} else {
pr_err("Kona Timer v1 unable to determine clock-frequency");
return;
}

/* Setup IRQ numbers */
timers.tmr_irq = irq_of_parse_and_map(node, 0);

/* Setup IO addresses */
timers.tmr_regs = of_iomap(node, 0);

kona_timer_disable_and_clear(timers.tmr_regs);

kona_timer_clockevents_init();
setup_irq(timers.tmr_irq, &kona_timer_irq);
kona_timer_set_next_event((arch_timer_rate / HZ), NULL);
Expand Down
6 changes: 6 additions & 0 deletions kernel/time/jiffies.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
* HZ shrinks, so values greater than 8 overflow 32bits when
* HZ=100.
*/
#if HZ < 34
#define JIFFIES_SHIFT 6
#elif HZ < 67
#define JIFFIES_SHIFT 7
#else
#define JIFFIES_SHIFT 8
#endif

static cycle_t jiffies_read(struct clocksource *cs)
{
Expand Down
1 change: 1 addition & 0 deletions kernel/time/tick-broadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ void tick_broadcast_oneshot_control(unsigned long reason)
static void tick_broadcast_clear_oneshot(int cpu)
{
cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask);
cpumask_clear_cpu(cpu, tick_broadcast_pending_mask);
}

static void tick_broadcast_init_next_event(struct cpumask *mask,
Expand Down

0 comments on commit 3a19c07

Please sign in to comment.