Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67553
b: refs/heads/master
c: d968014
h: refs/heads/master
i:
  67551: d69355e
v: v3
  • Loading branch information
Paul Mackerras committed Oct 11, 2007
1 parent fee2735 commit 201068e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 87a72f9e171e558a0288aa83ef1dc6ae4af32224
refs/heads/master: d968014b7280e2c447b20363e576999040ac72ef
14 changes: 14 additions & 0 deletions trunk/arch/powerpc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ static struct clock_event_device decrementer_clockevent = {

static DEFINE_PER_CPU(struct clock_event_device, decrementers);
void init_decrementer_clockevent(void);
static DEFINE_PER_CPU(u64, decrementer_next_tb);

#ifdef CONFIG_PPC_ISERIES
static unsigned long __initdata iSeries_recal_titan;
Expand Down Expand Up @@ -541,6 +542,7 @@ void timer_interrupt(struct pt_regs * regs)
struct pt_regs *old_regs;
int cpu = smp_processor_id();
struct clock_event_device *evt = &per_cpu(decrementers, cpu);
u64 now;

/* Ensure a positive value is written to the decrementer, or else
* some CPUs will continuue to take decrementer exceptions */
Expand All @@ -551,6 +553,14 @@ void timer_interrupt(struct pt_regs * regs)
do_IRQ(regs);
#endif

now = get_tb_or_rtc();
if (now < per_cpu(decrementer_next_tb, cpu)) {
/* not time for this event yet */
now = per_cpu(decrementer_next_tb, cpu) - now;
if (now <= DECREMENTER_MAX)
set_dec((unsigned int)now - 1);
return;
}
old_regs = set_irq_regs(regs);
irq_enter();

Expand Down Expand Up @@ -797,6 +807,10 @@ void __init clocksource_init(void)
static int decrementer_set_next_event(unsigned long evt,
struct clock_event_device *dev)
{
__get_cpu_var(decrementer_next_tb) = get_tb_or_rtc() + evt;
/* The decrementer interrupts on the 0 -> -1 transition */
if (evt)
--evt;
set_dec(evt);
return 0;
}
Expand Down

0 comments on commit 201068e

Please sign in to comment.