-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
High
-
Linux Core SDK
-
LCPD-41069
-
10.00
-
11.01
-
-
go command working as expected
The U-Boot "go" command is sometimes used to start 3rd party OS / SW stacks, like in case of our QNX SDK (U-Boot is used to load and start QNX image).
However the general as well as platform-specific implementation of the "go" command for K3 type devices currently does not do any type of cache cleanup / disabling and MMU disabling, which is done in case of Linux for example to create a clean execution environment using the Linux-specific boot commands. This missing cleanup when using "go" leads to intermittent startup issues and strange corner case behavior including crashes and DDR "corruption" as reported in a customer debug scenario.
The fix for this is to add a platform-specific cleanup function by overriding a hook the "go" function provides, as follows:
$ git diff diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index fa8cd93d664..99e8f37ac37 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -214,6 +214,14 @@ void board_prep_linux(struct bootm_headers *images) ROUND(images->os.end, CONFIG_SYS_CACHELINE_SIZE)); } + +unsigned long do_go_exec(ulong (*entry)(int, char * const []), + int argc, char *const argv[]) +{ + cleanup_before_linux(); + + return entry(argc, argv); +} #endif void spl_enable_cache(void)
The same is already done for other architectures (RISCV).
Side note: It may be advisable/best practice to also include a call to __asm_flush_dcache_range() like it is already done in board_prep_linux() to accommodate higher-end K3 devices with L3 cache, see associated commit message for e938b2252 ("arm: K3: Clean and invalidate Linux Image before jumping to Linux"). This should be checked/investigated if this is needed.
update with workaround details:
—
after discussions on U-Boot mailing list[1] the bug is being rejected on the following grounds:
The 'go' command is working as expected by performing a direct jump to the address specified as the argument i.e no cache/MMU cleanups can be expected from the loaded program/OS.
A workaround for cache coherence issues has been proposed as follows (Upstream should gain support for the necessary cache commands with this patch[2]):
=> dcache flush
=> icache flush
=> dcache off
=> icache off
=> go $loadaddr
Since using the go command for booting an OS is not a supported usecase, we should explore a better way of using u-boot for QNX (do_bootm_qnxelf already exists, perhaps additional support for ifs could be added).
[1]:
https://lore.kernel.org/all/20250430135751.2626849-1-anshuld@ti.com/
https://lore.kernel.org/all/D9DXL95MTQ8I.3EUY0C6M2L4NE@ti.com/
[2]:
https://lore.kernel.org/all/20250502050517.3724756-1-anshuld@ti.com/