Linux SDK v10.0: U-Boot "go" command needs Linux Kernel-like cache/MMU cleanup so 3rd Party OS can startup correctly

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: High
    • Linux Core SDK
    • LCPD-41069
    • 10.00
    • 11.01
    • Hide
      am62axx_sk-fs
      am62axx_sk-se
      am62lxx_evm-fs
      am62lxx_evm-se
      am62pxx_sk-fs
      am62pxx_sk-se
      am62xx_lp_sk-fs
      am62xx_lp_sk-se
      am62xx_p0_sk-fs
      am62xx_sk-fs
      am62xx_sk-se
      am62xxsip_sk-fs
      am62xxsip_sk-se
      am64xx-evm
      am64xx-hsevm
      am64xx-hssk
      am64xx_evm-se
      am64xx_sk-fs
      am64xx_sk-se
      am654x-evm
      am654x-hsevm
      am654x-idk
      am68_sk-fs
      am68_sk-se
      am69_sk-fs
      bbai
      bbai64-gp
      j7200-evm
      j7200-hsevm
      j721e-idk-gw
      j721s2-evm
      j721s2-hsevm
      j722s_evm-fs
      j722s_evm-se
      j784s4-evm
      j784s4-hsevm
      Show
      am62axx_sk-fs am62axx_sk-se am62lxx_evm-fs am62lxx_evm-se am62pxx_sk-fs am62pxx_sk-se am62xx_lp_sk-fs am62xx_lp_sk-se am62xx_p0_sk-fs am62xx_sk-fs am62xx_sk-se am62xxsip_sk-fs am62xxsip_sk-se am64xx-evm am64xx-hsevm am64xx-hssk am64xx_evm-se am64xx_sk-fs am64xx_sk-se am654x-evm am654x-hsevm am654x-idk am68_sk-fs am68_sk-se am69_sk-fs bbai bbai64-gp j7200-evm j7200-hsevm j721e-idk-gw j721s2-evm j721s2-hsevm j722s_evm-fs j722s_evm-se j784s4-evm j784s4-hsevm
    • 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/

            Assignee:
            TI User
            Reporter:
            TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Connection: Intermediate to External PROD System
                EXTSYNC-4866 - Linux SDK v10.0: U-Boot "go" comman...
                SYNCHRONIZED
                • Last Sync Date: