* [PATCH] powerpc: Disable external interrupts in bootwrapper
@ 2007-03-27 22:28 Mark A. Greer
2007-03-27 23:43 ` Paul Mackerras
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Mark A. Greer @ 2007-03-27 22:28 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
Disable external interrupts very early in the bootwrapper in case
the firmware left a device generating interrupts.
Signed-off-by: Mark A. Greer <mgreer@mvista.com>
---
crt0.S | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 3dc8d8f..f048a46 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -23,6 +23,12 @@ _zimage_start:
and the address where we're running. */
bl 1f
1: mflr r0
+ li r9,(1<<15)@l /* Disable external intrs (clear MSR[EE]) */
+ mfmsr r10
+ andc r10,r10,r9
+ sync
+ mtmsr r10
+ isync
lis r9,1b@ha
addi r9,r9,1b@l
subf. r0,r9,r0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-27 22:28 [PATCH] powerpc: Disable external interrupts in bootwrapper Mark A. Greer
@ 2007-03-27 23:43 ` Paul Mackerras
2007-03-28 0:12 ` Mark A. Greer
2007-03-28 1:05 ` Geoff Levand
2007-04-10 22:37 ` Mark A. Greer
2 siblings, 1 reply; 12+ messages in thread
From: Paul Mackerras @ 2007-03-27 23:43 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev
Mark A. Greer writes:
> Disable external interrupts very early in the bootwrapper in case
> the firmware left a device generating interrupts.
Sounds reasonable, except that I wonder if systems running under a
real OF want to do this...
> + li r9,(1<<15)@l /* Disable external intrs (clear MSR[EE]) */
That will actually get us ffff8000 in r9.
> + mfmsr r10
> + andc r10,r10,r9
I suggest this sequence instead:
mfmsr r10
rlwinm r10,r10,0,~(1<<15) /* clear MSR_EE */
Paul.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-27 23:43 ` Paul Mackerras
@ 2007-03-28 0:12 ` Mark A. Greer
2007-03-28 0:28 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 12+ messages in thread
From: Mark A. Greer @ 2007-03-28 0:12 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On Wed, Mar 28, 2007 at 09:43:07AM +1000, Paul Mackerras wrote:
> Mark A. Greer writes:
>
> > Disable external interrupts very early in the bootwrapper in case
> > the firmware left a device generating interrupts.
>
> Sounds reasonable, except that I wonder if systems running under a
> real OF want to do this...
I don't know. Would someone who knows OF speak up?
> > + li r9,(1<<15)@l /* Disable external intrs (clear MSR[EE]) */
>
> That will actually get us ffff8000 in r9.
Oops.
> > + mfmsr r10
> > + andc r10,r10,r9
>
> I suggest this sequence instead:
>
> mfmsr r10
> rlwinm r10,r10,0,~(1<<15) /* clear MSR_EE */
That works. Respin in a bit.
Thanks,
Mark
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-28 0:12 ` Mark A. Greer
@ 2007-03-28 0:28 ` Benjamin Herrenschmidt
2007-03-28 1:03 ` Mark A. Greer
2007-03-28 16:52 ` Segher Boessenkool
0 siblings, 2 replies; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2007-03-28 0:28 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev, Paul Mackerras
On Tue, 2007-03-27 at 17:12 -0700, Mark A. Greer wrote:
> On Wed, Mar 28, 2007 at 09:43:07AM +1000, Paul Mackerras wrote:
> > Mark A. Greer writes:
> >
> > > Disable external interrupts very early in the bootwrapper in case
> > > the firmware left a device generating interrupts.
> >
> > Sounds reasonable, except that I wonder if systems running under a
> > real OF want to do this...
>
> I don't know. Would someone who knows OF speak up?
OF isn't supposed to use external interrupts but I wouldn't bet on what
Apple's one does... I think it's not safe to do that thus on OF based
platforms.
Ben.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-28 0:28 ` Benjamin Herrenschmidt
@ 2007-03-28 1:03 ` Mark A. Greer
2007-03-28 1:26 ` David Gibson
2007-03-28 16:52 ` Segher Boessenkool
1 sibling, 1 reply; 12+ messages in thread
From: Mark A. Greer @ 2007-03-28 1:03 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras
On Wed, Mar 28, 2007 at 10:28:55AM +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2007-03-27 at 17:12 -0700, Mark A. Greer wrote:
> > On Wed, Mar 28, 2007 at 09:43:07AM +1000, Paul Mackerras wrote:
> > > Mark A. Greer writes:
> > >
> > > > Disable external interrupts very early in the bootwrapper in case
> > > > the firmware left a device generating interrupts.
> > >
> > > Sounds reasonable, except that I wonder if systems running under a
> > > real OF want to do this...
> >
> > I don't know. Would someone who knows OF speak up?
>
> OF isn't supposed to use external interrupts but I wouldn't bet on what
> Apple's one does... I think it's not safe to do that thus on OF based
> platforms.
Hrm...crap. This may be a case where I need my own crt0.S then.
Thanks Ben,
Mark
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-27 22:28 [PATCH] powerpc: Disable external interrupts in bootwrapper Mark A. Greer
2007-03-27 23:43 ` Paul Mackerras
@ 2007-03-28 1:05 ` Geoff Levand
2007-03-28 1:34 ` Mark A. Greer
2007-03-28 16:57 ` Segher Boessenkool
2007-04-10 22:37 ` Mark A. Greer
2 siblings, 2 replies; 12+ messages in thread
From: Geoff Levand @ 2007-03-28 1:05 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev, Paul Mackerras
Mark A. Greer wrote:
> Disable external interrupts very early in the bootwrapper in case
> the firmware left a device generating interrupts.
This is just a guess at what is happening, but I think the OF on my
G5 uses the timer interrupt as a kind of watchdog timer, so that if
the loaded code hangs, OF will regain control. If you disable
interrupts, you may loose this functionality.
-Geoff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-28 1:03 ` Mark A. Greer
@ 2007-03-28 1:26 ` David Gibson
2007-03-28 1:34 ` Mark A. Greer
0 siblings, 1 reply; 12+ messages in thread
From: David Gibson @ 2007-03-28 1:26 UTC (permalink / raw)
To: Mark A. Greer; +Cc: Paul Mackerras, linuxppc-dev
On Tue, Mar 27, 2007 at 06:03:05PM -0700, Mark A. Greer wrote:
> On Wed, Mar 28, 2007 at 10:28:55AM +1000, Benjamin Herrenschmidt wrote:
> > On Tue, 2007-03-27 at 17:12 -0700, Mark A. Greer wrote:
> > > On Wed, Mar 28, 2007 at 09:43:07AM +1000, Paul Mackerras wrote:
> > > > Mark A. Greer writes:
> > > >
> > > > > Disable external interrupts very early in the bootwrapper in case
> > > > > the firmware left a device generating interrupts.
> > > >
> > > > Sounds reasonable, except that I wonder if systems running under a
> > > > real OF want to do this...
> > >
> > > I don't know. Would someone who knows OF speak up?
> >
> > OF isn't supposed to use external interrupts but I wouldn't bet on what
> > Apple's one does... I think it's not safe to do that thus on OF based
> > platforms.
>
> Hrm...crap. This may be a case where I need my own crt0.S then.
We could do some more weak symbol magic to make it an option in the
crt0.S, like the BSS stack.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-28 1:26 ` David Gibson
@ 2007-03-28 1:34 ` Mark A. Greer
0 siblings, 0 replies; 12+ messages in thread
From: Mark A. Greer @ 2007-03-28 1:34 UTC (permalink / raw)
To: Mark A. Greer, Benjamin Herrenschmidt, linuxppc-dev,
Paul Mackerras
On Wed, Mar 28, 2007 at 11:26:22AM +1000, David Gibson wrote:
> On Tue, Mar 27, 2007 at 06:03:05PM -0700, Mark A. Greer wrote:
> > On Wed, Mar 28, 2007 at 10:28:55AM +1000, Benjamin Herrenschmidt wrote:
> > > On Tue, 2007-03-27 at 17:12 -0700, Mark A. Greer wrote:
> > > > On Wed, Mar 28, 2007 at 09:43:07AM +1000, Paul Mackerras wrote:
> > > > > Mark A. Greer writes:
> > > > >
> > > > > > Disable external interrupts very early in the bootwrapper in case
> > > > > > the firmware left a device generating interrupts.
> > > > >
> > > > > Sounds reasonable, except that I wonder if systems running under a
> > > > > real OF want to do this...
> > > >
> > > > I don't know. Would someone who knows OF speak up?
> > >
> > > OF isn't supposed to use external interrupts but I wouldn't bet on what
> > > Apple's one does... I think it's not safe to do that thus on OF based
> > > platforms.
> >
> > Hrm...crap. This may be a case where I need my own crt0.S then.
>
> We could do some more weak symbol magic to make it an option in the
> crt0.S, like the BSS stack.
Yeah, that would be nice. Other than not clearing MSR[EE], the current
crt0.S is works for me. A little hook or somesuch there would be nice
so I don't have to duplicate the rest of crt0.S.
Mark
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-28 1:05 ` Geoff Levand
@ 2007-03-28 1:34 ` Mark A. Greer
2007-03-28 16:57 ` Segher Boessenkool
1 sibling, 0 replies; 12+ messages in thread
From: Mark A. Greer @ 2007-03-28 1:34 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev, Paul Mackerras
On Tue, Mar 27, 2007 at 06:05:11PM -0700, Geoff Levand wrote:
> Mark A. Greer wrote:
> > Disable external interrupts very early in the bootwrapper in case
> > the firmware left a device generating interrupts.
>
> This is just a guess at what is happening, but I think the OF on my
> G5 uses the timer interrupt as a kind of watchdog timer, so that if
> the loaded code hangs, OF will regain control. If you disable
> interrupts, you may loose this functionality.
Ah, okay.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-28 0:28 ` Benjamin Herrenschmidt
2007-03-28 1:03 ` Mark A. Greer
@ 2007-03-28 16:52 ` Segher Boessenkool
1 sibling, 0 replies; 12+ messages in thread
From: Segher Boessenkool @ 2007-03-28 16:52 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras
>>>> Disable external interrupts very early in the bootwrapper in case
>>>> the firmware left a device generating interrupts.
>>>
>>> Sounds reasonable, except that I wonder if systems running under a
>>> real OF want to do this...
>>
>> I don't know. Would someone who knows OF speak up?
>
> OF isn't supposed to use external interrupts
That isn't a hard rule. But yeah, hardly any OF
will ever use interrupts for normal operation --
the kernel can have taken control of the exception
vector and still want to access devices via OF, for
example.
> but I wouldn't bet on what
> Apple's one does... I think it's not safe to do that thus on OF based
> platforms.
Until you take control of the external interrupt and
decrementer interrupt (and overtemp interrupt, on
some CPUs), you really shouldn't turn off the EE bit
for extended periods of time.
Set EE=0 right before the earliest of a) you want OF
to be dead dead dead; or b) you copy the kernel's
exception vectors to 0; and all will be fine.
Segher
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-28 1:05 ` Geoff Levand
2007-03-28 1:34 ` Mark A. Greer
@ 2007-03-28 16:57 ` Segher Boessenkool
1 sibling, 0 replies; 12+ messages in thread
From: Segher Boessenkool @ 2007-03-28 16:57 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev, Paul Mackerras
>> Disable external interrupts very early in the bootwrapper in case
>> the firmware left a device generating interrupts.
>
> This is just a guess at what is happening, but I think the OF on my
> G5 uses the timer interrupt as a kind of watchdog timer, so that if
> the loaded code hangs, OF will regain control. If you disable
> interrupts, you may loose this functionality.
Apple OF uses the decrementer to implement all kinds of
alarms. Calling "quiesce" will shut off EE. Shutting
it off manually before that might result in weird behaviour.
Segher
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] powerpc: Disable external interrupts in bootwrapper
2007-03-27 22:28 [PATCH] powerpc: Disable external interrupts in bootwrapper Mark A. Greer
2007-03-27 23:43 ` Paul Mackerras
2007-03-28 1:05 ` Geoff Levand
@ 2007-04-10 22:37 ` Mark A. Greer
2 siblings, 0 replies; 12+ messages in thread
From: Mark A. Greer @ 2007-04-10 22:37 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev, Paul Mackerras
On Tue, Mar 27, 2007 at 03:28:40PM -0700, Mark A. Greer wrote:
> Disable external interrupts very early in the bootwrapper in case
> the firmware left a device generating interrupts.
>
> Signed-off-by: Mark A. Greer <mgreer@mvista.com>
> ---
>
> crt0.S | 6 ++++++
> 1 file changed, 6 insertions(+)
> ---
>
> diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
> index 3dc8d8f..f048a46 100644
> --- a/arch/powerpc/boot/crt0.S
> +++ b/arch/powerpc/boot/crt0.S
> @@ -23,6 +23,12 @@ _zimage_start:
> and the address where we're running. */
> bl 1f
> 1: mflr r0
> + li r9,(1<<15)@l /* Disable external intrs (clear MSR[EE]) */
> + mfmsr r10
> + andc r10,r10,r9
> + sync
> + mtmsr r10
> + isync
> lis r9,1b@ha
> addi r9,r9,1b@l
> subf. r0,r9,r0
Paul,
Just in case there is any doubt, please ignore this patch.
I can do what I need to do from my platform file.
Mark
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-04-10 22:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-27 22:28 [PATCH] powerpc: Disable external interrupts in bootwrapper Mark A. Greer
2007-03-27 23:43 ` Paul Mackerras
2007-03-28 0:12 ` Mark A. Greer
2007-03-28 0:28 ` Benjamin Herrenschmidt
2007-03-28 1:03 ` Mark A. Greer
2007-03-28 1:26 ` David Gibson
2007-03-28 1:34 ` Mark A. Greer
2007-03-28 16:52 ` Segher Boessenkool
2007-03-28 1:05 ` Geoff Levand
2007-03-28 1:34 ` Mark A. Greer
2007-03-28 16:57 ` Segher Boessenkool
2007-04-10 22:37 ` Mark A. Greer
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).