From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] ARM: twd: Add context save restore support
Date: Tue, 25 Jan 2011 10:32:31 +0000 [thread overview]
Message-ID: <20110125103231.GD11507@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <AANLkTikLDamkp9TgnWRESyx4=698D4NXP=W_M9=abfax@mail.gmail.com>
On Mon, Jan 24, 2011 at 11:39:13PM -0800, Colin Cross wrote:
> On Mon, Jan 24, 2011 at 3:11 AM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > On Mon, Jan 24, 2011 at 11:06:09AM +0000, Russell King - ARM Linux wrote:
> >> On Mon, Jan 24, 2011 at 02:21:17PM +0530, Santosh Shilimkar wrote:
> >> > In CPU low power state, local timer looses its register context. This
> >> > patch adds context save restore hooks which can be used by platforms
> >> > appropriately.
> >>
> >> I thought the whole point of CLOCK_EVT_FEAT_C3STOP was that the generic
> >> timer stuff wouldn't rely on it being kept alive?
> >>
> >> Hmm, it looks like we bypass the clockevents code by only setting the
> >> TWD load value at initialization time, not when we switch to periodic
> >> mode. ?We really ought to rewrite it whenever we switch back to periodic
> >> mode.
> >>
> >> I suspect fixing that means you won't need this save/restore support.
> >
> > Untested, but should do what's required.
> >
> > diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> > index fd91566..60636f4 100644
> > --- a/arch/arm/kernel/smp_twd.c
> > +++ b/arch/arm/kernel/smp_twd.c
> > @@ -36,6 +36,7 @@ static void twd_set_mode(enum clock_event_mode mode,
> > ? ? ? ? ? ? ? ?/* timer load already set up */
> > ? ? ? ? ? ? ? ?ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE
> > ? ? ? ? ? ? ? ? ? ? ? ?| TWD_TIMER_CONTROL_PERIODIC;
> > + ? ? ? ? ? ? ? __raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD);
> > ? ? ? ? ? ? ? ?break;
> > ? ? ? ?case CLOCK_EVT_MODE_ONESHOT:
> > ? ? ? ? ? ? ? ?/* period set, and timer enabled in 'next_event' hook */
> > @@ -81,7 +82,7 @@ int twd_timer_ack(void)
> >
> > ?static void __cpuinit twd_calibrate_rate(void)
> > ?{
> > - ? ? ? unsigned long load, count;
> > + ? ? ? unsigned long count;
> > ? ? ? ?u64 waitjiffies;
> >
> > ? ? ? ?/*
> > @@ -116,10 +117,6 @@ static void __cpuinit twd_calibrate_rate(void)
> > ? ? ? ? ? ? ? ?printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000,
> > ? ? ? ? ? ? ? ? ? ? ? ?(twd_timer_rate / 1000000) % 100);
> > ? ? ? ?}
> > -
> > - ? ? ? load = twd_timer_rate / HZ;
> > -
> > - ? ? ? __raw_writel(load, twd_base + TWD_TIMER_LOAD);
> > ?}
> >
> > ?/*
>
> This doesn't work for oneshot timers if the TWD_TIMER_CONTROL register
> gets reset by cpu idle between twd_set_mode and twd_set_next_event.
> Shadowing ctrl in a percpu variable and rewriting it during every call
> to twd_set_next_event does work, but that's not much different, and a
> little less efficient, than just saving and restoring the control and
> load registers in idle. It does have the advantage that platforms
> don't need any extra calls.
The next question is can we teach the generic time infrastructure about
this so we don't have to modify every clock event driver for it? We
really need to get away from having this kind of knowledge buried down
in the lowest levels of every driver.
next prev parent reply other threads:[~2011-01-25 10:32 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-24 8:51 [PATCH 0/5] ARM: Few patches for PM enablement Santosh Shilimkar
2011-01-24 8:51 ` [PATCH 1/5] ARM: gic: Add hooks for architecture specific extensions Santosh Shilimkar
2011-01-25 3:03 ` Colin Cross
2011-01-25 20:54 ` Colin Cross
2011-01-26 7:22 ` Santosh Shilimkar
2011-01-26 7:23 ` Colin Cross
2011-01-26 7:31 ` Santosh Shilimkar
2011-01-26 7:52 ` Colin Cross
2011-01-26 7:55 ` Santosh Shilimkar
2011-01-24 8:51 ` [PATCH 2/5] ARM: gic: Add distributor and interface enable/disable accessory api Santosh Shilimkar
2011-03-01 5:58 ` Santosh Shilimkar
2011-01-24 8:51 ` [PATCH 3/5] ARM: twd: Add context save restore support Santosh Shilimkar
2011-01-24 11:06 ` Russell King - ARM Linux
2011-01-24 11:11 ` Russell King - ARM Linux
2011-01-24 11:16 ` Santosh Shilimkar
2011-01-25 7:39 ` Colin Cross
2011-01-25 10:32 ` Russell King - ARM Linux [this message]
2011-01-25 13:23 ` Thomas Gleixner
2011-01-25 13:37 ` Russell King - ARM Linux
2011-01-25 13:55 ` Santosh Shilimkar
2011-01-25 14:12 ` Thomas Gleixner
2011-01-25 14:15 ` Russell King - ARM Linux
2011-01-25 14:24 ` Thomas Gleixner
2011-01-25 16:04 ` Santosh Shilimkar
2011-01-25 16:13 ` Russell King - ARM Linux
2011-01-25 16:14 ` Santosh Shilimkar
2011-01-25 11:29 ` Russell King - ARM Linux
2011-01-25 11:40 ` Santosh Shilimkar
2011-01-25 11:48 ` Russell King - ARM Linux
2011-01-25 12:08 ` Santosh Shilimkar
2011-01-25 12:17 ` Russell King - ARM Linux
2011-01-25 12:20 ` Santosh Shilimkar
2011-01-25 18:44 ` Colin Cross
2011-01-24 11:14 ` Santosh Shilimkar
2011-01-24 8:51 ` [PATCH 4/5] ARM: scu: Move register defines to header file Santosh Shilimkar
2011-01-25 11:46 ` Russell King - ARM Linux
2011-01-25 12:02 ` Santosh Shilimkar
2011-01-25 12:16 ` Russell King - ARM Linux
2011-01-25 12:29 ` Russell King - ARM Linux
2011-01-25 12:39 ` Santosh Shilimkar
2011-01-25 12:36 ` Santosh Shilimkar
2011-01-25 12:56 ` Russell King - ARM Linux
2011-01-25 13:04 ` Russell King - ARM Linux
2011-01-25 13:06 ` Russell King - ARM Linux
2011-01-25 18:23 ` Santosh Shilimkar
2011-02-04 10:41 ` Russell King - ARM Linux
2011-02-04 10:46 ` Santosh Shilimkar
2011-02-04 11:30 ` Russell King - ARM Linux
2011-02-04 11:34 ` Santosh Shilimkar
2011-02-07 9:51 ` Santosh Shilimkar
2011-02-07 10:18 ` Russell King - ARM Linux
2011-02-07 10:21 ` Santosh Shilimkar
2011-02-07 10:23 ` Russell King - ARM Linux
2011-02-07 10:30 ` Santosh Shilimkar
2011-02-10 14:49 ` Santosh Shilimkar
2011-02-10 16:13 ` Russell King - ARM Linux
2011-02-10 16:26 ` Santosh Shilimkar
2011-01-25 13:05 ` Santosh Shilimkar
2011-01-25 13:41 ` Russell King - ARM Linux
2011-01-25 13:47 ` Santosh Shilimkar
2011-01-24 8:51 ` [PATCH 5/5] ARM: smp: Skip secondary cpu calibration to speed-up boot Santosh Shilimkar
2011-01-24 10:30 ` Russell King - ARM Linux
2011-01-24 8:51 ` Santosh Shilimkar
2011-01-24 8:55 ` Santosh Shilimkar
2011-02-04 10:19 ` [PATCH 0/5] ARM: Few patches for PM enablement Santosh Shilimkar
2011-02-11 14:24 ` Santosh Shilimkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110125103231.GD11507@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).