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 67DF9EB64DD for ; Sun, 16 Jul 2023 13:08:03 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 36625862DA; Sun, 16 Jul 2023 15:07:46 +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="TqnhwJtq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 73F05801FE; Sun, 16 Jul 2023 10:10:50 +0200 (CEST) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (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 1E220820F2 for ; Sun, 16 Jul 2023 10:10:48 +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-x52a.google.com with SMTP id 4fb4d7f45d1cf-521650a7603so2723419a12.3 for ; Sun, 16 Jul 2023 01:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689495047; x=1692087047; 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=hvte1LAX0sY8Gw9MVfDR/fja3uTHX2F9S+6y1G7Ango=; b=TqnhwJtqsntgDZ8tCIqOPe3jH/Ba2x3wLYtUyK+9vliWNkVum0POxGoxGyJ5Niud8p tQM3m9UrxvQiEzohu04CzIL1L/Xz7c3lPS4zUAl9IweuiJh8DTMNzktrTaXt2KI+qT6O lTBN2GFgpKkktc256sRHH3V6iXHSW2F/6srjb7lx4xnShSOQRV1KzwjHNd6MbaH2YTuz kmJ33P92FVOKVueYuW0rpjAqzDV9q7leXtp/aMup47j5Yv80Q/EOhALtNoWkRN/jyqVb KP/8iYnIQqS3QMYomiH1K5HWykBRIhyjOJlt0M6BPA4ihyVHLimol7Ls4Kfglyl2tr4O jdlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689495047; x=1692087047; 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=hvte1LAX0sY8Gw9MVfDR/fja3uTHX2F9S+6y1G7Ango=; b=L6HkduYMZ0lFZPJ3j3pWPugmD0Q3ExP2Ro/wR+gZfXopSvM3z3MiD3Tl/f9Lfunhef AZVddkYjuJ6cpzMcRQEFtBJX03GBl10HuisXS4Wtaty4FNbLOdNNjOwZm/jkDktdiinx 5S/BxWLwn7mWE7+sO21+Xz+hyS7IQH3t0EvHQLzhE/SVj3X8UYnhUaAyVivJ7lstVmz8 byyI+A2smouiPBrVbq6id6+eyRcoMN/hnydk/0H/LoO7pTYsKuVVs6duRNXTcCVplEnm Hw1w9OFCK4FUvYJzC+ADY7OO2SksiwrU7BHOAuaTqDrKYx2mTpIGO3xRxnPBIiV9LVTd dARQ== X-Gm-Message-State: ABy/qLb7sGtmgXoGJ5qfgagXWeUoldMDV2dDo1KgJYD6vD26dmtm5YU8 S6T+WY83eLE/E9az+1rOiRjQ19l9Ag== X-Google-Smtp-Source: APBJJlHrbIhjdrlNiS0KUO3bPXtBPIRdmCW2Oc46SmMcReVzkw7cSSrMNDVaD86Hxfn5bHkXRTvMWg== X-Received: by 2002:a17:906:dfee:b0:991:e7c3:5712 with SMTP id lc14-20020a170906dfee00b00991e7c35712mr7735147ejc.30.1689495047584; Sun, 16 Jul 2023 01:10:47 -0700 (PDT) Received: from U4.fritz.box ([2001:9e8:b94c:4700:19f7:e833:87a:bd6]) by smtp.gmail.com with ESMTPSA id gr10-20020a170906e2ca00b0098d25cbb899sm7613657ejb.41.2023.07.16.01.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jul 2023 01:10:47 -0700 (PDT) From: Alex Bee To: u-boot@lists.denx.de, Kever Yang , Philipp Tomsich , Simon Glass Cc: Alex Bee Subject: [PATCH v1 1/5] rockchip: Support OP-TEE for ARM in FIT images created by binman Date: Sun, 16 Jul 2023 10:10:30 +0200 Message-ID: <20230716081034.1196995-2-knaerzche@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230716081034.1196995-1-knaerzche@gmail.com> References: <20230716081034.1196995-1-knaerzche@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sun, 16 Jul 2023 15:07:42 +0200 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..36a3fbf3ab 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