On 31.03.18 16:13, Mark Kettenis wrote: > Currently U-Boot doesn't make any effort to reserve the memory used by > ARM Trusted Firmware on these platforms. The result is that the > memory is listed as available in the EFI memory map. And as soon as a > loaded kernel tries to use this memory things explode. I've seen this > with the OpenBSD kernel. But I totally expect a Linux kernel to > suffer the same fate.
Please make sure to CC people you think would be interested. In this case, I believe Stefan certainly would care. Me too :). > I'm currently using the diff below, but it is not entirely clear to me > if arch_early_init_r() is the appropriate place to do this. I'm also > wondering whether the block should also be marked as reserved in the > FDT using fdt_add_mem_rsv(). If the latter is required this probably > needs to be done by ft_board_setup() or ft_system_setup(). > > The address and size of the region have been taken from Marvell's ATF > fork at > > https://github.com/MarvellEmbeddedProcessors/atf-marvell > > The memory layout is defined in > > plat/marvell/a8k/common/include/platform_def.h > > where there are lots of defines and a diagram that attempt to describe > the memory. It is not entirely obvious to me what part needs to be > reserved. But 0x0400000-0x04200000 works. Yeah, so ATF resides in RAM and U-Boot obviously needs to propagate that information. I actually think for mvebu it might make sense to completely override efi_add_known_memory(). If I read all the bdinfo logic correctly, they're going through great lengths to reduce the amount of address space they propagate in bi_dram: https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-mvebu/dram.c#L274 That of course means our memory map is completely bogus. So instead, what I would do is create an override for efi_add_known_memory() where you just walk the dram slots yourself and add all memory you find as BOOTTIME_DATA. That way the OS will know that it can use it for itself, but it won't be used during boot time. Then, go through bi_dram and force all those regions as free memory. And at last, reserve the ATF range as reserved. And yes, you want to do that in both - EFI map and as FDT fixup. Alex _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot