I'm trying to get trusty support running on my 1GB i.MX8mm based SoM but the bootloader is setting the amount of RAM incorrectly.
I've narrowed down the cause to being the u-boot code here https://source.codeaurora.org/external/imx/uboot-imx/tree/arch/arm/mach-imx/imx8m/soc.c?h=android-11.... Debugging on my board shows the calculation done is:
gd->bd->bi_dram[bank].size = optee_start - gd->bd->bi_dram[bank].start;
gd->bd->bi_dram[bank].size = 0xbe000000 - 0x40000000 = 7e000000
Which sets the dram bank size to the erroneous value of 7e000000 which my board passes through to the kernel. The kernel then gets stuck where I assume it's trying to use this nonexistent memory. I've tried manually setting the bank size to 3e000000 but this causes the boot to get stuck in the bootloader. The kernel reports the incorrect amount of ram during initialisation with trusty:
[ 0.000000] Memory: 1643664K/2064384K available (21692K kernel code, 2328K rwdata, 13808K rodata, 5376K init, 586K bss, 93040K reserved, 327680K cma-reserved)
on a bootloader image without trusty:
[ 0.000000] Memory: 647764K/1048576K available (21692K kernel code, 2328K rwdata, 13808K rodata, 5376K init, 586K bss, 73132K reserved, 327680K cma-reserved)
Note that using a SoM with 2GB of ram works as expected and using a bootloader not containing trusty on the 1GB module works.