linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Defintion of kernstart_addr
@ 2011-10-05 12:49 Suzuki Poulose
  2011-10-05 16:51 ` Dave Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Suzuki Poulose @ 2011-10-05 12:49 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Josh Boyer, linux ppc dev, Dave Hansen

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

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

* Re: Defintion of kernstart_addr
  2011-10-05 12:49 Defintion of kernstart_addr Suzuki Poulose
@ 2011-10-05 16:51 ` Dave Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2011-10-05 16:51 UTC (permalink / raw)
  To: Suzuki Poulose; +Cc: Josh Boyer, linux ppc dev

On Wed, 2011-10-05 at 18:19 +0530, Suzuki Poulose wrote:
> #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 

Where kernstart_addr is the physical address of where we loaded the
kernel.  But, this has the side-effect of also shifting the kernel's
identity mapping (the 1:1 virtual-to-physical map) up by that amount.

I'm unconvinced that this movement of the identity mapping is necessary.

Even if it is, Suzuki mentions:

> #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) - 
>                                                 PHYSICAL_START + KERNELBASE)
> where:
>  PHYSICAL_START is kernstart_addr - a variable updated at runtime.
>  KERNELBASE     is the compile time Virtual base address of kernel.
> 
> This won't work for us, as the kernstart_addr may change at runtime, even
> though the mapping doesn't change.

That seems to tell me that PHYSICAL_START and kernstart_addr shouldn't
be the same variable.  We should break them apart so that we can move
the kernel's starting physical address without changing the virt/phys
mapping.

Which, I'm fearing, was what Suzuki's first patch did, and I failed to
grok it.

-- Dave

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

end of thread, other threads:[~2011-10-05 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-05 12:49 Defintion of kernstart_addr Suzuki Poulose
2011-10-05 16:51 ` Dave Hansen

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