[PATCH v2 3/8] powerpc: enable the relocatable support for the fsl booke 32bit kernel

Scott Wood scottwood at freescale.com
Sat Jul 27 09:28:46 EST 2013


On 07/04/2013 07:54:09 AM, Kevin Hao wrote:
> This is based on the codes in the head_44x.S. Since we always align to
> 256M before mapping the PAGE_OFFSET for a relocatable kernel, we also
> change the init tlb map to 256M size.
> 
> Signed-off-by: Kevin Hao <haokexin at gmail.com>
> ---
> v2: Move the code to set kernstart_addr and virt_phys_offset to a c  
> function.
>     So we can expand it easily later.
> 
> Hi Scott,
> 
> I still use the 256M align for the init tlb as in v1 for the  
> following reasons:
>   * This should be the most possible case in reality.

There is no "most possible case".  It's either possible (and supported)  
or not.  And having less than 256M is definitely possible.  The 8540  
reference board has 64M.

AMP scenarios that start on a 64M-aligned but not 256M-aligned address  
are also something I've done.

>   * This is just for very early booting code and should not be a big  
> issue
>     if the first tlb entry shrink to a less size later.

"We can probably get away with it most of the time" is not a very good  
justification.  What's wrong with the suggestion I made last time, of  
basing the size on the alignment of the address?

> +	/*
> +	 * We have the runtime (virutal) address of our base.
> +	 * We calculate our shift of offset from a 256M page.
> +	 * We could map the 256M page we belong to at PAGE_OFFSET and
> +	 * get going from there.
> +	 */
> +	lis	r4,KERNELBASE at h
> +	ori	r4,r4,KERNELBASE at l
> +	rlwinm	r6,r25,0,0xfffffff		/* r6 = PHYS_START %  
> 256M */
> +	rlwinm	r5,r4,0,0xfffffff		/* r5 = KERNELBASE %  
> 256M */
> +	subf	r3,r5,r6			/* r3 = r6 - r5 */
> +	add	r3,r4,r3			/* Required Virutal  
> Address */

s/Virutal/Virtual/

-Scott


More information about the Linuxppc-dev mailing list