[PATCH u-boot-mvebu 1/3] arm: mvebu: a37xx: Fix calling build_mem_map()

Stefan Roese sr at denx.de
Tue Feb 15 12:09:46 CET 2022


On 2/15/22 00:28, Pali Rohár wrote:
> Function build_mem_map() modifies global variable mem_map. This variable is
> used by the get_page_table_size() function which is called by function
> arm_reserve_mmu() (as aliased macro PGTABLE_SIZE). Function
> arm_reserve_mmu() is called earlier than enable_caches() which calls
> build_mem_map(). So arm_reserve_mmu() does not calculate reserved memory
> correctly.
> 
> Fix this issue by calling build_mem_map() from a3700_dram_init() which is
> called before arm_reserve_mmu().
> 
> Signed-off-by: Pali Rohár <pali at kernel.org>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
>   arch/arm/mach-mvebu/armada3700/cpu.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/armada3700/cpu.c b/arch/arm/mach-mvebu/armada3700/cpu.c
> index bdf8dc377528..9da0d08f947c 100644
> --- a/arch/arm/mach-mvebu/armada3700/cpu.c
> +++ b/arch/arm/mach-mvebu/armada3700/cpu.c
> @@ -136,8 +136,6 @@ static void build_mem_map(void)
>   
>   void enable_caches(void)
>   {
> -	build_mem_map();
> -
>   	icache_enable();
>   	dcache_enable();
>   }
> @@ -146,6 +144,8 @@ int a3700_dram_init(void)
>   {
>   	int win;
>   
> +	build_mem_map();
> +
>   	gd->ram_size = 0;
>   	for (win = 0; win < MVEBU_CPU_DEC_WINS; ++win) {
>   		u32 base, tgt, size;

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list