AnsweredAssumed Answered

kernel crash in __create_pgd_mapping when I growing up ram size

Question asked by Cedric Thain on Jun 10, 2020
Latest reply on Jul 7, 2020 by Cedric Thain

Hi everybody

I am working with a Freescale i.MX8MQ EVK

And I have a crash in kernel file arch/arm64/mm/mmu.c function  __create_pgd_mapping when I change u-boot "U-Boot 2019.04-4.19.35-1.1.0+g9d5089bdf4" for growing up my ram size.

Call stack :

[ 0.000000] Call trace:
[ 0.000000] __create_pgd_mapping+0x7c/0x7a8
[ 0.000000] map_kernel_segment+0x70/0xa4
[ 0.000000] paging_init+0x154/0x7f4
[ 0.000000] setup_arch+0x1c0/0x518
[ 0.000000] start_kernel+0x70/0x400

Actually it is working with 1 DRAM_BANK of 3G. I have 4G available on my board so I apply a patch in u-boot for adding a second DRAM_BANK :

#define PHYS_SDRAM_2 0x100000000
#define PHYS_SDRAM_2_SIZE 0x40000000 /* 1GB */

 

Uboot extract with result of patch: board/freescale/imx8mq_evk/imx8mq_evk.c

int dram_init(void)
{
/* rom_pointer[1] contains the size of TEE occupies */
if (rom_pointer[1])
gd->ram_size = PHYS_SDRAM_SIZE - rom_pointer[1];
else
gd->ram_size = PHYS_SDRAM_SIZE;

 

#if CONFIG_NR_DRAM_BANKS > 1
gd->ram_size += PHYS_SDRAM_2_SIZE;
#endif

 

return 0;
}

int dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM;
if (rom_pointer[1])
{
gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE -rom_pointer[1];
}
else
gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
#if CONFIG_NR_DRAM_BANKS > 1
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
#endif
return 0;
}

phys_size_t get_effective_memsize(void)
{
if (rom_pointer[1])
return (PHYS_SDRAM_SIZE - rom_pointer[1]);
else
return PHYS_SDRAM_SIZE;
}

 

This patch is working with "U-Boot SPL 2018.03-imx_v2018.03_4.14.78_1.0.0_ga+ge60de51"

__create_pgd_mapping take as argument pgd_t *pgdir, but when I try to access to this pointer the crash occur if I boot with "U-Boot 2019.04-4.19.35-1.1.0+g9d5089bdf4" and it is working with  "U-Boot SPL 2018.03-imx_v2018.03_4.14.78_1.0.0_ga+ge60de51"

(see __create_pgd_mapping sources attached, it should be printed, like with u-boot-2018.03,

[ 0.000000] arch/arm64/mm/mmu.c - 334 - __create_pgd_mapping : CTHHHHHHHHHHHHHHHHHHHHHHHHH phys_addr_t phys '0x40480000'

But no ....it is craching

 

Do you have any idea?

I checked value of pgd_t *pgdir it is the same in both case.

Do you have a documentation reference for adding a RAM_BANK which explain difference between u-boot 2018-03 and u-boot 2019-04?

I add kernel boot trace with u-boot 2018.03 and u-boot 2019.04

Thanks for your help.

Best regards,

Cedric Thamin.

Outcomes