linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* twi/isync/nop sequence in newer ppc linux kernels
@ 2004-01-08 16:39 Ronald Wahl
  2004-01-08 23:42 ` Paul Mackerras
  0 siblings, 1 reply; 2+ messages in thread
From: Ronald Wahl @ 2004-01-08 16:39 UTC (permalink / raw)
  To: linuxppc-dev


Hi,

I'm programming an embedded device (with PPC405GP/EP) that has to access the
pci bus and there may be cases that there is no one listening there and a
timeout occurs which results in a machine check. Until now I used a eieio
operation with an exception handler after the actual io operation and this
seems to work. Current kernels contain a twi/isync/nop sequence. What are
the reasons for this sequence instead of an eieio? Is it only needed on
some processors? Is there a document that describes this special
sequence in more detail?

Thanks in advance,
Ronald

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

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

* Re: twi/isync/nop sequence in newer ppc linux kernels
  2004-01-08 16:39 twi/isync/nop sequence in newer ppc linux kernels Ronald Wahl
@ 2004-01-08 23:42 ` Paul Mackerras
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mackerras @ 2004-01-08 23:42 UTC (permalink / raw)
  To: Ronald Wahl; +Cc: linuxppc-dev


Ronald Wahl writes:

> I'm programming an embedded device (with PPC405GP/EP) that has to access the
> pci bus and there may be cases that there is no one listening there and a
> timeout occurs which results in a machine check. Until now I used a eieio
> operation with an exception handler after the actual io operation and this
> seems to work. Current kernels contain a twi/isync/nop sequence. What are
> the reasons for this sequence instead of an eieio? Is it only needed on
> some processors? Is there a document that describes this special
> sequence in more detail?

The sequence was determined experimentally.  The 601 was the worst in
terms of containing where the machine check would happen after a bad
access.  The idea is that the twi is intended to create a dependency
on the value read, such that the processor doesn't know if the
instruction will generate an exception until the data comes back (in
fact the particular form of the twi instruction that I use won't ever
generate an exception, but fortunately the 601 isn't smart enough to
recognize that).  The isync is then meant to stop the cpu until all
previous instructions have been executed to the point where the cpu
knows whether they will generate an exception or not.  The nop is
there because the machine check can still occur on the instruction
after the isync on 601 (IIRC).

As I recall, the 604 was better but still needed more than just an
eieio or sync, and the G3 and G4 just needed an eieio or sync.

Paul.

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

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

end of thread, other threads:[~2004-01-08 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-08 16:39 twi/isync/nop sequence in newer ppc linux kernels Ronald Wahl
2004-01-08 23:42 ` Paul Mackerras

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