linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* the ppc_n_lost_interrupts thing...
@ 2000-01-28  2:35 Jun Sun
  2000-01-28 10:21 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Jun Sun @ 2000-01-28  2:35 UTC (permalink / raw)
  To: linuxppc-dev


Hi, all,

I am a newbie to PowerPC-linux.  Hopefully this question is
not too dumb.

When I looked into the interrupt related code in ppc-linux,
I got totally confused by the "ppc_n_lost_interrupts"
variable.

Here is the comment from pmac_pic.c file :

        /*
         * Unfortunately, setting the bit in the enable register
         * when the device interrupt is already on *doesn't* set
         * the bit in the flag register or request another
interrupt.
         */

>From this, I can infer that ppc_n_lost_interrupts is used to
"fake" a new interrupt at the end of an interrupt handling.
However,
what I don't understand is - how could this possibly detect an
interrupt that happens while the CPU is blocking external
interrupt?
In this case, ppc_n_lost_interrupts won't be incremented and when
the external interrupt is re-enabled, we won't be able to get
into interrupt mode.

That does not sound right to me.  Could someone shed a light on
this whole "ppc_n_lost_interrupt" thing?  Thanks in advance.


Jun

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: the ppc_n_lost_interrupts thing...
  2000-01-28  2:35 the ppc_n_lost_interrupts thing Jun Sun
@ 2000-01-28 10:21 ` Benjamin Herrenschmidt
  2000-02-02 23:38   ` Jun Sun
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2000-01-28 10:21 UTC (permalink / raw)
  To: Jun Sun, linuxppc-dev


On Thu, Jan 27, 2000, Jun Sun <jsun@mvista.com> wrote:

>I am a newbie to PowerPC-linux.  Hopefully this question is
>not too dumb.

Definitely not ;) Here's my understanding:

>From this, I can infer that ppc_n_lost_interrupts is used to
>"fake" a new interrupt at the end of an interrupt handling.

That's it.

>However,
>what I don't understand is - how could this possibly detect an
>interrupt that happens while the CPU is blocking external
>interrupt?
>In this case, ppc_n_lost_interrupts won't be incremented and when
>the external interrupt is re-enabled, we won't be able to get
>into interrupt mode.

The interrupt will be lost only when it's masked in the controller while
beeing issued by the device. It's a PIC bug.

So, we need to check it out only when unmasking the interrupt -in the
controller-. That's what we do in pmac-pic.c. If interrupts are masked on
the CPU but not on the controller, they are not lost. If they are masked
in both, it's not a problem neither, at least until someone tries to
umask one in the controller.

Note that our implementation if restore_flags() will check
lost_interrupts since the unmask call can be done while MSR_EE is 0.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: the ppc_n_lost_interrupts thing...
  2000-01-28 10:21 ` Benjamin Herrenschmidt
@ 2000-02-02 23:38   ` Jun Sun
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Sun @ 2000-02-02 23:38 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev


Benjamin Herrenschmidt wrote:
> >However,
> >what I don't understand is - how could this possibly detect an
> >interrupt that happens while the CPU is blocking external
> >interrupt?
> >In this case, ppc_n_lost_interrupts won't be incremented and when
> >the external interrupt is re-enabled, we won't be able to get
> >into interrupt mode.
>
> The interrupt will be lost only when it's masked in the controller while
> beeing issued by the device. It's a PIC bug.
>

Hmm, I assume that not every power pc board would have this problem.
Which PIC is having this problem?  The one used in Mac?

If this is the case, it would be nice that the workaround code can be
put in the #ifdef scope.  Just a thought.

> So, we need to check it out only when unmasking the interrupt -in the
> controller-. That's what we do in pmac-pic.c. If interrupts are masked on
> the CPU but not on the controller, they are not lost. If they are masked
> in both, it's not a problem neither, at least until someone tries to
> umask one in the controller.
>
> Note that our implementation if restore_flags() will check
> lost_interrupts since the unmask call can be done while MSR_EE is 0.
>

Thanks a lot.  I got it.

Jun

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2000-02-02 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-01-28  2:35 the ppc_n_lost_interrupts thing Jun Sun
2000-01-28 10:21 ` Benjamin Herrenschmidt
2000-02-02 23:38   ` Jun Sun

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