linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ppc LE questions (seeking help hand info pointers)
@ 2001-09-20 15:42 Mark Salisbury
  2001-09-20 15:58 ` Tom Rini
                   ` (3 more replies)
  0 siblings, 4 replies; 39+ messages in thread
From: Mark Salisbury @ 2001-09-20 15:42 UTC (permalink / raw)
  To: linuxppc-dev


I am familiar with the fact that little endian ppc linux is an unpopular
concept, but I would like to discuss it and ask a few questions about it
anyway. I do _NOT_ want to start a flame war, so if you feel the need to
flame me for this, pleas flame me directly offline and do not pollute
the list.


assume I have a valid reason for wanting to run ppc's in LE mode

assume I already have a (non-linux) ppc OS running LE mode (actually
compiles and runs in either mode, which you run depends on which flavor
of our hardware you use)  the differences in the code are limited to a
few header files, some startup code and some context switch code.
(to get an idea of the hardware see www.mc.com)

assume I am also aware of the limitations of the chip in LE mode, and
the intended target is 7400+ processors

question 1.  are there already existing patch sets (rejected from
mainline inclusion) available for use as a starting point?

question 2.  if 1, what is the primary reason for rejection.

question 3.  is there a general issue of endian safety in linux (I would
think not) or just in the ppc-specific code?

question 4. assuming I was willing to deliver a clean, complete LE
enabling patch (including devices that are relevant to me), as a compile
time config option and maintain that patch, what would be the primary
obstacle to inclusion in the main line.

thanks for your time,

		Mark

--
/*------------------------------------------------**
**   Mark Salisbury | Mercury Computer Systems    **
**   mbs@mc.com     | System OS - Kernel Team     **
**------------------------------------------------*/


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

^ permalink raw reply	[flat|nested] 39+ messages in thread
* Re: ppc LE questions (seeking help hand info pointers)
@ 2001-09-21  5:28 Albert D. Cahalan
  2001-09-21  6:10 ` Dan Malek
  0 siblings, 1 reply; 39+ messages in thread
From: Albert D. Cahalan @ 2001-09-21  5:28 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: dan, mbs


Dan Malek writes:

> Another technical reason is as the processor family moves forward,
> less and less little endian support is provided. In the case of
> the 7450, there are instructions that trap to the kernel to be
> emulated in LE mode, that are executed in the core in BE mode.

Quit spreading FUD. The 7450 has _better_ LE support than the 7400
and 7410 did. With the 7450, misaligned LE memory operations now
perform just as well as misaligned BE memory operations.

I checked the errata too. Total BE/LE differences I found:


1. TLBMISS always has a BE address. Motorola's example code for
   software TLB reloads has a "xori" instruction to deal with this.

2. No string/multi load/store instructions in LE mode.
   According to Motorola's 32-bit arch book, these instructions
   are expected to be slow anyway. (They sure aren't RISC!)
   Indeed, the 7450 doesn't handle them well even in BE mode.

3. The MPC106 chip ("Grackle" host bridge) won't work.

4. The MPC107 chip (another host bridge) won't tolerate unaligned data.

5. LE mode enables address munging. :-)

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

^ permalink raw reply	[flat|nested] 39+ messages in thread
* Re: ppc LE questions (seeking help hand info pointers)
@ 2001-09-21 18:48 Albert D. Cahalan
  2001-09-22  0:22 ` Timothy A. Seufert
  2001-09-22 14:23 ` Holger Bettag
  0 siblings, 2 replies; 39+ messages in thread
From: Albert D. Cahalan @ 2001-09-21 18:48 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: dan, hobold, tas, nicoya


It is clear to me that most people don't truly understand the
implications of address munging when running the PowerPC in
little-endian mode. I'll try to explain.

The important point: motherboards make all the difference

On a Mac, you have a big-endian CPU crudely connected to the
little-endian PCI bus. You have to swap bytes. If you put the
CPU into little-endian mode, you end up with big-endian data
going to the wrong addresses. Everything looks little-endian
to the CPU, but PCI now needs address anti-munging in addition
to the byte swapping that the ppc port already does. Badness!
(though a little-endian user-space would be fine with this)

Now do an unconditional 64-bit byte swap on the motherboard.
Consider an array of four __u16 values affected by this.
They get converted from big-endian to little-endian, and they
get moved to different addresses. Excellent! All the weirdness
just cancels out, giving perfect little-endian. This works for
8-bit, 16-bit, 32-bit, and 64-bit data. Life is good.
For correct PCI operation, just disable the byte swapping
currently done by the IO access macros. Drivers will work.

Given a little-endian motherboard (reversed byte lanes), running
the CPU in the normal big-endian mode would require the same
sort of anti-munging that you'd need for little-endian on a Mac.

To make this extra clear, I'll explain why the Mac doesn't do
motherboard-based swapping for PCI. Apple had to run the ppc
in big-endian mode to keep 680x0 developers happy, to help with
680x0 emulation, and maybe to work well with NuBUS. The PCI host
bridge won't always be aware of data sizes due to write combining
and compiler optimization, so it can't fix things nicely. Apple
could have done an unconditional 64-bit swap, fixing the byte
order while screwing up the addresses... eh, why bother?

Thus one should run the CPU in little-endian mode if and only
if one has a motherboard that does an unconditional 64-bit swap.

Mark does have such a motherboard, and does have the toolchain.
So, no need to hassle him about the need for LE or his ability
to compile stuff correctly.

Changes needed for 75x0 chips on little-endian motherboards:

1. new MSR values
2. load the whole MSR, not just the lower half
3. a way to disable the PCI byte swapping that the ppc port does
4. a "xori" instruction if using the 7450's software TLB reload
5. removal of crummy load/store string/multiple instructions
6. write page table entries with a 64-bit write, or word swap

Changes needed for the 405 chip, AFAIK:

1. a way to disable the PCI byte swapping that the ppc port does
2. one bit different in the TLB entries

Changes needed for 75x0 chips on the Mac, if feeling insane:

1. new MSR values
2. load the whole MSR, not just the lower half
3. PCI address anti-munging (keep existing byte swap too)
4. a "xori" instruction if using the 7450's software TLB reload
5. removal of crummy load/store string/multiple instructions
6. write page table entries with a 64-bit write, or word swap


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

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

end of thread, other threads:[~2001-09-28  6:37 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-20 15:42 ppc LE questions (seeking help hand info pointers) Mark Salisbury
2001-09-20 15:58 ` Tom Rini
2001-09-20 16:07   ` Geert Uytterhoeven
2001-09-20 16:12     ` Tom Rini
2001-09-20 17:10       ` Brad Boyer
2001-09-20 18:32         ` Mark Salisbury
2001-09-20 19:29           ` Holger Bettag
2001-09-20 19:35             ` David Edelsohn
2001-09-20 20:19             ` Mark Salisbury
2001-09-21  1:46               ` Timothy A. Seufert
2001-09-21  3:54                 ` Dan Malek
2001-09-21  7:24                   ` Geert Uytterhoeven
2001-09-21  7:47                     ` Dan Malek
2001-09-21  7:50                       ` Geert Uytterhoeven
2001-09-21  8:19                         ` Dan Malek
2001-09-21 17:01                   ` Ralph Blach
2001-09-21 17:35                     ` David Edelsohn
2001-09-21 18:58                     ` David Edelsohn
2001-09-21 20:22                     ` Dan Malek
2001-09-21 20:29                     ` Benjamin Herrenschmidt
2001-09-21 20:42                       ` Benjamin Herrenschmidt
2001-09-21  7:22                 ` Geert Uytterhoeven
2001-09-21  9:26               ` keyb Giuliano Pochini
2001-09-21 10:38             ` ppc LE questions (seeking help hand info pointers) Ralph Blach
2001-09-20 20:01           ` Tony Mantler
2001-09-20 18:28   ` Mark Salisbury
2001-09-20 19:12     ` Tom Rini
2001-09-20 22:22 ` Dan Malek
2001-09-21  5:45 ` Troy Benjegerdes
2001-09-28  6:37 ` Paul Mackerras
  -- strict thread matches above, loose matches on Subject: below --
2001-09-21  5:28 Albert D. Cahalan
2001-09-21  6:10 ` Dan Malek
2001-09-21 10:59   ` Ralph Blach
2001-09-21 18:48 Albert D. Cahalan
2001-09-22  0:22 ` Timothy A. Seufert
2001-09-22 20:06   ` Albert D. Cahalan
2001-09-24 17:10   ` Mark Salisbury
2001-09-22 14:23 ` Holger Bettag
2001-09-22 20:26   ` Timothy A. Seufert

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