Defintion of kernstart_addr

Suzuki Poulose suzuki at in.ibm.com
Wed Oct 5 23:49:35 EST 2011


Hi Kumar,

I have been working on the CONFIG_RELOCATABLE support for PPC44x, trying to process
the relocations generated by the compiler. Since the TLB size is 256M, we cannot
enforce a page aligned kernel load address.

I came across some issues with the __va() / __pa() translations, while the kernel
load address is not page aligned.


We have the following definition :

#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) -
						PHYSICAL_START + KERNELBASE)

where,
	PHYSICAL_START is #define'd to kernstart_addr variable, updated at boot
time.

I would like to know the exact meaning of the value in kerstart_addr.

For e.g:

When we have :

PAGE_OFFSET = KERNELBASE = 0xc0000000,

and
kernel loaded at 64M (0x4000000)
and
we map Physical address 0 to Virtual address 0xc0000000.

What should be the value of kernstart_addr ? Should it be
0 ? Or should it be 0x4000000 ?

If we choose, 0x4000000, we get the translations wrong :

__va(0x1) = 0x1 - 0x4000000 + 0xc0000000

	   = 0xbc000001
If we select 0, we have problems at other places where we assume,
PHYSICAL_START to be the va() of _stext.


Thanks
Suzuki


More information about the Linuxppc-dev mailing list