Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A8D7C5AD49 for ; Tue, 3 Jun 2025 14:27:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2636F829B2; Tue, 3 Jun 2025 16:25:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="PJRayMbP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B5AB682AE1; Tue, 3 Jun 2025 16:25:46 +0200 (CEST) Received: from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A3CF382B8E for ; Tue, 3 Jun 2025 16:25:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=anshuld@ti.com Received: from fllvem-sh03.itg.ti.com ([10.64.41.86]) by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTP id 553EPfDB3536198; Tue, 3 Jun 2025 09:25:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1748960741; bh=4Ytt4lIBbZj6a3/JrbFn5v8jUpVPkngIoeAHIO50Yao=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PJRayMbPubgU9GOm+snipeAN3DCVPV/vvTovdzsYKXlkr9GCU21mAMtIQlIxXnvQm Wu73NUamPoxIIKI4pa/lX7D+vV6JULrYXVfxMk+T9mjiobfcH4hpPN43EQdx9cCWwh Rx3hIO8EFYzjS/5AuOp5ivqIs95xokz5MsuIVGCY= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllvem-sh03.itg.ti.com (8.18.1/8.18.1) with ESMTPS id 553EPfIj3585500 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=FAIL); Tue, 3 Jun 2025 09:25:41 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 3 Jun 2025 09:25:41 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 3 Jun 2025 09:25:41 -0500 Received: from localhost (dhcp-172-24-227-250.dhcp.ti.com [172.24.227.250]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 553EPeBT559592; Tue, 3 Jun 2025 09:25:40 -0500 From: Anshul Dalal To: CC: Anshul Dalal , , , , , , , , Subject: [PATCH v7 10/10] doc: ti: am62: add falcon mode documentation Date: Tue, 3 Jun 2025 19:54:50 +0530 Message-ID: <20250603142452.2707171-11-anshuld@ti.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250603142452.2707171-1-anshuld@ti.com> References: <20250603142452.2707171-1-anshuld@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This patch adds user documentation for falcon boot for am62 platforms. The main section is added to am62x_sk.rst and other documents just include the section. Steps to build falcon support, usage and the modified R5 memory map have been documented. Two svg images have also been added for reference, one for the modified tispl_falcon.bin and other for the falcon specific fitImage format. Signed-off-by: Anshul Dalal --- doc/board/ti/am62ax_sk.rst | 7 + doc/board/ti/am62px_sk.rst | 7 + doc/board/ti/am62x_sk.rst | 289 ++++++++++++++++++ doc/board/ti/img/fitImage_falcon.svg | 180 +++++++++++ .../ti/img/tifsstub_dm_tispl_falcon.bin.svg | 285 +++++++++++++++++ 5 files changed, 768 insertions(+) create mode 100644 doc/board/ti/img/fitImage_falcon.svg create mode 100644 doc/board/ti/img/tifsstub_dm_tispl_falcon.bin.svg diff --git a/doc/board/ti/am62ax_sk.rst b/doc/board/ti/am62ax_sk.rst index 43a1db68873..01e252ed1b9 100644 --- a/doc/board/ti/am62ax_sk.rst +++ b/doc/board/ti/am62ax_sk.rst @@ -192,6 +192,13 @@ https://www.ti.com/lit/pdf/spruj16 under the `Boot Mode Pins` section. For SW2 and SW1, the switch state in the "ON" position = 1. +Falcon Mode +----------- + +AM62A platforms support falcon mode, bypassing A-core SPL and u-boot to reduce +boot times. See :ref:`falcon mode` section on AM62 platforms page for detailed build +information. + Debugging U-Boot ---------------- diff --git a/doc/board/ti/am62px_sk.rst b/doc/board/ti/am62px_sk.rst index a07d6a4da45..917e3b904a0 100644 --- a/doc/board/ti/am62px_sk.rst +++ b/doc/board/ti/am62px_sk.rst @@ -290,6 +290,13 @@ https://www.ti.com/lit/pdf/spruj83 under the `Boot Mode Pins` section. For SW2 and SW1, the switch state in the "ON" position = 1. +Falcon Mode +----------- + +AM62P platforms support falcon mode, bypassing A-core SPL and u-boot to reduce +boot times. See :ref:`falcon mode` section on AM62 platforms page for detailed build +information. + Debugging U-Boot ---------------- diff --git a/doc/board/ti/am62x_sk.rst b/doc/board/ti/am62x_sk.rst index dab2970a85c..49c5fc8e06d 100644 --- a/doc/board/ti/am62x_sk.rst +++ b/doc/board/ti/am62x_sk.rst @@ -526,6 +526,295 @@ Next, based on NET_VCI_STRING string mentioned in respective defconfig file `tib fetches `tispl.bin` and then `tispl.bin` fetches `u-boot.img` from TFTP server which completes Ethernet boot on the device. +.. _am62x_evm_falcon_mode_start: + +Falcon Mode +----------- + +Falcon boot flow on am62 platforms bypasses the A-core SPL and u-boot with the +overall boot flow as below: + +**Normal boot flow:** + +* R5 SPL -> ATF -> OP-TEE -> Cortex-A SPL -> U-Boot -> Kernel + +**With falcon mode:** + +* R5 SPL -> ATF -> OP-TEE -> Kernel + +Build Process +^^^^^^^^^^^^^ + +Enabling falcon mode requires re-building ATF, U-boot and the kernel fitImage +as follows: + +0. Setup environment variables: +""""""""""""""""""""""""""""""" + +Refer to the :ref:`build procedure` above for setting up the +environment variables. + +1. Trusted Firmware-A: +"""""""""""""""""""""" + +The R5 SPL in falcon mode loads the kernel at ``0x82000000`` and the +corresponding DTB at ``0x88000000``. Therefore ATF needs to be rebuild with +changes to the respective addresses. + +.. prompt:: bash $ + + # Change load addresses for the kernel and DTB + export TFA_EXTRA_ARGS="PRELOADED_BL33_BASE=0x82000000 K3_HW_CONFIG_BASE=0x88000000" + +.. include:: ../ti/k3.rst + :start-after: .. k3_rst_include_start_build_steps_tfa + :end-before: .. k3_rst_include_end_build_steps_tfa + +2. U-Boot: +"""""""""" + +* **2.1 R5:** + +.. prompt:: bash $ + + # use the common falcon config fragment for am62 platforms + export $UBOOT_FALCON_CFG_FRAGMENTR="am62x_r5_falcon.config" + export UBOOT_CFG_CORTEXR="${UBOOT_CFG_CORTEXR} ${UBOOT_FALCON_CFG_FRAGMENTR}" + +.. include:: ../ti/k3.rst + :start-after: .. k3_rst_include_start_build_steps_spl_r5 + :end-before: .. k3_rst_include_end_build_steps_spl_r5 + +* **2.2 A53:** + +After rebuilding ATF, the binary needs to be repackaged inside the tispl +binaries: + +.. include:: ../ti/k3.rst + :start-after: .. k3_rst_include_start_build_steps_uboot + :end-before: .. k3_rst_include_end_build_steps_uboot + +3. fitImage: +"""""""""""" + +.. warning:: + + The ``fitImage`` available by default under ``boot/fitImage`` in rootfs of + the standard SDK release is not compatible with falcon mode. + +For secure boot in falcon mode, the compute heavy authentication required for +the ``fitImage`` is offloaded from the slower R5 core to TIFS. This requires +``fitImage`` to package the necessary binaries (kernel and dtb) with a +pre-signed x509 certificate. + +**fitImage for falcon mode:** + +.. image:: img/fitImage_falcon.svg + :alt: fitImage for falcon boot image format + +* **Sources** + + * **Core Secdev K3** + + | **source:** https://git.ti.com/cgit/security-development-tools/core-secdev-k3 + | **branch:** master + +**Follow the steps below to create a falcon compatible fitImage:** + +**3.1 Environment setup** + +.. prompt:: bash $ + + export DTB=path/to/dtb + export IMAGE=path/to/kernel-image + +**3.2 fitImage creation** + + An Image tree source (*its*) file describes the structure and contents of the + final image produced by the mkimage tool. + + To create the ``fitImage`` for falcon mode, create a file ``fitImage.its`` + with the following contents inside the ``core-secdev-k3`` source directory,: + +.. code-block:: dts + + /dts-v1/; + + / { + description = "Kernel fitImage for falcon mode"; + #address-cells = <1>; + + images { + kernel-1 { + description = "Linux kernel"; + data = /incbin/("Image.sec"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "none"; + load = <0x82000000>; + entry = <0x82000000>; + }; + falcon.dtb { + description = "Flattened Device Tree blob"; + data = /incbin/("falcon.dtb.sec"); + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + load = <0x88000000>; + entry = <0x88000000>; + }; + }; + + configurations { + default = "conf-falcon"; + conf-falcon { + description = "Pre-signed Kernel and DTB"; + kernel = "kernel-1"; + fdt = "falcon.dtb"; + }; + }; + }; + +Sign the kernel and dtb using ``secure-binary-image.sh`` and create the +``fitImage`` using mkimage: + +.. prompt:: bash $ + + # inside core-secdev-k3 source + cp $IMAGE Image + cp $DTB falcon.dtb + ./scripts/secure-binary-image.sh Image Image.sec + ./scripts/secure-binary-image.sh falcon.dtb falcon.dtb.sec + mkimage -f fitImage.its fitImage + +Usage +^^^^^ + +Falcon mode makes use of a cut down variant of the tispl binary called +``tispl_falcon.bin`` with the Cortex-A SPL and it's corresponding DTBs removed. +This file should be present alongside the existing ``tispl.bin`` after building +U-Boot for the Cortex-A cores. + +- **tispl_falcon.bin** + +.. image:: img/tifsstub_dm_tispl_falcon.bin.svg + :alt: tispl_falcon.bin image format + +1. eMMC/SD Boot: +"""""""""""""""" + +Falcon mode for K3 devices only supports SD and eMMC in FS boot. The R5 SPL +once loaded from the ``tiboot3.bin`` file from the boot partition looks for +``tispl_falcon.bin``, the DTB and fitImage (or kernel image for unauthenticated +boot) inside the boot directory of the second partition (rootfs). + +.. list-table:: + :widths: 8 8 8 25 + :header-rows: 1 + + * - File + - Copy path on SD/eMMC + - Partition + - Description + + * - ``tiboot3.bin`` + - ``/tiboot3.bin`` + - boot (fat) + - R5 SPL with falcon support + + * - ``tispl_falcon.bin`` + - ``/boot/tispl_falcon.bin`` + - rootfs (ext4) + - tispl binary without SPL for the A core and DTB + + * - ``fitImage`` + - ``/boot/fitImage`` + - rootfs (ext4) + - kernel and dtb fitImage with pre-signed binaries + +2. OSPI Boot: +""""""""""""" + +For OSPI boot, the ``tiboot3.bin`` and ``tispl_falcon.bin`` files should be +flashed to the same addresses in flash as regular boot flow but the DTB and the +fitImage (or kernel image for unauthenticated boot) are read from the rootfs's +boot directory. + +Below commands can be used to download ``tiboot3.bin`` and ``tispl_falcon.bin`` +over tftp and then flash those to OSPI at their respective addresses. + +.. prompt:: bash => + + sf probe + tftp ${loadaddr} tiboot3.bin + sf update $loadaddr 0x0 $filesize + tftp ${loadaddr} tispl_falcon.bin + sf update $loadaddr 0x80000 $filesize + +R5 SPL Memory Map: +^^^^^^^^^^^^^^^^^^ + +Standard boot: +"""""""""""""" + +.. code-block:: + + 0x80000000 +-------------------------------+ Start of DDR + 512KiB | ATF reserved memory space | CONFIG_K3_ATF_LOAD_ADDR + | | + 0x80080000 +-------------------------------+ PRELOADED_BL33_BASE in ATF + 29.5MiB | A53 SPL + DTB + | CONFIG_SPL_LOAD_FIT_ADDRESS + | Download region for FIT in DFU| + 0x81e00000 +-------------------------------+ + | R5 U-Boot SPL Stack + Heap | + 2MiB | (size defined by | + | SPL_STACK_R_MALLOC_SIMPLE_LEN)| + 0x82000000 +-------------------------------+ CONFIG_SPL_STACK_R_ADDR + 112MiB | Unused | + 0x89000000 +-------------------------------+ + 331MiB | Device Manager (DM) Load Addr | + 0x9db00000 +-------------------------------+ + 12MiB | DM Reserved | + 0x9e700000 +-------------------------------+ + 1MiB | Unused | + 0x9e800000 +-------------------------------+ BL32_BASE in ATF + 24MiB | OPTEE | + 0xa0000000 +-------------------------------+ End of DDR (512MiB) + +Falcon mode: +"""""""""""" + +.. code-block:: + + 0x80000000 +-------------------------------+ Start of DDR + 512KiB | ATF reserved memory space | CONFIG_K3_ATF_LOAD_ADDR + 0x80080000 +-------------------------------+ + 31.5MiB | Unused | + 0x82000000 +-------------------------------+ PRELOADED_BL33_BASE in ATF + | | CONFIG_SYS_LOAD_ADDR + 57MiB | Kernel + initramfs Image | CONFIG_SPL_LOAD_FIT_ADDRESS + | | + 0x85900000 +-------------------------------+ + | | + | R5 U-Boot SPL Stack + Heap | + 39MiB | (size defined by | + | SPL_STACK_R_MALLOC_SIMPLE_LEN)| + | | + 0x88000000 +-------------------------------+ CONFIG_SPL_STACK_R_ADDR + | | K3_HW_CONFIG_BASE in ATF + 16MiB | Kernel DTB | CONFIG_SPL_PAYLOAD_ARGS_ADDR + | | + 0x89000000 +-------------------------------+ + 331MiB | Device Manager (DM) Load Addr | + 0x9db00000 +-------------------------------+ + 12MiB | DM Reserved | + 0x9e700000 +-------------------------------+ + 1MiB | Unused | + 0x9e800000 +-------------------------------+ BL32_BASE in ATF + 24MiB | OPTEE | + 0xa0000000 +-------------------------------+ End of DDR (512MiB) + Debugging U-Boot ---------------- diff --git a/doc/board/ti/img/fitImage_falcon.svg b/doc/board/ti/img/fitImage_falcon.svg new file mode 100644 index 00000000000..a22e0f6564e --- /dev/null +++ b/doc/board/ti/img/fitImage_falcon.svg @@ -0,0 +1,180 @@ + + + + + + + + + + + + + x509 Certificate + x509 Certificate + Fit Header + Kernel Image + + + + + DTB + + + + + + + + diff --git a/doc/board/ti/img/tifsstub_dm_tispl_falcon.bin.svg b/doc/board/ti/img/tifsstub_dm_tispl_falcon.bin.svg new file mode 100644 index 00000000000..7e2793c2ed9 --- /dev/null +++ b/doc/board/ti/img/tifsstub_dm_tispl_falcon.bin.svg @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + FIT Header + + + + FIT Header + + + + + + + + + TIFS Stub + +(GP, HS-FS, HS-SE) + + + + TIFS Stub... + + + + + + + + + TF-A + + + + TF-A + + + + + + + + + OP-TEE + + + + OP-TEE + + + + + + + + + R5 DM FW + + + + R5 DM FW + + + + + + + Text is not SVG - cannot display + + + -- 2.49.0