board_f: Call initf_malloc() before fdtdec_setup()
In case MULTI_DTB_FIT_GZIP is enabled, fdtdec_setup() does uncompress
the compressed DTs in uncompress_blob() using gunzip(), which invokes
malloc() internally. The early simple malloc is initialized in board_f
initf_malloc() call, which sets up the early simple malloc limit and
offset pointer in global data. Currently, the initf_malloc() is called
after fdtdec_setup(), which leads to malloc failure in fdtdec_setup()
during the gzip decompression, because the early simple malloc is not
initialized yet.
Call initf_malloc() before fdtdec_setup() to assure fdtdec_setup() can
use malloc() during gzip decompression of the DTs.
The impact of this change on boot time is negligible, because the
initf_malloc() only assigns two fields in global data.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Fixes: 95f4bbd581 ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Update test/py/tests/test_trace.py]
Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
+1
-1
@@ -921,13 +921,13 @@ static void initcall_run_f(void)
|
||||
* For simplicity it should remain an ordered list of function calls.
|
||||
*/
|
||||
INITCALL(setup_mon_len);
|
||||
INITCALL(initf_malloc);
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
INITCALL(fdtdec_setup);
|
||||
#endif
|
||||
#if CONFIG_IS_ENABLED(TRACE_EARLY)
|
||||
INITCALL(trace_early_init);
|
||||
#endif
|
||||
INITCALL(initf_malloc);
|
||||
INITCALL(initf_upl);
|
||||
INITCALL(log_init);
|
||||
INITCALL(initf_bootstage); /* uses its own timer, so does not need DM */
|
||||
|
||||
@@ -145,8 +145,6 @@ def check_function(ubman, fname, proftool, map_fname, trace_dat):
|
||||
out = utils.run_and_log(ubman, ['sh', '-c', cmd])
|
||||
|
||||
# Format:
|
||||
# u-boot-1 0..... 60.805596: function: initf_malloc
|
||||
# u-boot-1 0..... 60.805597: function: initf_malloc
|
||||
# u-boot-1 0..... 60.805601: function: initf_bootstage
|
||||
# u-boot-1 0..... 60.805607: function: initf_bootstage
|
||||
|
||||
@@ -162,7 +160,7 @@ def check_function(ubman, fname, proftool, map_fname, trace_dat):
|
||||
|
||||
# Check for some expected functions
|
||||
if ubman.config.buildconfig.get('config_trace_early'):
|
||||
assert 'initf_malloc' in vals.keys()
|
||||
assert 'initf_upl' in vals.keys()
|
||||
assert 'initr_watchdog' in vals.keys()
|
||||
assert 'initr_dm' in vals.keys()
|
||||
|
||||
@@ -193,7 +191,6 @@ def check_funcgraph(ubman, fname, proftool, map_fname, trace_dat):
|
||||
out = utils.run_and_log(ubman, ['sh', '-c', cmd])
|
||||
|
||||
# First look for this:
|
||||
# u-boot-1 0..... 282.101360: funcgraph_entry: 0.004 us | initf_malloc();
|
||||
# ...
|
||||
# u-boot-1 0..... 282.101369: funcgraph_entry: | initf_bootstage() {
|
||||
# u-boot-1 0..... 282.101369: funcgraph_entry: | bootstage_init() {
|
||||
|
||||
Reference in New Issue
Block a user