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 B0666EB64DA for ; Tue, 18 Jul 2023 14:57:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4BF42866DA; Tue, 18 Jul 2023 16:57:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OY9QDx/D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 53D76866DA; Tue, 18 Jul 2023 16:57:21 +0200 (CEST) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BE19B866DF for ; Tue, 18 Jul 2023 16:57:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=knaerzche@gmail.com Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-51e590a8ab5so7925207a12.2 for ; Tue, 18 Jul 2023 07:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689692238; x=1692284238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WX4hRCV1lsjB9We/Sg5tUp+eVWGSGw0ZVT2yG1Mwk04=; b=OY9QDx/DjOjWH2nHa5Q97pZPLLXFoNouzaTcg3p8uS91755AWtjyS+16v4v2NIN5FE kKKOaDXieB19+m0Tmgv33iI/0x9ZesJuZXJcOrgh5Cm6I4khXVW/9ty9+yRaEDn06GaA Aa+epL7kjstl1JTJ7Y1pPMoIEBZQdotlmSYBEoTQBD18/ZYNJbLr6MC7+ak76QMmPX/r IzHwbO6FgXQbvRpvt409mThzKf0du4o3j0CUcB6Fau9FO+nhHxBT4Z2Dg2lrzXIq4DZP JQ9NLmF1fOph2as8DljjBz6fM3Uy/Ki/rI7XAtgOgJZrg+6k/FoC86FNd6LkL97iS+Hf CA5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689692238; x=1692284238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WX4hRCV1lsjB9We/Sg5tUp+eVWGSGw0ZVT2yG1Mwk04=; b=U4SyGX8ZCVwRl7TI3XR61XpTFxoYmM7rTagV6zpe3FkQCz24iMDu5jP2Ut96V4CBmL iKLzMma/LfyDy8fhRwgipRjdvx3rh2KyW1TCeBytcZMSEHegbX9xjZ8tXI/O4qnVA6hN zs2RPRoUr5mUdSyXPWrur2qf6cqqomYSmzai4ueY695MDrXbhg0J3PKZss6eQNs8WSo6 QI6TZT/+0qIz80LfzudBlK/lj5LRaPQClO8IbvSy1kwnAV9CiBk0alEZDO4zPe2J1doC NJdlnQnwBbGUHbhS3Fc6KdTeS1C7IroitnAknq0bnQN7jW7jEZTqROVXxO2c0yWebJC4 HapQ== X-Gm-Message-State: ABy/qLYvEU5wRrTSX3tgDHleEnrXn/wB5Iq+D+Uc1AqiFlBWFAXKhMPk 1NCHN9gRJrwPYGY/ZzQ8Tum8bzJFuQ== X-Google-Smtp-Source: APBJJlG4jV7wz2wx56KdLa4ZTTCgG3Qz2noZzccKYWpvTSJ0hP0sSE2zE8va3CWVGAok7NZNIxkZ0Q== X-Received: by 2002:aa7:d50b:0:b0:521:a86d:d596 with SMTP id y11-20020aa7d50b000000b00521a86dd596mr173858edq.7.1689692238296; Tue, 18 Jul 2023 07:57:18 -0700 (PDT) Received: from U4.fritz.box ([2001:9e8:b960:df00:3afe:540e:d7ee:98ac]) by smtp.gmail.com with ESMTPSA id f25-20020aa7d859000000b0051de20c59d7sm1340797eds.15.2023.07.18.07.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 07:57:18 -0700 (PDT) From: Alex Bee To: u-boot@lists.denx.de, Kever Yang , Philipp Tomsich , Simon Glass Cc: Alex Bee Subject: [PATCH v2 1/5] rockchip: Support OP-TEE for ARM in FIT images created by binman Date: Tue, 18 Jul 2023 16:57:11 +0200 Message-ID: <20230718145715.1280201-2-knaerzche@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718145715.1280201-1-knaerzche@gmail.com> References: <20230716081034.1196995-1-knaerzche@gmail.com> <20230718145715.1280201-1-knaerzche@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 CONFIG_SPL_OPTEE_IMAGE option is used during DRAM size detection for Rockchip ARM platform to indicate that an OP-TEE binary was already loaded and a Trusted Execution Environment (TEE) is available in order to block/reserve a memory-region for it. This adds a bunch of new `#if's` to u-boot-rockchip.dtsi to include the OP-TEE binary in the FIT image for ARM SOCs if CONFIG_SPL_OPTEE_IMAGE is selected. That makes it a little harder to read, but I opted for that, because all the duplicates in an extra ARM-OP-TEE-specfic .dtsi would be the greater evil, IMHO. Besides it's more likley being "forgotten" to sync when changes in u-boot-rockchip.dtsi are made. The no longer required rockchip-optee.dtsi and it's inclusions are dropped. The hardcoded load address is common across all OP-TEE implemenations for Rockchip (vendor and upstream). The OP-TEE-binary is non-optional if CONFIG_SPL_OPTEE_IMAGE is selected and there will be an error if the file does not exist and/or `TEE=` build option is missing. Signed-off-by: Alex Bee --- arch/arm/dts/rk3288-u-boot.dtsi | 1 - arch/arm/dts/rockchip-optee.dtsi | 64 ------------------------------- arch/arm/dts/rockchip-u-boot.dtsi | 38 ++++++++++++++++-- 3 files changed, 35 insertions(+), 68 deletions(-) delete mode 100644 arch/arm/dts/rockchip-optee.dtsi diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi index 1920698884..c4c5a2d225 100644 --- a/arch/arm/dts/rk3288-u-boot.dtsi +++ b/arch/arm/dts/rk3288-u-boot.dtsi @@ -4,7 +4,6 @@ */ #include "rockchip-u-boot.dtsi" -#include "rockchip-optee.dtsi" / { aliases { diff --git a/arch/arm/dts/rockchip-optee.dtsi b/arch/arm/dts/rockchip-optee.dtsi deleted file mode 100644 index d84c10cf43..0000000000 --- a/arch/arm/dts/rockchip-optee.dtsi +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright 2020 Google LLC - */ - -#include - -#if defined(CONFIG_HAS_ROM) && defined(CONFIG_FIT) -&binman { - itb { - filename = "u-boot.itb"; - fit { - fit,external-offset = ; - description = "FIT image with OP-TEE support"; - #address-cells = <1>; - - images { - uboot { - description = "U-Boot"; - type = "standalone"; - os = "U-Boot"; - arch = "arm"; - compression = "none"; - load = ; - - u-boot-nodtb { - }; - }; - optee { - description = "OP-TEE"; - type = "firmware"; - arch = "arm"; - os = "tee"; - compression = "none"; - load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>; - entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>; - - blob-ext { - filename = "tee.bin"; - }; - }; - fdt { - description = CONFIG_SYS_BOARD; - type = "flat_dt"; - compression = "none"; - - u-boot-dtb { - }; - }; - }; - - configurations { - default = "conf"; - conf { - description = CONFIG_SYS_BOARD; - firmware = "optee"; - loadables = "uboot"; - fdt = "fdt"; - }; - }; - }; - }; -}; -#endif diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi index 2878b80926..be2658e8ef 100644 --- a/arch/arm/dts/rockchip-u-boot.dtsi +++ b/arch/arm/dts/rockchip-u-boot.dtsi @@ -33,9 +33,13 @@ }; }; -#if defined(CONFIG_SPL_FIT) && defined(CONFIG_ARM64) +#if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE)) fit: fit { +#ifdef CONFIG_ARM64 description = "FIT image for U-Boot with bl31 (TF-A)"; +#else + description = "FIT image with OP-TEE"; +#endif #address-cells = <1>; fit,fdt-list = "of-list"; filename = "u-boot.itb"; @@ -44,10 +48,14 @@ offset = ; images { u-boot { - description = "U-Boot (64-bit)"; + description = "U-Boot"; type = "standalone"; os = "U-Boot"; +#ifdef CONFIG_ARM64 arch = "arm64"; +#else + arch = "arm"; +#endif compression = "none"; load = ; entry = ; @@ -60,6 +68,7 @@ #endif }; +#ifdef CONFIG_ARM64 @atf-SEQ { fit,operation = "split-elf"; description = "ARM Trusted Firmware"; @@ -99,6 +108,25 @@ }; #endif }; +#else + op-tee { + description = "OP-TEE"; + type = "tee"; + arch = "arm"; + os = "tee"; + compression = "none"; + load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>; + entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>; + + tee-os { + }; +#ifdef CONFIG_SPL_FIT_SIGNATURE + hash { + algo = "sha256"; + }; +#endif + }; +#endif @fdt-SEQ { description = "fdt-NAME"; @@ -117,7 +145,11 @@ @config-SEQ { description = "NAME.dtb"; fdt = "fdt-SEQ"; +#ifdef CONFIG_ARM64 fit,firmware = "atf-1", "u-boot"; +#else + fit,firmware = "op-tee", "u-boot"; +#endif fit,loadables; }; }; @@ -150,7 +182,7 @@ }; }; -#ifdef CONFIG_ARM64 +#if defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE) fit { type = "blob"; filename = "u-boot.itb"; -- 2.41.0