Products > Embedded Computing

[solved] Linux: maximum bootable kernel size in PPC/32bit

<< < (8/8)

DiTBho:

--- Quote from: brucehoult on September 28, 2021, 12:13:27 am ---Can you explain it exactly?

--- End quote ---

u-boot operates without virtual memory. The same does the first part of the kernel loader (where I attached my early_puts for debugging). From here it goes quite specific, basically the assembly code for the TLB initialization was not correct and when the pre-booter tried to move into virtual memory it completely lost all references to everything outside its window.

brucehoult:

--- Quote from: DiTBho on September 28, 2021, 01:32:07 am ---
--- Quote from: brucehoult on September 28, 2021, 12:13:27 am ---Can you explain it exactly?

--- End quote ---

u-boot operates without virtual memory. The same does the first part of the kernel loader (where I attached my early_puts for debugging). From here it goes quite specific, basically the assembly code for the TLB initialization was not correct and when the pre-booter tried to move into virtual memory it completely lost all references to everything outside its window.

--- End quote ---

Yes I understand that.

I just explained how people often have similar problems switching from using physical memory to virtual memory on RISC-V.

I'm asking what, exactly, was wrong with the TLB initialisation that works on PPC750 but not 40x. The actual instructions.

thinkfat:

--- Quote from: DiTBho on September 27, 2021, 04:00:40 pm ---Solved  ;D ;D ;D

I asked to a PPC40x expert and we found an error in the TLB pre-initialization.
Rather PPC40x-specific.

--- End quote ---

That would've been hard to debug even with a JTAG probe.

BTW, you wouldn't necessarily have to buy an expensive probe. OpenOCD has at least some support for PPC and should allow using a simple FTDI based probe.

DiTBho:
I am not a PowerPC expert. I worked years ago for a company that had a few PPC based products (440, 460, 8xx and e500) and I happen to have a couple of PPC40x based hobby projects, and I also like to run Linux on my mac-mini/PPC


--- Quote from: brucehoult on September 28, 2021, 01:40:42 am ---I'm asking what, exactly, was wrong with the TLB initialisation that works on PPC750 but not 40x. The actual instructions.

--- End quote ---

Not a single instruction, but a sequence of instructions.

On Linux, the critical code is segregated within a specific CPU module

* PPC32
* PPC64
* PPC40x
* PPC44x
* PPC8xx
* ...each item in the list has a dedicated assembly module with low-level exception handlers, MMU support, trap, FPU-trap (if there is no physical FPU) and interrupt dispatch.

I haven't gone into the details, but PPC32 has different procedures with more support and interest. It needs to loads the BAT registers with the values set by MMU init, which for example takes care of whether we are on a 601 or not. These facilities have been exhaustively implemented with a rich set of checks, while the 40x code is poor, probably because it has less interest.

PPC32 is mainly "PMAC" (PowerMac), which assumes OF+bootX, while PPC405 assumes u-boot. There are differences even here, e.g. with the CPU already has the MMU on, and there is specific code to turn it off before changing BATs (MMU's registers).

PPC32 has the 1st slot of ram mapped with the bats and can map more slot on demand. Indeed when I tried to compile a 9MB kernel for my mac-mini/ppc, it correctly mapped 32MB to facilitate the kernel pre-booting. There is a procedure (in assembly) to check and manage things transparently. The PPC40x code does something similar but the procedure is different and it is simpler and less "error prone". It goes back to running unmapped so it can load up new values and change to using exception vectors. This way, all the CPU has to do is invalidate the TLB to clear the old set-TLB mappings, and to map an additional slot it requires to configure, reserve and load two entries into TLB slots. But it's not "on demand", but rather hard-coded in order to map the first 32 MBytes of memory 1:1, virtual to physical and more importantly it's how to set the cache mode.

The bug was that on the hard-coded part, it reserved only one slot instead of two, so it only mapped 16MB instead of 32MB and there was no checking for that.

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version