[U-Boot] [PATCH] 85xx: Introduce determine_mp_bootpg() helper.

Becky Bruce beckyb at kernel.crashing.org
Wed Apr 1 17:52:36 CEST 2009


On Mar 31, 2009, at 11:23 PM, Kumar Gala wrote:

> Match determine_mp_bootpg() that was added for 86xx.  We need this to
> address a bug introduced in v2009.03 with 86xx MP booting.  We have to
> make sure to reserve the region of memory used for the MP bootpg() so
> other u-boot code doesn't use it.
>
> Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
> ---
> cpu/mpc85xx/fdt.c |    9 ++-------
> cpu/mpc85xx/mp.c  |   25 +++++++++++--------------
> cpu/mpc85xx/mp.h  |    2 +-
> 3 files changed, 14 insertions(+), 22 deletions(-)
>
> diff --git a/cpu/mpc85xx/fdt.c b/cpu/mpc85xx/fdt.c
> index 2d36c24..26a8f48 100644
> --- a/cpu/mpc85xx/fdt.c
> +++ b/cpu/mpc85xx/fdt.c
> @@ -39,13 +39,8 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
> {
> 	int off;
> 	ulong spin_tbl_addr = get_spin_addr();
> -	u32 bootpg, id = get_my_id();
> -
> -	/* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> -	if ((u64)gd->ram_size > 0xfffff000)
> -		bootpg = 0xfffff000;
> -	else
> -		bootpg = gd->ram_size - 4096;
> +	u32 bootpg = determine_mp_bootpg();
> +	u32 id = get_my_id();
>
> 	off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu",  
> 4);
> 	while (off != -FDT_ERR_NOTFOUND) {
> diff --git a/cpu/mpc85xx/mp.c b/cpu/mpc85xx/mp.c
> index 3338c1a..8ddd81d 100644
> --- a/cpu/mpc85xx/mp.c
> +++ b/cpu/mpc85xx/mp.c
> @@ -112,6 +112,15 @@ int cpu_release(int nr, int argc, char *argv[])
> 	return 0;
> }
>
> +u32 determine_mp_bootpg(void)
> +{
> +	/* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> +	if ((u64)gd->ram_size > 0xfffff000)
> +		return (0xfffff000);
> +
> +	return (gd->ram_size - 4096);
> +}
> +
> ulong get_spin_addr(void)
> {
> 	extern ulong __secondary_start_page;
> @@ -188,13 +197,7 @@ static void pq3_mp_up(unsigned long bootpg)
>
> void cpu_mp_lmb_reserve(struct lmb *lmb)
> {
> -	u32 bootpg;
> -
> -	/* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> -	if ((u64)gd->ram_size > 0xfffff000)
> -		bootpg = 0xfffff000;
> -	else
> -		bootpg = gd->ram_size - 4096;
> +	u32 bootpg = determine_mp_bootpg();
>
> 	lmb_reserve(lmb, bootpg, 4096);
> }
> @@ -203,13 +206,7 @@ void setup_mp(void)
> {
> 	extern ulong __secondary_start_page;
> 	ulong fixup = (ulong)&__secondary_start_page;
> -	u32 bootpg;
> -
> -	/* if we have 4G or more of memory, put the boot page at 4Gb-4k */
> -	if ((u64)gd->ram_size > 0xfffff000)
> -		bootpg = 0xfffff000;
> -	else
> -		bootpg = gd->ram_size - 4096;
> +	u32 bootpg = determine_mp_bootpg();
>
> 	memcpy((void *)bootpg, (void *)fixup, 4096);

Same somments apply about defining BOOTPG_ALIGN as in the other  
patch.  And is there a PAGE_SIZE or something somewhere?  We're using  
4096 which is a bit stupid.  I know, you didn't introduce that code,  
but it seems easy to clean it up now.  If you don't want to bother,  
let me know and I'll post a follow-on.

>
> 	flush_cache(bootpg, 4096);
> diff --git a/cpu/mpc85xx/mp.h b/cpu/mpc85xx/mp.h
> index b06707f..71423ef 100644
> --- a/cpu/mpc85xx/mp.h
> +++ b/cpu/mpc85xx/mp.h
> @@ -5,7 +5,7 @@ ulong get_spin_addr(void);
> void setup_mp(void);
> u32 get_my_id(void);
> void cpu_mp_lmb_reserve(struct lmb *lmb);
> -u32 determine_bootpg(void);
> +u32 determine_mp_bootpg(void);

This hunk is bogus - the previous change should never have been there.

Otherwise, looks good.

-B



More information about the U-Boot mailing list