While reading code I noticed we need to call thread_info_init before mem_init to be correct. In practice it hasn't mattered because cpu0 is calling mem_init, and it's cpu index is 0, which is what a fresh first boot would have it be anyway. With reset tests (coming soon) combined with mmu tests (hopefully coming someday) it could be problematic though, so let's fix it. Additionally comment the order to make sure we maintain it. The io_init dependency on mem_init is because io_init calls init functions that make use of heap allocation. Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> --- lib/arm/setup.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/arm/setup.c b/lib/arm/setup.c index e52a25abd722..1751c3997c53 100644 --- a/lib/arm/setup.c +++ b/lib/arm/setup.c @@ -126,12 +126,17 @@ void setup(const void *fdt) ret = dt_init(&stacktop); assert(ret == 0); - mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size)); - io_init(); cpu_init(); + /* cpu_init must be called before thread_info_init */ thread_info_init(current_thread_info(), 0); + /* thread_info_init must be called before mem_init */ + mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size)); + + /* mem_init must be called before io_init */ + io_init(); + ret = dt_get_bootargs(&bootargs); assert(ret == 0); setup_args_progname(bootargs); -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html