bootm: Clean up arch-specific, pre-OS clean-up
Subsystems (11)
v3 cover bootm: Clean up arch-specific, pre-OS clean-up
From: Simon Glass <[email protected]>
Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.
It is quite hard to know what actually happens in the final milliseconds before the OS boot.
This series attempts to start cleaning up U-Boot in this area.
The basic intent is to create a new bootm_final() function which can be called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic.
All architectures are converted over to use this new function.
board_quiesce_devices() is moved into bootm_final() so that all archs benefit from it.
This series fixes a bug in device_remove() is fixed where removing a parent with specialised flags (e.g. DM_REMOVE_ACTIVE_ALL) could leave children activated, since they do not match the flags. This fixes is needed to avoid bootm_final() causing test failures on sandbox.
Future work could take this a little further:
- Convert EFI loader to use the same function
- Improve comments for cleanup_before_linux() across architectures
Changes in v3:
- Add dm: device_remove() fix for child removal with specialised flags
- Add new patch for ARC conversion
- Add new patch for ARM conversion (requested by Tom)
- Add new patch for MIPS conversion
- Add new patch for MicroBlaze conversion
- Add new patch for Nios2 conversion
- Add new patch for PowerPC conversion
- Add new patch for SH conversion
- Add new patch for Xtensa conversion
- Add new patch for bootstage stashing, needed for ARM conversion
- Add new patch for m68k conversion
- Add new patch for sandbox conversion
- Convert all remaining architectures
- Drop cleanup_before_linux() patch
- Drop the DMA comment move (now in the introductory patch)
- Drop udc_disconnect()
- Fix "the a" typo
- Introduce with all common functionality (not empty)
- Move board_quiesce_devices() into bootm_final() instead of dropping it
- Move bootstage dummies earlier in the series
- Move earlier in the series so bootm_final() can use bootstage from the start
- Put bootm_final() in bootm.c instead of a separate file
- Put in bootm.c instead of a separate file
- Squash in patches 2, 3 and 5 from v2
- Squash introductory patches so bootm_final() is introduced non-empty
- Squash with the previous riscv patches
- Update cover letter to match current series
Changes in v2:
- Drop patch 'efi: Drop EFI_GRUB_ARM32_WORKAROUND'
- Update cover message to reflect dropping the EFI patches, etc.
Simon Glass (17):
dm: Move flags_remove() check before child removal
dm: Remove children when parent is removed by flags
bootstage: Add some missing dummy functions
bootm: Create bootm_final() for pre-boot cleanup
x86: Call bootm_final()
riscv: Call bootm_final()
bootm: Stash bootstage data in bootm_final()
arm: Call bootm_final()
arc: Call bootm_final()
microblaze: Call bootm_final()
mips: Call bootm_final()
powerpc: Call bootm_final()
m68k: Call bootm_final()
nios2: Call bootm_final()
sh: Call bootm_final()
xtensa: Call bootm_final()
sandbox: Call bootm_final()
arch/arc/lib/bootm.c | 4 +--- arch/arm/lib/bootm.c | 27 +-------------------- arch/m68k/lib/bootm.c | 2 ++ arch/microblaze/lib/bootm.c | 4 +--- arch/mips/lib/bootm.c | 7 +----- arch/nios2/lib/bootm.c | 2 ++ arch/powerpc/lib/bootm.c | 7 +----- arch/riscv/include/asm/u-boot-riscv.h | 1 - arch/riscv/lib/bootm.c | 24 +------------------ arch/sandbox/lib/bootm.c | 2 ++ arch/sh/lib/bootm.c | 2 ++ arch/x86/lib/bootm.c | 14 +---------- arch/xtensa/lib/bootm.c | 2 ++ boot/bootm.c | 23 ++++++++++++++++++ drivers/core/device-remove.c | 34 +++++++++++++++++---------- include/bootm.h | 20 ++++++++++++++++ include/bootstage.h | 8 +++++++ 17 files changed, 90 insertions(+), 93 deletions(-)
Signature · 4 lines
2.43.0 base-commit: f6963fc232603007c661411fb31c57f1a9678a87 branch: bootma-us3
PATCH v3 1/17 dm: Move flags_remove() check before child removal
From: Simon Glass <[email protected]>
Move the flags_remove() call before device_chld_remove() and save the result in a separate variable. This is just a refactoring with no behaviour change, preparing for the next commit which needs to know whether the parent will be removed before deciding how to remove its children.
---
(no changes since v1)
drivers/core/device-remove.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/core/device-remove.c +12 -11
@@ -198,7 +198,7 @@ static int flags_remove(uint flags, uint drv_flags)int device_remove (struct udevice *dev,uint flags) {const struct driver *drv; -int ret; +int ret, cret;if (!dev)return -EINVAL ;
@@ -210,6 +210,14 @@ int device_remove(struct udevice *dev, uint flags)if (ret)return ret; +/* +* Remove the device if called with the "normal" remove flag set, +* or if the remove flag matches any of the drivers remove flags +*/ + drv = dev->driver; +assert (drv); + cret =flags_remove (flags, drv->flags); +/* * If the child returns EKEYREJECTED, continue. It just means that it * didn't match the flags.
@@ -218,17 +226,10 @@ int device_remove(struct udevice *dev, uint flags)if (ret && ret != -EKEYREJECTED )return ret; -/* -* Remove the device if called with the "normal" remove flag set, -* or if the remove flag matches any of the drivers remove flags -*/ - drv = dev->driver; -assert (drv); - ret =flags_remove (flags, drv->flags); -if (ret) { +if (cret) {log_debug ("%s: When removing: flags=%x, drv->flags=%x, err=%d\n" , - dev->name, flags, drv->flags, ret); -return ret; + dev->name, flags, drv->flags, cret); +return cret; } ret =uclass_pre_remove_device (dev);
Signature · 1 line
2.43.0
PATCH v3 2/17 dm: Remove children when parent is removed by flags
In reply to Simon GlassFrom: Simon Glass <[email protected]>
When dm_remove_devices_active() removes devices using specialised flags like DM_REMOVE_ACTIVE_ALL, a parent device may match (e.g. MMC has DM_FLAG_OS_PREPARE) while its children do not. This deactivates the parent but leaves children activated, an inconsistent state.
Later, when uclass_destroy() calls device_remove() with DM_REMOVE_NORMAL on the already-deactivated parent, it returns early without touching the children. The subsequent device_unbind() then fails because the children are still activated.
Fix this by dropping only the DM_REMOVE_ACTIVE_ALL requirement for child removal when the parent is being removed. This ensures children are removed along with their parent, while still preserving other flags like DM_REMOVE_NON_VITAL so that vital devices remain protected.
---
(no changes since v1)
drivers/core/device-remove.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/core/device-remove.c +10 -1
@@ -219,10 +219,19 @@ int device_remove(struct udevice *dev, uint flags) cret =flags_remove (flags, drv->flags);/* +* Remove all children. If this device is being removed due to +* active-DMA or OS-prepare flags, drop the active-flag requirement +* for children so they are removed even without matching active +* flags, since a deactivated device must not have activated +* children. Preserve other flags (e.g. DM_REMOVE_NON_VITAL) so +* that vital children are still protected. +* * If the child returns EKEYREJECTED, continue. It just means that it * didn't match the flags. */ - ret =device_chld_remove (dev,NULL , flags); + ret =device_chld_remove (dev,NULL , + cret ? flags : + (flags & ~DM_REMOVE_ACTIVE_ALL ));if (ret && ret != -EKEYREJECTED )return ret;
Signature · 1 line
2.43.0
PATCH v3 3/17 bootstage: Add some missing dummy functions
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Neither bootstage_fdt_add_report() nor bootstage_report() has a dummy double for when bootstage is disabled. Add them.
---
Changes in v3:
- Move earlier in the series so bootm_final() can use bootstage from the start
include/bootstage.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/bootstage.h +8 -0
@@ -435,6 +435,14 @@ static inline uint32_t bootstage_accum(enum bootstage_id id)return 0 ; } +static inline void bootstage_report (void ) +{ +} + +static inline void bootstage_fdt_add_report (void ) +{ +} +static inline int bootstage_stash (void *base,int size) {return 0 ;/* Pretend to succeed */
Signature · 1 line
2.43.0
PATCH v3 4/17 bootm: Create bootm_final() for pre-boot cleanup
In reply to Simon GlassFrom: Simon Glass <[email protected]>
There are various functions which announce that booting is imminent and do related preparation. Most of these are arch-specific.
In practice, most archs do a similar thing. It would be better to have a common function, with perhaps some events for things that are really arch- and board-specific.
Create a new bootm_final() function with the common pre-boot steps:
printing the "Starting kernel" message, recording bootstage data, optionally writing bootstage to the FDT and printing a report, and removing active devices.
Be careful to avoid using BIT() macros which are not available with host tools.
---
Changes in v3:
- Fix "the a" typo
- Introduce with all common functionality (not empty)
- Put in bootm.c instead of a separate file
- Squash in patches 2, 3 and 5 from v2
boot/bootm.c | 20 ++++++++++++++++++++ include/bootm.h | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+)
boot/bootm.c +20 -0
@@ -7,6 +7,7 @@#ifndef USE_HOSTCC #include <bootm.h> #include <bootstage.h> +#include <dm/root.h> #include <cli.h> #include <command.h> #include <cpu_func.h>
@@ -1194,6 +1195,25 @@ void __weak switch_to_non_secure_mode(void) { } +void bootm_final (enum bootm_final_t flags) +{ +printf ("\nStarting kernel ...\n\n" ); + +bootstage_mark_name (BOOTSTAGE_ID_BOOTM_HANDOFF ,"start_kernel" ); + +if (IS_ENABLED (CONFIG_BOOTSTAGE_FDT ) &&IS_ENABLED (CONFIG_CMD_FDT )) +bootstage_fdt_add_report (); +if (IS_ENABLED (CONFIG_BOOTSTAGE_REPORT )) +bootstage_report (); + +/* +* Call remove function of all devices with a removal flag set. +* This may be useful for last-stage operations, like cancelling +* of DMA operation or releasing device internal buffers. +*/ +dm_remove_devices_active (); +} +#else /* USE_HOSTCC */ #if defined(CONFIG_FIT_SIGNATURE )
include/bootm.h +20 -0
@@ -16,6 +16,16 @@ struct cmd_tbl;#define BOOTM_ERR_OVERLAP (-2)#define BOOTM_ERR_UNIMPLEMENTED (-3) +/** +* enum bootm_final_t - flags to control bootm_final() +* +* @BOOTM_FINAL_FAKE: true to do everything except actually boot; it then +* returns to the caller +*/ +enum bootm_final_t { +BOOTM_FINAL_FAKE =1 <<0 , +}; +/** * struct bootm_info() - information used when processing images to boot *
@@ -321,4 +331,14 @@ void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);*/ int bootm_boot_start (ulong addr,const char *cmdline); +/** +* bootm_final() - Announce and do cleanup before boot +* +* This performs the common pre-boot steps: printing the "Starting kernel" +* message, recording bootstage data, and removing active devices. +* +* @flags: Flags to control what this function does +*/ +void bootm_final (enum bootm_final_t flags); +#endif
Signature · 1 line
2.43.0
Re: [PATCH v3 04/17] bootm: Create bootm_final() for pre-boot cleanup
Quoted 14 lines · Simon Glass
From: Simon Glass <[email protected]>
There are various functions which announce that booting is imminent and do related preparation. Most of these are arch-specific.
In practice, most archs do a similar thing. It would be better to have a common function, with perhaps some events for things that are really arch- and board-specific.
Create a new
bootm_final()function with the common pre-boot steps:
printing the "Starting kernel" message, recording bootstage data, optionally writing bootstage to the FDT and printing a report, and removing active devices.
Quoted 4 lines
Be careful to avoid using
BIT()macros which are not available with host tools.Signed-off-by Simon Glass <[email protected]>
Getting closer for sure.
[snip]
boot/bootm.c void __weak switch_to_non_secure_mode(void) · line 1200
Quoted 3 lines
boot/bootm.c +3
-0+void bootm_final (enum bootm_final_t flags) +{ +printf ("\nStarting kernel ...\n\n" );
So most platforms calls in here with "fake" as a flag so that this printf can be:printf("\nStarting kernel ...%s\n\n", fake ? "(fake run for tracing)" : "");
But this isn't preserved.
We should just call this "flag" and make use of it already being BOOTM_STATE_OS_FAKE_GO, and have the riscv and maybe arm patches (less clear since it's two places since arm and arm64 both define a function that calls announce_and_cleanup today) be dropping announce_and_cleanup() now that it's just two function calls. I see that arc is just doing this openly and I assume everywhere else is inbetween the two. This lets us also drop the new bootm_final_t flags as well, since it's only for the fake message.
A separate follow-up cleanup would be to make it consistent for do_bootm_linux to pass flag around.
Signature · 1 line
Tom
PATCH v3 5/17 x86: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
The x86 code in bootm_announce_and_cleanup() is very similar to the new bootm_final() function, so just use the latter.
---
Changes in v3:
- Drop the DMA comment move (now in the introductory patch)
arch/x86/lib/bootm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
arch/x86/lib/bootm.c +1 -13
@@ -34,22 +34,10 @@ DECLARE_GLOBAL_DATA_PTR;void bootm_announce_and_cleanup (void ) { -printf ("\nStarting kernel ...\n\n" ); -#ifdef CONFIG_SYS_COREBOOT timestamp_add_now (TS_START_KERNEL );#endif -bootstage_mark_name (BOOTSTAGE_ID_BOOTM_HANDOFF ,"start_kernel" ); -#if IS_ENABLED (CONFIG_BOOTSTAGE_REPORT ) -bootstage_report (); -#endif - -/* -* Call remove function of all devices with a removal flag set. -* This may be useful for last-stage operations, like cancelling -* of DMA operation or releasing device internal buffers. -*/ -dm_remove_devices_active (); +bootm_final (0 ); }#if defined(CONFIG_OF_LIBFDT ) && !defined(CONFIG_OF_NO_KERNEL )
Signature · 1 line
2.43.0
PATCH v3 6/17 riscv: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
The RISC-V announce_and_cleanup() duplicates the common pre-boot steps. Replace it with a call to bootm_final().
Move board_quiesce_devices() into bootm_final() so it is available to all architectures. Drop the RISC-V weak definition and header declaration since the generic one in bootm.h is used instead.
---
Changes in v3:
- Drop udc_disconnect()
- Move board_quiesce_devices() into bootm_final() instead of dropping it
- Squash with the previous riscv patches
arch/riscv/include/asm/u-boot-riscv.h | 1 - arch/riscv/lib/bootm.c | 24 +----------------------- boot/bootm.c | 2 ++ 3 files changed, 3 insertions(+), 24 deletions(-)
arch/riscv/include/asm/u-boot-riscv.h +0 -1
@@ -16,7 +16,6 @@ int cleanup_before_linux(void);/* board/.../... */ int board_init (void ); -void board_quiesce_devices (void );int riscv_board_reserved_mem_fixup (void *fdt);int riscv_fdt_copy_resv_mem_node (const void *src_fdt,void *dest_fdt);
arch/riscv/lib/bootm.c +1 -23
@@ -25,10 +25,6 @@DECLARE_GLOBAL_DATA_PTR ; -__weak void board_quiesce_devices (void ) -{ -} -/** * announce_and_cleanup() - Print message and prepare for kernel boot *
@@ -36,25 +32,7 @@ __weak void board_quiesce_devices(void)*/ static void announce_and_cleanup (int fake) { -printf ("\nStarting kernel ...%s\n\n" , fake ? -"(fake run for tracing)" :"" ); -bootstage_mark_name (BOOTSTAGE_ID_BOOTM_HANDOFF ,"start_kernel" ); -#ifdef CONFIG_BOOTSTAGE_FDT -bootstage_fdt_add_report (); -#endif -#if CONFIG_IS_ENABLED (BOOTSTAGE_REPORT ) -bootstage_report (); -#endif - -board_quiesce_devices (); - -/* -* Call remove function of all devices with a removal flag set. -* This may be useful for last-stage operations, like cancelling -* of DMA operation or releasing device internal buffers. -*/ -dm_remove_devices_active (); - +bootm_final (fake);cleanup_before_linux (); }
boot/bootm.c +2 -0
@@ -1206,6 +1206,8 @@ void bootm_final(enum bootm_final_t flags)if (IS_ENABLED (CONFIG_BOOTSTAGE_REPORT ))bootstage_report (); +board_quiesce_devices (); +/* * Call remove function of all devices with a removal flag set. * This may be useful for last-stage operations, like cancelling
Signature · 1 line
2.43.0
PATCH v3 7/17 bootm: Stash bootstage data in bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
ARM stashes bootstage data to a known memory location before booting, so the kernel can pick it up. Add this to bootm_final() so all architectures benefit from it.
The bootstage_stash_default() function is a no-op when bootstage or stashing is disabled.
---
Changes in v3:
- Add new patch for bootstage stashing, needed for ARM conversion
boot/bootm.c | 1 + 1 file changed, 1 insertion(+)
boot/bootm.c +1 -0
@@ -1203,6 +1203,7 @@ void bootm_final(enum bootm_final_t flags)if (IS_ENABLED (CONFIG_BOOTSTAGE_FDT ) &&IS_ENABLED (CONFIG_CMD_FDT ))bootstage_fdt_add_report (); +bootstage_stash_default ();if (IS_ENABLED (CONFIG_BOOTSTAGE_REPORT ))bootstage_report ();
Signature · 1 line
2.43.0
Re: [PATCH v3 07/17] bootm: Stash bootstage data in bootm_final()
Quoted 11 lines · Simon Glass
From: Simon Glass <[email protected]>
ARM stashes bootstage data to a known memory location before booting, so the kernel can pick it up. Add this to
bootm_final()so all architectures benefit from it.The
bootstage_stash_default()function is a no-op when bootstage or stashing is disabled.Signed-off-by Simon Glass <[email protected]>
Signature · 1 line
Tom
PATCH v3 8/17 arm: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
The ARM announce_and_cleanup() duplicates the common pre-boot steps. Replace it with a call to bootm_final().
Drop the ARM weak board_quiesce_devices() definition since it is now called from bootm_final() and the generic weak definition in bootm.h is used instead.
Note that the printf() ordering changes slightly: it now prints before bootstage processing rather than after, matching x86 and RISC-V.
---
Changes in v3:
- Add new patch for ARM conversion (requested by Tom)
arch/arm/lib/bootm.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-)
arch/arm/lib/bootm.c +1 -26
@@ -42,10 +42,6 @@ DECLARE_GLOBAL_DATA_PTR;static struct tag *params; -__weak void board_quiesce_devices (void ) -{ -} -/** * announce_and_cleanup() - Print message and prepare for kernel boot *
@@ -53,28 +49,7 @@ __weak void board_quiesce_devices(void)*/ static void announce_and_cleanup (int fake) { -bootstage_mark_name (BOOTSTAGE_ID_BOOTM_HANDOFF ,"start_kernel" ); -#ifdef CONFIG_BOOTSTAGE_FDT -bootstage_fdt_add_report (); -#endif -bootstage_stash_default (); -#ifdef CONFIG_BOOTSTAGE_REPORT -bootstage_report (); -#endif - -board_quiesce_devices (); - -printf ("\nStarting kernel ...%s\n\n" , fake ? -"(fake run for tracing)" :"" ); -/* -* Call remove function of all devices with a removal flag set. -* This may be useful for last-stage operations, like cancelling -* of DMA operation or releasing device internal buffers. -* dm_remove_devices_active() ensures that vital devices are removed in -* a second round. -*/ -dm_remove_devices_active (); - +bootm_final (fake);cleanup_before_linux (); }
Signature · 1 line
2.43.0
PATCH v3 9/17 arc: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Replace the open-coded printf and bootstage_mark_name with a call to bootm_final(). This also adds board_quiesce_devices() and dm_remove_devices_active() which were not previously called on ARC.
---
Changes in v3:
- Add new patch for ARC conversion
arch/arc/lib/bootm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arc/lib/bootm.c +1 -3
@@ -58,9 +58,7 @@ static void boot_jump_linux(struct bootm_headers *images, int flag) kernel_entry);bootstage_mark (BOOTSTAGE_ID_RUN_OS ); -printf ("\nStarting kernel ...%s\n\n" , fake ? -"(fake run for tracing)" :"" ); -bootstage_mark_name (BOOTSTAGE_ID_BOOTM_HANDOFF ,"start_kernel" ); +bootm_final (fake ?BOOTM_FINAL_FAKE :0 );if (CONFIG_IS_ENABLED (OF_LIBFDT ) && images->ft_len) { r0 =2 ;
Signature · 1 line
2.43.0
PATCH v3 10/17 microblaze: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Replace the open-coded printf and bootstage_mark_name with a call to bootm_final(). This also adds board_quiesce_devices() and dm_remove_devices_active() which were not previously called on MicroBlaze.
---
Changes in v3:
- Add new patch for MicroBlaze conversion
arch/microblaze/lib/bootm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/microblaze/lib/bootm.c +1 -3
@@ -36,9 +36,7 @@ static void boot_jump_linux(struct bootm_headers *images, int flag) cmdline, rd_start, dt);bootstage_mark (BOOTSTAGE_ID_RUN_OS ); -printf ("\nStarting kernel ...%s\n\n" , fake ? -"(fake run for tracing)" :"" ); -bootstage_mark_name (BOOTSTAGE_ID_BOOTM_HANDOFF ,"start_kernel" ); +bootm_final (fake ?BOOTM_FINAL_FAKE :0 );flush_cache_all ();
Signature · 1 line
2.43.0
PATCH v3 11/17 mips: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Replace the open-coded bootstage_fdt_add_report() and bootstage_report() with a call to bootm_final(). This also adds the "Starting kernel" message, board_quiesce_devices() and dm_remove_devices_active() which were not previously called on MIPS.
---
Changes in v3:
- Add new patch for MIPS conversion
arch/mips/lib/bootm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/mips/lib/bootm.c +1 -6
@@ -268,12 +268,7 @@ static void boot_jump_linux(struct bootm_headers *images)if (CONFIG_IS_ENABLED (MALTA )) linux_extra = gd->ram_size; -#if IS_ENABLED (CONFIG_BOOTSTAGE_FDT ) -bootstage_fdt_add_report (); -#endif -#if IS_ENABLED (CONFIG_BOOTSTAGE_REPORT ) -bootstage_report (); -#endif +bootm_final (0 );if (CONFIG_IS_ENABLED (RESTORE_EXCEPTION_VECTOR_BASE ))trap_restore ();
Signature · 1 line
2.43.0
PATCH v3 12/17 powerpc: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Replace the open-coded bootstage_fdt_add_report() and bootstage_report() with a call to bootm_final(). This also adds the "Starting kernel" message, board_quiesce_devices() and dm_remove_devices_active() which were not previously called on PowerPC.
---
Changes in v3:
- Add new patch for PowerPC conversion
arch/powerpc/lib/bootm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/powerpc/lib/bootm.c +1 -6
@@ -54,12 +54,7 @@ static void boot_jump_linux(struct bootm_headers *images)bootstage_mark (BOOTSTAGE_ID_RUN_OS ); -#ifdef CONFIG_BOOTSTAGE_FDT -bootstage_fdt_add_report (); -#endif -#ifdef CONFIG_BOOTSTAGE_REPORT -bootstage_report (); -#endif +bootm_final (0 );#if defined(CONFIG_SYS_INIT_RAM_LOCK ) && !defined(CONFIG_E500 )unlock_ram_in_cache ();
Signature · 1 line
2.43.0
PATCH v3 13/17 m68k: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Add a call to bootm_final() before jumping to the kernel. This adds the "Starting kernel" message, bootstage tracking, board_quiesce_devices() and dm_remove_devices_active() which were not previously called on m68k.
---
Changes in v3:
- Add new patch for m68k conversion
arch/m68k/lib/bootm.c | 2 ++ 1 file changed, 2 insertions(+)
arch/m68k/lib/bootm.c +2 -0
@@ -65,6 +65,8 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)bootstage_mark (BOOTSTAGE_ID_RUN_OS ); +bootm_final (0 ); +/* * Linux Kernel Parameters (passing board info data): * sp+00: Ignore, side effect of using jsr to jump to kernel
Signature · 1 line
2.43.0
Re: [PATCH v3 13/17] m68k: Call bootm_final()
Hi Simon,
after rebasing to master, applying this i get:
+arch/m68k/lib/bootm.c:68:9: error: implicit declaration of function 'bootm_final'; did you mean 'bootm_init'? [-Werror=implicit-function-declaration
Am i missing something ?
Thanks
angelo
Quoted 22 lines · Simon Glass
From: Simon Glass <[email protected]>
Add a call to
bootm_final()before jumping to the kernel. This adds the "Starting kernel" message, bootstage tracking,board_quiesce_devices()anddm_remove_devices_active()which were not previously called on m68k.Signed-off-by Simon Glass <[email protected]>---
Changes in v3:
- Add new patch for m68k conversionarch/m68k/lib/bootm.c | 2 ++ 1 file changed, 2 insertions(+)arch/m68k/lib/bootm.c +0
-0
arch/m68k/lib/bootm.c int do_bootm_linux(int flag, struct bootm_info *bmi) · line 72
Quoted 8 lines
arch/m68k/lib/bootm.c +2
-0@@ -65,6 +65,8 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)bootstage_mark (BOOTSTAGE_ID_RUN_OS ); +bootm_final (0 ); +/* * Linux Kernel Parameters (passing board info data): * sp+00: Ignore, side effect of using jsr to jump to kernel
-- Angelo
Re: [PATCH v3 13/17] m68k: Call bootm_final()
In reply to Simon GlassOK buildall m68k,
OK test on stmark2
Quoted 22 lines · Simon Glass
From: Simon Glass <[email protected]>
Add a call to
bootm_final()before jumping to the kernel. This adds the "Starting kernel" message, bootstage tracking,board_quiesce_devices()anddm_remove_devices_active()which were not previously called on m68k.Signed-off-by Simon Glass <[email protected]>---
Changes in v3:
- Add new patch for m68k conversionarch/m68k/lib/bootm.c | 2 ++ 1 file changed, 2 insertions(+)arch/m68k/lib/bootm.c +0
-0
arch/m68k/lib/bootm.c int do_bootm_linux(int flag, struct bootm_info *bmi) · line 72
Quoted 8 lines
arch/m68k/lib/bootm.c +2
-0@@ -65,6 +65,8 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)bootstage_mark (BOOTSTAGE_ID_RUN_OS ); +bootm_final (0 ); +/* * Linux Kernel Parameters (passing board info data): * sp+00: Ignore, side effect of using jsr to jump to kernel
-- Angelo
PATCH v3 14/17 nios2: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Add a call to bootm_final() before jumping to the kernel. This adds the "Starting kernel" message, bootstage tracking, board_quiesce_devices() and dm_remove_devices_active() which were not previously called on Nios2.
---
Changes in v3:
- Add new patch for Nios2 conversion
arch/nios2/lib/bootm.c | 2 ++ 1 file changed, 2 insertions(+)
arch/nios2/lib/bootm.c +2 -0
@@ -41,6 +41,8 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)if ((flag !=0 ) && (flag !=BOOTM_STATE_OS_GO ))return 1 ; +bootm_final (0 ); +/* flushes data and instruction caches before calling the kernel */ disable_interrupts ();flush_dcache_all ();
Signature · 1 line
2.43.0
PATCH v3 15/17 sh: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Add a call to bootm_final() before jumping to the kernel. This adds the "Starting kernel" message, bootstage tracking, board_quiesce_devices() and dm_remove_devices_active() which were not previously called on SH.
---
Changes in v3:
- Add new patch for SH conversion
arch/sh/lib/bootm.c | 2 ++ 1 file changed, 2 insertions(+)
arch/sh/lib/bootm.c +2 -0
@@ -92,6 +92,8 @@ int do_bootm_linux(int flag, struct bootm_info *bmi) images->rd_end - images->rd_start); } +bootm_final (0 ); +/* Boot kernel */ kernel ();
Signature · 1 line
2.43.0
PATCH v3 16/17 xtensa: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Add a call to bootm_final() before jumping to the kernel. This adds the "Starting kernel" message, bootstage tracking, board_quiesce_devices() and dm_remove_devices_active() which were not previously called on Xtensa.
---
Changes in v3:
- Add new patch for Xtensa conversion
arch/xtensa/lib/bootm.c | 2 ++ 1 file changed, 2 insertions(+)
arch/xtensa/lib/bootm.c +2 -0
@@ -178,6 +178,8 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)printf ("Transferring Control to Linux @0x%08lx ...\n\n" , (ulong )images->ep); +bootm_final ((flag &BOOTM_STATE_OS_FAKE_GO ) ?BOOTM_FINAL_FAKE :0 ); +flush_dcache_range ((unsigned long )params_start, (unsigned long )params);if (flag &BOOTM_STATE_OS_FAKE_GO )
Signature · 1 line
2.43.0
PATCH v3 17/17 sandbox: Call bootm_final()
In reply to Simon GlassFrom: Simon Glass <[email protected]>
Add a call to bootm_final() before the simulated kernel jump. This adds the "Starting kernel" message, bootstage tracking, board_quiesce_devices() and dm_remove_devices_active() which were not previously called on sandbox.
---
Changes in v3:
- Add new patch for sandbox conversion
arch/sandbox/lib/bootm.c | 2 ++ 1 file changed, 2 insertions(+)
arch/sandbox/lib/bootm.c +2 -0
@@ -73,6 +73,8 @@ int do_bootm_linux(int flag, struct bootm_info *bmi)if (flag & (BOOTM_STATE_OS_GO |BOOTM_STATE_OS_FAKE_GO )) {bootstage_mark (BOOTSTAGE_ID_RUN_OS ); +bootm_final ((flag &BOOTM_STATE_OS_FAKE_GO ) ? +BOOTM_FINAL_FAKE :0 );printf ("## Transferring control to Linux (at address %08lx)...\n" , images->ep);printf ("sandbox: continuing, as we cannot run Linux\n" );
Signature · 1 line
2.43.0