This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDS64EVM: Boot Linux and Baremetal from R5 SBL - Authentication failed

Part Number: TMDS64EVM

Tool/software:

What i try to achieve is booting Linux and a bare metal application from a custom r5 sbl. The bootloader is loaded from OSPI Flash and a linux appimage is also located in the ospi flash. 

The Linux system itself is located on a sd card. Booting directly from the SD Card works without problems. 

The R5 SBl and the linux appimage use the Version 10.1.7 (Fiery Fox) of the SYSFW.

So my Problem is that if the self reset of the R5 core (start of the bare metal application) occurs promptly after the A53 start, i run in the following Problem on the linux side:

NOTICE:  BL31: v2.10.9(release):lts-v2.10.9
NOTICE:  BL31: Built : 10:13:43, Dec  6 2024

U-Boot SPL 2024.04-00015-g1f034d8945 (Dec 09 2024 - 09:16:08 +0100)
SYSFW ABI: 4.0 (firmware rev 0x000a '10.1.7--v10.01.07 (Fiery Fox)')
Trying to boot from MMC2
ti_sci system-controller@44043000: Message not acknowledged
Authentication failed!
### ERROR ### Please RESET the board ###

But if some time has passend in between the a35 start and the R5 reset (aprox. 2-3s), then u-boot is able to authenticate and load the linux kernel.

I am not quite sure what is causing the Problem here. For me it seems like something breaks through the r5 self reset.

I also tried to removed everything but i while(true) loop from the bare metal application to verify that this the initialization is not the Problem.

It would be great if someone could give me a hint what could be the problem.

Thanks! 

Alex

  • Hi Alex,

    What is the SBL you are using here? Is it SBL_OSPI or SBL_OSPI_LINUX or your custom SBL?

    Thanks,

    Prashant

  • Hello Prashant,

    The custom SBL is based on SBL_OSPI and got extended with the Linux Boot commands from SBL_OSPI_LINUX. 

    This is my code for the linux start:

    #include "linuxboot.h"
    #include "bootConfig.h"
    #include <drivers/bootloader/soc/bootloader_soc.h>
    #include <drivers/pinmux.h>
    
    Bootloader_FlashArgs gBootloaderLinuxArgs = {
        .flashIndex = 0xFF,
        .curOffset = 0,
        .appImageOffset = 0x300000,
    };
    /* Workaround to initialize MMC SD Pinmux (Later will be done in SPL) */
    static Pinmux_PerCfg_t gPinMuxMMCSDCfg[] = {
        /* MyMMC11 -> MMC1_CMD -> J19 */
        { PIN_MMC1_CMD, PIN_MODE(0) | ((PIN_PULL_DIRECTION | PIN_INPUT_ENABLE) & (~PIN_PULL_DISABLE)) },
        /* MyMMC11 -> MMC1_CLK -> L20 */
        { PIN_MMC1_CLK, PIN_MODE(0) | ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) },
        /* MyMMC11 -> MMC1_CLKLB */
        { PIN_MMC1_CLKLB, PIN_MODE(0) | ((PIN_PULL_DIRECTION | PIN_INPUT_ENABLE) & (~PIN_PULL_DISABLE)) },
        /* MyMMC11 -> MMC1_DAT0 -> K21 */
        { PIN_MMC1_DAT0, PIN_MODE(0) | ((PIN_PULL_DIRECTION | PIN_INPUT_ENABLE) & (~PIN_PULL_DISABLE)) },
        /* MyMMC11 -> MMC1_DAT1 -> L21 */
        { PIN_MMC1_DAT1, PIN_MODE(0) | ((PIN_PULL_DIRECTION | PIN_INPUT_ENABLE) & (~PIN_PULL_DISABLE)) },
        /* MyMMC11 -> MMC1_DAT2 -> K19 */
        { PIN_MMC1_DAT2, PIN_MODE(0) | ((PIN_PULL_DIRECTION | PIN_INPUT_ENABLE) & (~PIN_PULL_DISABLE)) },
        /* MyMMC11 -> MMC1_DAT3 -> K18 */
        { PIN_MMC1_DAT3, PIN_MODE(0) | ((PIN_PULL_DIRECTION | PIN_INPUT_ENABLE) & (~PIN_PULL_DISABLE)) },
        /* MyMMC11 -> MMC1_SDCD -> D19 */
        { PIN_MMC1_SDCD, PIN_MODE(0) | ((PIN_PULL_DIRECTION | PIN_INPUT_ENABLE) & (~PIN_PULL_DISABLE)) },
    
        { PINMUX_END, (uint32_t)PINMUX_END }
    };
    // uint8_t gScratchMemPtr[0xDA700];
    
    int32_t App_loadLinuxImages(Bootloader_Handle bootHandle, Bootloader_BootImageInfo* bootImageInfo )
    {
        int32_t status = SystemP_FAILURE;
    
        if (bootHandle != NULL)
        {
            status = Bootloader_parseAndLoadLinuxAppImage(bootHandle, bootImageInfo);
    
            if (status == SystemP_SUCCESS)
            {
                bootImageInfo->cpuInfo[CSL_CORE_ID_A53SS0_0].clkHz = Bootloader_socCpuGetClkDefault(CSL_CORE_ID_A53SS0_0);
                status = Bootloader_loadCpu(bootHandle, &(bootImageInfo->cpuInfo[CSL_CORE_ID_A53SS0_0]));
            }
        }
        return status;
    }
    
    int32_t App_runLinuxCpu(Bootloader_Handle bootHandle, Bootloader_BootImageInfo* bootImageInfo)
    {
        int32_t status = SystemP_FAILURE;
    
        /* Initialize GTC by enabling using Syscfg */
    
        /* Change the dev stat register to SD card bootmode so that SPL loads uBoot and linux kernel from SD card */
        SOC_setDevStat(SOC_BOOTMODE_MMCSD);
    
        /* Enable pinmux for MMCSD (Workaround as MMC SD pinmux is not initialized in A53 SPL) */
        Pinmux_config(gPinMuxMMCSDCfg, PINMUX_DOMAIN_ID_MAIN);
    
        /* Unlock all the control MMRs. Linux/U-boot expects all the MMRs to be unlocked */
        SOC_unlockAllMMR();
    
        status = Bootloader_runCpu(bootHandle, &(bootImageInfo->cpuInfo[CSL_CORE_ID_A53SS0_0]));
    
        return status;
    }
    void* operatingMode = NULL;
    
    Bootloader_Config bootConfigLinux = {
        .fxns = &gBootloaderFlashFxns,
        .args = &gBootloaderLinuxArgs,
        .bootMedia = BOOTLOADER_MEDIA_FLASH,
        .bootImageSize = 0,
        .coresPresentMap = 0,
        .scratchMemPtr = NULL, // gScratchMemPtr,
        .socCoreOpMode = (void*)&operatingMode,
        .isAppimageSigned = TRUE,
        .disableAppImageAuth = TRUE,
        .initICSSCores = TRUE,
    };
    Bootloader_Handle        gBootHandleLinux;
    Bootloader_BootImageInfo gBootImageInfoLinux;
    Bootloader_Params        gBootParamsLinux;
    
    
    void custom_linux_load(OSPI_Handle ospi_handle)
    {
        int status = 0;
    
    
        Bootloader_Params_init(&gBootParamsLinux);
        Bootloader_BootImageInfo_init(&gBootImageInfoLinux);
    
    
        gBootHandleLinux = CustomBootloader_open(&bootConfigLinux, &gBootParamsLinux);
    
        if (gBootHandleLinux != NULL)
        {
            status = App_loadLinuxImages(gBootHandleLinux, &gBootImageInfoLinux, ospi_handle);
            if (status != SystemP_SUCCESS)
            {
                return;
            }
        }
        else
        {
        }
    }
    
    void custom_linux_start()
    {
        int status = App_runLinuxCpu(gBootHandleLinux, &gBootImageInfoLinux);
    
    }
    

    It is in a separate source file and in the custom sbl, i just call custom_linux_load() and custom_linux_start(). 

    Best regards

    Alex

  • After some research in U-boot i see that uboot fails in the file arch/arm/mach-k3/security.c when trying to validate the image. 

    ret = proc_ops->proc_auth_boot_image(ti_sci, &image_addr, &image_size);
    is the call that fails. 
    I have no idea why a reboot of the r5 core prevents uboot to validate the image
  • Hi Alex,

    The custom SBL is based on SBL_OSPI

    This explains the issue.

    The `Bootloader_socCpuResetReleaseSelf` function as part of the self reset sequence requests the SYSFW for Security Handover.

    github.com/.../bootloader_soc.c

    If it is successful then the SYSFW relinquishes all the security services including PROC_AUTH_BOOT message. This results in the SYSFW NACKing any request for security service.

    There are two solutions for this issue:

    - Comment the `Bootloader_socSecHandover` function call in the `Bootloader_socCpuResetReleaseSelf` function.

    OR

    - Modify the Secure board configurations with the following patch to disable the Security Handover feature altogether.

    diff --git a/source/drivers/sciclient/sciclient_default_boardcfg/am64x/sciclient_defaultBoardcfg_security.c b/source/drivers/sciclient/sciclient_default_boardcfg/am64x/sciclient_defaultBoardcfg_security.c
    index b37b1aa4..e5d5af3b 100755
    --- a/source/drivers/sciclient/sciclient_default_boardcfg/am64x/sciclient_defaultBoardcfg_security.c
    +++ b/source/drivers/sciclient/sciclient_default_boardcfg/am64x/sciclient_defaultBoardcfg_security.c
    @@ -257,8 +257,8 @@ __attribute__(( aligned(128), section(".boardcfg_data") )) =
                 .magic = TISCI_BOARDCFG_SEC_HANDOVER_CFG_MAGIC_NUM,
                 .size = sizeof(struct tisci_boardcfg_sec_handover),
             },
    -        .handover_msg_sender = TISCI_HOST_ID_MAIN_0_R5_0,
    -        .handover_to_host_id = TISCI_HOST_ID_MAIN_0_R5_0,
    +        .handover_msg_sender = 0,
    +        .handover_to_host_id = 0,
             .rsvd = {0, 0, 0, 0},
         },
     
    

    ----------------------------------------------------------

    Please note this issue is not there with the SBL_OSPI_LINUX as this SBL uses different board configurations, where the security handover feature is disabled by default, than the normal SBLs.

    --- ./source/drivers/sciclient/sciclient_default_boardcfg/am64x/sciclient_defaultBoardcfg_security.c	2024-12-10 11:24:53.171438359 +0530
    +++ ./source/drivers/sciclient/sciclient_default_boardcfg/am64x/sciclient_defaultBoardcfg_security_linux.c	2024-08-04 07:20:17.000000000 +0530
    ...
    @@ -258,10 +126,7 @@
                 .size = sizeof(struct tisci_boardcfg_sec_handover),
             },
    -        .handover_msg_sender = TISCI_HOST_ID_MAIN_0_R5_0,
    -        .handover_to_host_id = TISCI_HOST_ID_MAIN_0_R5_0,
    -        .rsvd = {0, 0, 0, 0},
    +		.handover_msg_sender = 0,
    +		.handover_to_host_id = 0,
    +		.rsvd = {0,0,0,0},
         },
    -
     };
    -
    -
    

    So, another solution is to just use the Linux board configurations in your SBL.

    --- ./examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/ti-arm-clang/makefile	2024-12-04 13:07:12.639416480 +0530
    +++ ./examples/drivers/boot/sbl_ospi_linux/am64x-evm/r5fss0-0_nortos/ti-arm-clang/makefile	2024-09-19 15:32:14.737729016 +0530
    ...
    @@ -255,7 +255,7 @@
     SYSFW_PATH=$(MCU_PLUS_SDK_PATH)/source/drivers/sciclient/soc/am64x_am243x
     SYSFW_LOAD_ADDR=0x44000
     BOARDCFG_LOAD_ADDR=0x7B000
    -BOARDCFG_BLOB=$(MCU_PLUS_SDK_PATH)/source/drivers/sciclient/sciclient_default_boardcfg/am64x/boardcfg_blob.bin
    +BOARDCFG_BLOB=$(MCU_PLUS_SDK_PATH)/source/drivers/sciclient/sciclient_default_boardcfg/am64x/boardcfg_blob_linux.bin
     
     
     SBL_RUN_ADDRESS=0x70000000
    ...

    Regards,

    Prashant