* [PATCH] Make clockevents work on PPC601 processors
@ 2007-10-11 11:46 Paul Mackerras
2007-10-11 14:12 ` Kumar Gala
0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2007-10-11 11:46 UTC (permalink / raw)
To: linuxppc-dev
In testing the new clocksource and clockevent code on a PPC601
processor, I discovered that the clockevent multiplier value for the
decrementer clockevent was overflowing. Because the RTCL register in
the 601 effectively counts at 1GHz (it doesn't actually, but it
increases by 128 every 128ns), and the shift value was 32, that meant
the multiplier value had to be 2^32, which won't fit in an unsigned
long on 32-bit. The same problem would arise on any platform where
the timebase frequency was 1GHz or more (not that we actually have any
such machines today).
This fixes it by reducing the shift value to 16. Doing the
calculations with a resolution of 2^-16 nanoseconds (15 femtoseconds)
should be quite adequate. :)
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 64b503c..9368da3 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -108,7 +108,7 @@ static void decrementer_set_mode(enum clock_event_mode mode,
static struct clock_event_device decrementer_clockevent = {
.name = "decrementer",
.rating = 200,
- .shift = 32,
+ .shift = 16,
.mult = 0, /* To be filled in */
.irq = 0,
.set_next_event = decrementer_set_next_event,
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Make clockevents work on PPC601 processors
2007-10-11 11:46 [PATCH] Make clockevents work on PPC601 processors Paul Mackerras
@ 2007-10-11 14:12 ` Kumar Gala
2007-10-11 20:58 ` Benjamin Herrenschmidt
2007-10-11 22:26 ` Paul Mackerras
0 siblings, 2 replies; 4+ messages in thread
From: Kumar Gala @ 2007-10-11 14:12 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On Oct 11, 2007, at 6:46 AM, Paul Mackerras wrote:
> In testing the new clocksource and clockevent code on a PPC601
> processor, I discovered that the clockevent multiplier value for the
> decrementer clockevent was overflowing. Because the RTCL register in
> the 601 effectively counts at 1GHz (it doesn't actually, but it
> increases by 128 every 128ns), and the shift value was 32, that meant
> the multiplier value had to be 2^32, which won't fit in an unsigned
> long on 32-bit. The same problem would arise on any platform where
> the timebase frequency was 1GHz or more (not that we actually have any
> such machines today).
do you still have a 601 running somewhere?
- k
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Make clockevents work on PPC601 processors
2007-10-11 14:12 ` Kumar Gala
@ 2007-10-11 20:58 ` Benjamin Herrenschmidt
2007-10-11 22:26 ` Paul Mackerras
1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-11 20:58 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
On Thu, 2007-10-11 at 09:12 -0500, Kumar Gala wrote:
> On Oct 11, 2007, at 6:46 AM, Paul Mackerras wrote:
>
> > In testing the new clocksource and clockevent code on a PPC601
> > processor, I discovered that the clockevent multiplier value for the
> > decrementer clockevent was overflowing. Because the RTCL register in
> > the 601 effectively counts at 1GHz (it doesn't actually, but it
> > increases by 128 every 128ns), and the shift value was 32, that meant
> > the multiplier value had to be 2^32, which won't fit in an unsigned
> > long on 32-bit. The same problem would arise on any platform where
> > the timebase frequency was 1GHz or more (not that we actually have any
> > such machines today).
>
> do you still have a 601 running somewhere?
On my desk :-) (and he also has a 601 card for the 7500 iirc)
/me remembers to revive his dual 604 8500 one of these days.
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Make clockevents work on PPC601 processors
2007-10-11 14:12 ` Kumar Gala
2007-10-11 20:58 ` Benjamin Herrenschmidt
@ 2007-10-11 22:26 ` Paul Mackerras
1 sibling, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2007-10-11 22:26 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
Kumar Gala writes:
> do you still have a 601 running somewhere?
Yes, I still have the original 601 cpu card for my PowerMac 7500. :)
Paul.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-11 22:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-11 11:46 [PATCH] Make clockevents work on PPC601 processors Paul Mackerras
2007-10-11 14:12 ` Kumar Gala
2007-10-11 20:58 ` Benjamin Herrenschmidt
2007-10-11 22:26 ` Paul Mackerras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).