Commit 824bb1b45371efcb10561456e894d7c2fa1a4b88
Committed by
Tom Rini
1 parent
9d2542d062
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
bootstage: Support SPL
At present bootstage only supports U-Boot proper. But SPL can also consume boot time so it is useful to have the record start there. Add bootstage support to SPL. Also support stashing the timing information when SPL finishes so that it can be picked up and reported by U-Boot proper. This provides a full boot time record, excluding only the time taken by the boot ROM. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 5 changed files with 57 additions and 5 deletions Side-by-side Diff
common/Kconfig
... | ... | @@ -18,6 +18,15 @@ |
18 | 18 | Calls to show_boot_progress() will also result in log entries but |
19 | 19 | these will not have names. |
20 | 20 | |
21 | +config SPL_BOOTSTAGE | |
22 | + bool "Boot timing and reported in SPL" | |
23 | + depends on BOOTSTAGE | |
24 | + help | |
25 | + Enable recording of boot time in SPL. To make this visible to U-Boot | |
26 | + proper, enable BOOTSTAGE_STASH as well. This will stash the timing | |
27 | + information when SPL finishes and load it when U-Boot proper starts | |
28 | + up. | |
29 | + | |
21 | 30 | config BOOTSTAGE_REPORT |
22 | 31 | bool "Display a detailed boot timing report before booting the OS" |
23 | 32 | depends on BOOTSTAGE |
common/Makefile
... | ... | @@ -65,7 +65,6 @@ |
65 | 65 | endif |
66 | 66 | |
67 | 67 | # others |
68 | -obj-$(CONFIG_BOOTSTAGE) += bootstage.o | |
69 | 68 | obj-$(CONFIG_CONSOLE_MUX) += iomux.o |
70 | 69 | obj-$(CONFIG_MTD_NOR_FLASH) += flash.o |
71 | 70 | obj-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o |
... | ... | @@ -88,6 +87,8 @@ |
88 | 87 | obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o |
89 | 88 | |
90 | 89 | endif # !CONFIG_SPL_BUILD |
90 | + | |
91 | +obj-$(CONFIG_$(SPL_)BOOTSTAGE) += bootstage.o | |
91 | 92 | |
92 | 93 | ifdef CONFIG_SPL_BUILD |
93 | 94 | obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o |
common/board_f.c
... | ... | @@ -707,11 +707,26 @@ |
707 | 707 | /* Record the board_init_f() bootstage (after arch_cpu_init()) */ |
708 | 708 | static int initf_bootstage(void) |
709 | 709 | { |
710 | +#if defined(CONFIG_SPL_BOOTSTAGE) && defined(CONFIG_BOOTSTAGE_STASH) | |
711 | + bool from_spl = true; | |
712 | +#else | |
713 | + bool from_spl = false; | |
714 | +#endif | |
710 | 715 | int ret; |
711 | 716 | |
712 | - ret = bootstage_init(true); | |
717 | + ret = bootstage_init(!from_spl); | |
713 | 718 | if (ret) |
714 | 719 | return ret; |
720 | + if (from_spl) { | |
721 | + const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR, | |
722 | + CONFIG_BOOTSTAGE_STASH_SIZE); | |
723 | + | |
724 | + ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE); | |
725 | + if (ret && ret != -ENOENT) { | |
726 | + debug("Failed to unstash bootstage: err=%d\n", ret); | |
727 | + return ret; | |
728 | + } | |
729 | + } | |
715 | 730 | |
716 | 731 | bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f"); |
717 | 732 |
common/spl/spl.c
... | ... | @@ -232,6 +232,13 @@ |
232 | 232 | gd->malloc_ptr = 0; |
233 | 233 | } |
234 | 234 | #endif |
235 | + ret = bootstage_init(true); | |
236 | + if (ret) { | |
237 | + debug("%s: Failed to set up bootstage: ret=%d\n", __func__, | |
238 | + ret); | |
239 | + return ret; | |
240 | + } | |
241 | + bootstage_mark_name(BOOTSTAGE_ID_START_SPL, "spl"); | |
235 | 242 | if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { |
236 | 243 | ret = fdtdec_setup(); |
237 | 244 | if (ret) { |
238 | 245 | |
... | ... | @@ -240,8 +247,10 @@ |
240 | 247 | } |
241 | 248 | } |
242 | 249 | if (IS_ENABLED(CONFIG_SPL_DM)) { |
250 | + bootstage_start(BOOTSTATE_ID_ACCUM_DM_SPL, "dm_spl"); | |
243 | 251 | /* With CONFIG_SPL_OF_PLATDATA, bring in all devices */ |
244 | 252 | ret = dm_init_and_scan(!CONFIG_IS_ENABLED(OF_PLATDATA)); |
253 | + bootstage_accum(BOOTSTATE_ID_ACCUM_DM_SPL); | |
245 | 254 | if (ret) { |
246 | 255 | debug("dm_init_and_scan() returned error %d\n", ret); |
247 | 256 | return ret; |
... | ... | @@ -421,6 +430,15 @@ |
421 | 430 | } |
422 | 431 | |
423 | 432 | debug("loaded - jumping to U-Boot...\n"); |
433 | +#ifdef CONFIG_BOOTSTAGE_STASH | |
434 | + int ret; | |
435 | + | |
436 | + bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl"); | |
437 | + ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR, | |
438 | + CONFIG_BOOTSTAGE_STASH_SIZE); | |
439 | + if (ret) | |
440 | + debug("Failed to stash bootstage: err=%d\n", ret); | |
441 | +#endif | |
424 | 442 | spl_board_prepare_for_boot(); |
425 | 443 | jump_to_image_no_args(&spl_image); |
426 | 444 | } |
include/bootstage.h
... | ... | @@ -177,6 +177,7 @@ |
177 | 177 | */ |
178 | 178 | BOOTSTAGE_ID_AWAKE, |
179 | 179 | BOOTSTAGE_ID_START_SPL, |
180 | + BOOTSTAGE_ID_END_SPL, | |
180 | 181 | BOOTSTAGE_ID_START_UBOOT_F, |
181 | 182 | BOOTSTAGE_ID_START_UBOOT_R, |
182 | 183 | BOOTSTAGE_ID_USB_START, |
... | ... | @@ -200,6 +201,7 @@ |
200 | 201 | BOOTSTAGE_ID_ACCUM_SPI, |
201 | 202 | BOOTSTAGE_ID_ACCUM_DECOMP, |
202 | 203 | BOOTSTAGE_ID_FPGA_INIT, |
204 | + BOOTSTATE_ID_ACCUM_DM_SPL, | |
203 | 205 | BOOTSTATE_ID_ACCUM_DM_F, |
204 | 206 | BOOTSTATE_ID_ACCUM_DM_R, |
205 | 207 | |
... | ... | @@ -228,8 +230,14 @@ |
228 | 230 | void show_boot_progress(int val); |
229 | 231 | #endif |
230 | 232 | |
231 | -#if defined(CONFIG_BOOTSTAGE) && !defined(CONFIG_SPL_BUILD) && \ | |
232 | - !defined(USE_HOSTCC) | |
233 | +#if !defined(USE_HOSTCC) | |
234 | +#if CONFIG_IS_ENABLED(BOOTSTAGE) | |
235 | +#define ENABLE_BOOTSTAGE | |
236 | +#endif | |
237 | +#endif | |
238 | + | |
239 | +#ifdef ENABLE_BOOTSTAGE | |
240 | + | |
233 | 241 | /* This is the full bootstage implementation */ |
234 | 242 | |
235 | 243 | /** |
... | ... | @@ -420,7 +428,8 @@ |
420 | 428 | { |
421 | 429 | return 0; |
422 | 430 | } |
423 | -#endif /* CONFIG_BOOTSTAGE */ | |
431 | + | |
432 | +#endif /* ENABLE_BOOTSTAGE */ | |
424 | 433 | |
425 | 434 | /* Helper macro for adding a bootstage to a line of code */ |
426 | 435 | #define BOOTSTAGE_MARKER() \ |
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3
-
mentioned in commit baa7d3