linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [POWERPC] fix cell pmu initialisation
@ 2006-12-05  4:54 Stephen Rothwell
  2006-12-05 13:34 ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2006-12-05  4:54 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: ppc-dev, paulus

Make sure that the pmu is not initialised unless we are running on a cell.
Also make the init routine static.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/cell/pmu.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

After this patch, a combined kernel (including all the 64 bit platforms)
will boot on my Series P 285 (apart from a ata panic which may be
unrelated).

This should be safe for 2.6.20 (I think).
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c
index 99c6120..d04ae16 100644
--- a/arch/powerpc/platforms/cell/pmu.c
+++ b/arch/powerpc/platforms/cell/pmu.c
@@ -382,11 +382,14 @@ static irqreturn_t cbe_pm_irq(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-int __init cbe_init_pm_irq(void)
+static int __init cbe_init_pm_irq(void)
 {
 	unsigned int irq;
 	int rc, node;
 
+	if (!machine_is(cell))
+		return 0;
+
 	for_each_node(node) {
 		irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI |
 					       (node << IIC_IRQ_NODE_SHIFT));
-- 
1.4.4.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [POWERPC] fix cell pmu initialisation
  2006-12-05  4:54 [POWERPC] fix cell pmu initialisation Stephen Rothwell
@ 2006-12-05 13:34 ` Arnd Bergmann
  2006-12-05 20:07   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2006-12-05 13:34 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev, paulus

On Tuesday 05 December 2006 05:54, Stephen Rothwell wrote:
> -int __init cbe_init_pm_irq(void)
> +static int __init cbe_init_pm_irq(void)
> =A0{
> =A0=A0=A0=A0=A0=A0=A0=A0unsigned int irq;
> =A0=A0=A0=A0=A0=A0=A0=A0int rc, node;
> =A0
> +=A0=A0=A0=A0=A0=A0=A0if (!machine_is(cell))
> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return 0;
> +

This looks like a working fix at the moment, but it will break if we
add machine more descriptions have these registers.

I see three options here how to solve this:

1. export a method from cbe_regs.c to find out whether the pmd=20
   regs are available and test that in cbe_init_pm_irq().
2. take you patch as is, with a comment hinting to fix it up
   when needed.
3. change cbe_init_pm_irq to be called explicitly from cbe_regs_init(),
   which already scans the device tree correctly.

	Arnd <><

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [POWERPC] fix cell pmu initialisation
  2006-12-05 13:34 ` Arnd Bergmann
@ 2006-12-05 20:07   ` Benjamin Herrenschmidt
  2006-12-05 22:21     ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-05 20:07 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Stephen Rothwell, paulus, ppc-dev


> 1. export a method from cbe_regs.c to find out whether the pmd 
>    regs are available and test that in cbe_init_pm_irq().
> 2. take you patch as is, with a comment hinting to fix it up
>    when needed.
> 3. change cbe_init_pm_irq to be called explicitly from cbe_regs_init(),
>    which already scans the device tree correctly.

cbe_regs_init() is called from setup_arch(), which is _very_ early.

cbe_init_pm_irq() must be called much later as it requests irqs.

Right now, we should stick to the machine_is() solution. We'll look into
doing something better eventually when the need occurs.

Ben.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [POWERPC] fix cell pmu initialisation
  2006-12-05 20:07   ` Benjamin Herrenschmidt
@ 2006-12-05 22:21     ` Michael Ellerman
  2006-12-05 22:31       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2006-12-05 22:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Stephen Rothwell, paulus, Arnd Bergmann, ppc-dev

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

On Wed, 2006-12-06 at 07:07 +1100, Benjamin Herrenschmidt wrote:
> > 1. export a method from cbe_regs.c to find out whether the pmd 
> >    regs are available and test that in cbe_init_pm_irq().
> > 2. take you patch as is, with a comment hinting to fix it up
> >    when needed.
> > 3. change cbe_init_pm_irq to be called explicitly from cbe_regs_init(),
> >    which already scans the device tree correctly.
> 
> cbe_regs_init() is called from setup_arch(), which is _very_ early.
> 
> cbe_init_pm_irq() must be called much later as it requests irqs.
> 
> Right now, we should stick to the machine_is() solution. We'll look into
> doing something better eventually when the need occurs.

4. Add a FIRMWARE_FEATURE for it.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [POWERPC] fix cell pmu initialisation
  2006-12-05 22:21     ` Michael Ellerman
@ 2006-12-05 22:31       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-05 22:31 UTC (permalink / raw)
  To: michael; +Cc: Stephen Rothwell, paulus, Arnd Bergmann, ppc-dev

On Wed, 2006-12-06 at 09:21 +1100, Michael Ellerman wrote:
> On Wed, 2006-12-06 at 07:07 +1100, Benjamin Herrenschmidt wrote:
> > > 1. export a method from cbe_regs.c to find out whether the pmd 
> > >    regs are available and test that in cbe_init_pm_irq().
> > > 2. take you patch as is, with a comment hinting to fix it up
> > >    when needed.
> > > 3. change cbe_init_pm_irq to be called explicitly from cbe_regs_init(),
> > >    which already scans the device tree correctly.
> > 
> > cbe_regs_init() is called from setup_arch(), which is _very_ early.
> > 
> > cbe_init_pm_irq() must be called much later as it requests irqs.
> > 
> > Right now, we should stick to the machine_is() solution. We'll look into
> > doing something better eventually when the need occurs.
> 
> 4. Add a FIRMWARE_FEATURE for it.

Not sure yet ... it's not really a firmware feature... Let's keep the
machine_is(cell) for now.

Ben.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-12-05 22:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-05  4:54 [POWERPC] fix cell pmu initialisation Stephen Rothwell
2006-12-05 13:34 ` Arnd Bergmann
2006-12-05 20:07   ` Benjamin Herrenschmidt
2006-12-05 22:21     ` Michael Ellerman
2006-12-05 22:31       ` Benjamin Herrenschmidt

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).