linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Justin Hibbits <chmeeedalf@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: PowerMac PMU programming
Date: Tue, 12 Jun 2012 22:40:41 -0400	[thread overview]
Message-ID: <20120612224041.0a32965b@narn.knownspace> (raw)
In-Reply-To: <1339449862.9220.13.camel@pasglop>

On Tue, 12 Jun 2012 07:24:22 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Sun, 2012-06-10 at 23:31 -0400, Justin Hibbits wrote:
> 
> > I'll settle on just getting the CPU speed change working, losing
> > 333MHz on my TiBook is a few too many MHz for the poor thing to
> > lose :)  I do have a desktop, but that's my development platform,
> > so needs to be at least somewhat stable, so my TiBook is my guinea
> > pig.
> > 
> > I've googled everything I can think of, but do you know of any
> > definitive PMU documentation?  Or can you give me any hints on
> > what's needed just for that simple operation?
> 
> No doco no, Darwin and Linux source code are your best bet.
> 
> It works like sleep as in: you send the switch command and the PMU
> will reboot the processor with the new frequency whenever the
> processor enters NAP mode.
> 
> This is tricky because there's a loss of cache coherency vs. ongoing
> DMAs, hence tricky bits of code in there to deal with the various
> caches.
> 
> > I noticed that you wind down the ADB queue before killing the PMU.
> > Is this necessary?  I only disable the interrupt by writing 0x10 to
> > the IER, but our interrupt model for the PMU is different from the
> > Linux one. 
> 
> Well that will not disable CB1 (or the external GPIO one). You need to
> make sure no other communication with the PMU takes place once you've
> sent the sleep command and until you're back.

I disable interrupts on the CPU first thing right now with a kernel spin
lock, and don't restore them until I'm ready to return from the speed
switch, so the only communication that should be taking place is what
happens in my thread -- I may be missing something here during the
reset, so I'll have to go over it with a fine-toothed comb, this may be
the wrong thing for me to do.

> >  Is it also necessary to disable the interrupt input, even though
> > the register write should be disabling the PMU's asserting of the
> > line?  There doesn't seem to be much more different than that, and
> > setting the openpic priority, Linux sets it to 0x0f but I didn't see
> > anything in OS X doing that (might that be a problem, too?)
> > 
> > I would love to get my TiBook using the full 1GHz.
> 
> I don't remember what openpic does in Darwin, I think interrupts are
> all masked there as a side effect of the code in KeyLargo.cpp but I'm
> not sure that applies to frequency changes.
> 
> Cheers,
> Ben.
> 
> 

Thanks for all this, it's really helping me understand what needs to
happen.  When I get some free time I'll take a closer look at what I'm
doing and try to fix it with your comments.

Thanks
- Justin

  reply	other threads:[~2012-06-13  2:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-10 13:29 PowerMac PMU programming Justin Hibbits
2012-06-10 23:03 ` Benjamin Herrenschmidt
2012-06-11  3:31   ` Justin Hibbits
2012-06-11 21:24     ` Benjamin Herrenschmidt
2012-06-13  2:40       ` Justin Hibbits [this message]
2012-10-21  2:56       ` Justin Hibbits

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=20120612224041.0a32965b@narn.knownspace \
    --to=chmeeedalf@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.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).