Subject: Re: Defintion of kernstart_addr

From: Dave Hansen <[email-masked]>
Date: Wed, 05 Oct 2011 09:51:58 -0700

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