Add a concise section for loading and booting the HSM M4F core in TI K3 SoCs like J721S2, J742S2 and J784S4.
Signed-off-by: Beleswar Padhi <[email protected]> Reviewed-by: Udit Kumar <[email protected]> --- v7: Changelog: 1. Included the HSM doc in the applicable board specific files. 2. Carried R/B tag from Udit. Link to v6: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/ v6: Changelog: 1. New patch. Adds documentation for loading and booting the TI K3 HSM M4F remote processor. doc/board/ti/j721s2_evm.rst | 7 ++ doc/board/ti/j784s4_evm.rst | 7 ++ doc/board/ti/k3.rst | 136 ++++++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+) diff --git a/doc/board/ti/j721s2_evm.rst b/doc/board/ti/j721s2_evm.rst index 21683b90b1a..db932447e63 100644 --- a/doc/board/ti/j721s2_evm.rst +++ b/doc/board/ti/j721s2_evm.rst @@ -281,6 +281,13 @@ https://www.ti.com/lit/pdf/spruj68 under the `Bootmode Settings` section. For SW1, the switch state in the "ON" position = 1. +HSM M4F Loading +---------------- + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_hsm_m4f_loading + :end-before: .. k3_rst_include_end_hsm_m4f_loading + Debugging U-Boot ---------------- diff --git a/doc/board/ti/j784s4_evm.rst b/doc/board/ti/j784s4_evm.rst index 54b4b6031f0..179d157206d 100644 --- a/doc/board/ti/j784s4_evm.rst +++ b/doc/board/ti/j784s4_evm.rst @@ -637,6 +637,13 @@ to the J784S4 endpoint: This program copies the boot image to the PCIe endpoint's memory region and writes the necessary control words to signal image transfer completion. +HSM M4F Loading +---------------- + +.. include:: k3.rst + :start-after: .. k3_rst_include_start_hsm_m4f_loading + :end-before: .. k3_rst_include_end_hsm_m4f_loading + Debugging U-Boot ---------------- diff --git a/doc/board/ti/k3.rst b/doc/board/ti/k3.rst index d3ecaf59909..c14d9762490 100644 --- a/doc/board/ti/k3.rst +++ b/doc/board/ti/k3.rst @@ -755,6 +755,142 @@ resorts to enabling for the entire DDR region: bootph-all; }; +HSM M4F Loading +---------------- + +.. k3_rst_include_start_hsm_m4f_loading + +Some K3 SoCs like J721S2, J742S2 and J784S4 have a High Security Module +(HSM) M4F core in the Wakeup Voltage Domain. The HSM M4 core is loaded at +R5 SPL stage. Boot flow for HSM M4 core is different than the general +purpose M4F cores, and is described as below: + +1) Request control of HSM M4F remote processor. +2) Assert Reset on the HSM M4F remote processor. +3) Load firmware into HSM M4F core's SRAM memory region. + + * For HS devices, request TIFS to authenticate and load the firmware. + * For GP devices, load the firmware manually into HSM SRAM. + +4) Deassert Reset on the HSM M4F remote processor. +5) Release control of HSM M4F remote processor. + +This User Guide documents how to enable HSM core loading. + +How to enable HSM M4F Loading +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +By default, only the HSM demo firmware for HS-SE device type is packed in +`tispl.bin` FIT image. See the "How to build U-Boot with custom HSM +firmware" section below to change the default firmware for other device +types. + +R5 SPL supports loading of HSM M4 core for all device types, i.e., HS-SE, +HS-FS, GP. However, this feature is disabled by default. To enable HSM +loading, set the ``CONFIG_K3_HSM_FW`` and +``CONFIG_REMOTEPROC_TI_K3_HSM_M4F`` configs in both +`<soc>_evm_r5_defconfig` and `<soc>_evm_a72_defconfig` files. + +For example, to enable HSM loading on J721S2 device, make the following +changes: + +.. code-block:: diff + + diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig + index 806c97792f6..ebe100c2278 100644 + --- a/configs/j721s2_evm_r5_defconfig + +++ b/configs/j721s2_evm_r5_defconfig + @@ -187,3 +187,4 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 + CONFIG_PANIC_HANG=y + CONFIG_LIB_RATIONAL=y + CONFIG_SPL_LIB_RATIONAL=y + +CONFIG_K3_HSM_FW=y + +CONFIG_REMOTEPROC_TI_K3_HSM_M4F=y + diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig + index 6db41cb457e..a07e6d63270 100644 + --- a/configs/j721s2_evm_a72_defconfig + +++ b/configs/j721s2_evm_a72_defconfig + @@ -198,3 +198,4 @@ CONFIG_UFS=y + CONFIG_CADENCE_UFS=y + CONFIG_TI_J721E_UFS=y + CONFIG_TI_COMMON_CMD_OPTIONS=y + +CONFIG_K3_HSM_FW=y + +CONFIG_REMOTEPROC_TI_K3_HSM_M4F=y + +Proceed to build U-Boot (`tiboot3.bin` and `tispl.bin`). One can verify if +the HSM binary is packed inside `tispl.bin` FIT image by using following +command: + +.. prompt:: bash $ + + mkimage -l <output directory>/a72/tispl.bin + +.. code-block:: console + + <...> + Image 2 (hsm) + Description: HSM binary + Created: Thu Mar 20 13:26:16 2025 + Type: Standalone Program + Compression: uncompressed + Data Size: 132694 Bytes = 129.58 KiB = 0.13 MiB + Architecture: Unknown Architecture + Load Address: 0x82000000 + Entry point: 0x82000000 + <...> + +The HSM core loading can be verified by checking for the following log at +R5 SPL stage: 'Successfully loaded and started HSM core'. + +.. code-block:: console + + U-Boot SPL 2025.01-00391-ga7a25e886202-dirty (Mar 20 2025 - 11:04:05 +0530) + SYSFW ABI: 4.0 (firmware rev 0x000b '11.0.9--v11.00.09+ (Fancy Rat)') + Initialized 4 DRAM controllers + SPL initial stack usage: 13456 bytes + Trying to boot from MMC2 + Authentication passed + Authentication passed + Authentication passed + Loading Environment from nowhere... OK + Successfully loaded and started HSM core + Authentication passed + Authentication passed + Starting ATF on ARM64 core... + +How to build U-Boot with custom HSM firmware +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To pack the firmware for any other device type, one can update the path in +the SoC binman template to point to the custom binary and re-build U-Boot +images (`tispl.bin`). + +`arch/arm/dts/k3-<soc>-binman.dtsi` + +.. code-block:: dts + + hsm { + hsm: blob-ext { + filename = <path_to_custom_binary>; + }; + }; + +For example, To pack the HSM demo firmware for J784S4 HS-FS device type, +make following changes to `arch/arm/dts/k3-j784s4-binman.dtsi` + +.. code-block:: dts + + hsm { + hsm: blob-ext { + filename = "ti-hsm/hsm-demo-firmware-j784s4-hs-fs.bin"; + }; + }; + +A list of all HSM demo firmwares can be found in `ti-linux-firmware +<https://github.com/TexasInstruments/ti-linux-firmware>`_ repository. + +.. k3_rst_include_end_hsm_m4f_loading + .. _k3_rst_refer_openocd: Common Debugging environment - OpenOCD -- 2.34.1
