Skip to contentSkip to conversation

APUS and IOs question

DISCUSSION Benjamin Herrenschmidt 5 participants 8 messages Nov 5, 2006 – Nov 10, 2006 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Somebody who understands APUS around ?

In include/asm-ppc/io.h, we have a special definition of the PCI IO accessors readw,writew,readl and writel for APUS that don't do byteswap and also don't do barriers.

This seems very bogus to me. Can somebody explain me why it's done that way so I can then explain why it's broken ? :-)

I will remove those definitions soon, so unless I get a very convincing argument of why it has to be done that way on APUS, things might break (APUS-specific drivers relying on those not swapping will have to be fixed).

Ben.

#1 lore raw

Hi,

Quoted 1 line · Benjamin Herrenschmidt

Somebody who understands APUS around ?

I have one, but I don't understand all of it. :-)

Quoted 3 lines

In include/asm-ppc/io.h, we have a special definition of the PCI IO accessors readw,writew,readl and writel for APUS that don't do byteswap and also don't do barriers.

APUS PCI is weird, to say the least. The PCI extension is basically built to accomodate a single PCI device, which happens to be a Permedia2 graphics chip that allows byte-swapped mappings of both register and framebuffer space and is never told to do DMA because nobody knows what kind of interesting effects that would have, so the only synchronisation that is needed is between accesses to the framebuffer and the GPU.

That, and that the 604e+ probably doesn't reorder accesses that much anyway that the barriers would do any good here. :-)

Simon

#2 lore raw
Quoted 2 lines

That, and that the 604e+ probably doesn't reorder accesses that much anyway that the barriers would do any good here. :-)

Is there any reason though to have APUS-specific I/O accessors instead of using the generic stuff (except for perhaps a minor performance hit)?

Segher

#3 lore raw
In reply to Simon Richter
Quoted 19 lines · Simon Richter

Hi,

Quoted 1 line · Benjamin Herrenschmidt

Somebody who understands APUS around ?

I have one, but I don't understand all of it. :-)

Quoted 3 lines

In include/asm-ppc/io.h, we have a special definition of the PCI IO accessors readw,writew,readl and writel for APUS that don't do byteswap and also don't do barriers.

APUS PCI is weird, to say the least. The PCI extension is basically built to accomodate a single PCI device, which happens to be a Permedia2 graphics chip that allows byte-swapped mappings of both register and framebuffer space and is never told to do DMA because nobody knows what kind of interesting effects that would have, so the only synchronisation that is needed is between accesses to the framebuffer and the GPU.

Quoted 2 lines

That, and that the 604e+ probably doesn't reorder accesses that much anyway that the barriers would do any good here. :-)

Still, it annoys me to have an APUS-specific definition of accessors that would otherwise be common to everybody...

Anyway, I decided not to change asm-ppc/io.h, so this will only become an issue if we ever move APUS over to arch/powerpc

Ben.

#8 lore raw
In reply to a message not in the archive

Hi,

Quoted 2 lines · Benjamin Herrenschmidt

Can you give me a proper explanation of the whole memory map story on it so I get a better idea of how invasive handling it would be ?

On APUS systems, you have two (major) kinds of memory, that on the Amiga board and that on the CPU board. The former is generally mapped at address zero, but you don't want to use it except as DMA buffers when talking to the internal hardware (because the internal hardware doesn't see the memory on the CPU board).

The memory on the CPU board is the "main" memory for Linux (because there is more of it, and the access is faster), but its location is assigned dynamically during the boot process, and depends on the size of the memory and on other boards installed.

My plan for moving APUS to arch/powerpc involves writing a new bootloader (I'm currently hacking binutils to support AmigaOS binaries) that builds a proper flattened device tree and calls the kernel, but I'm not sure where the kernel virtual mapping that allows the kernel to run from a fixed address should be set up -- if in the bootloader, the kernel needs to be aware that changing the MMU settings will yield interesting results, and if in the kernel, we need some platform specific init code to handle that.

Simon

#9 lore raw
Quoted 8 lines

My plan for moving APUS to arch/powerpc involves writing a new bootloader (I'm currently hacking binutils to support AmigaOS binaries) that builds a proper flattened device tree and calls the kernel, but I'm not sure where the kernel virtual mapping that allows the kernel to run from a fixed address should be set up -- if in the bootloader, the kernel needs to be aware that changing the MMU settings will yield interesting results, and if in the kernel, we need some platform specific init code to handle that.

Well, the problem is that you basially have to hack the linear mapping, thus hitting anything that relies on __pa/__va or operating in real mode indeed.

How do you do for exception vectors ? Since those have to be either at 0 or at ff* ? You stick branches at 0 to jump to where the kernel resides ?

Ben.

#10 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines

My plan for moving APUS to arch/powerpc involves writing a new bootloader (I'm currently hacking binutils to support AmigaOS binaries) that builds a proper flattened device tree and calls the kernel, but I'm not sure where the kernel virtual mapping that allows the kernel to run from a fixed address should be set up -- if in the bootloader, the kernel needs to be aware that changing the MMU settings will yield interesting results, and if in the kernel, we need some platform specific init code to handle that.

Quoted 7 lines

Well, the problem is that you basially have to hack the linear mapping, thus hitting anything that relies on __pa/__va or operating in real mode indeed.

How do you do for exception vectors ? Since those have to be either at 0 or at ff* ? You stick branches at 0 to jump to where the kernel resides ?

IIRC (Roman please correct me if I'm wrong), APUS has them at ff* because the memory at adress 0 is slower.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#11 lore raw

Hi,

Quoted 14 lines · Geert Uytterhoeven
Quoted 13 lines · Benjamin Herrenschmidt
Quoted 8 lines

My plan for moving APUS to arch/powerpc involves writing a new bootloader (I'm currently hacking binutils to support AmigaOS binaries) that builds a proper flattened device tree and calls the kernel, but I'm not sure where the kernel virtual mapping that allows the kernel to run from a fixed address should be set up -- if in the bootloader, the kernel needs to be aware that changing the MMU settings will yield interesting results, and if in the kernel, we need some platform specific init code to handle that.

Well, the problem is that you basially have to hack the linear mapping, thus hitting anything that relies on __pa/__va or operating in real mode indeed.

Quoted 6 lines
Quoted 3 lines

How do you do for exception vectors ? Since those have to be either at 0 or at ff* ? You stick branches at 0 to jump to where the kernel resides ?

IIRC (Roman please correct me if I'm wrong), APUS has them at ff* because the memory at adress 0 is slower.

Earlier APUS did put the exception vectors at 0, which is slow of course. The hardware maps part of the local memory to ff, so the exception vectors are copied there and the transfer handler jump to the mapped location.

bye, Roman