From patchwork Sat Feb 19 18:50:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 1595075 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=JEPZyOvt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K1Hgm6MJVz9sFq for ; Sun, 20 Feb 2022 05:50:26 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B1B4C83764; Sat, 19 Feb 2022 19:50:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="JEPZyOvt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D2585837EF; Sat, 19 Feb 2022 19:50:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (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 CA11083381 for ; Sat, 19 Feb 2022 19:50:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rogerq@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 695F6B80881; Sat, 19 Feb 2022 18:50:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE7C4C004E1; Sat, 19 Feb 2022 18:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645296609; bh=ZSWEFV3xinIQdDMJ7rK2aHsIyXh/Gq1RK1WJlYOc1uU=; h=From:To:Cc:Subject:Date:From; b=JEPZyOvtRV4IJf+i8sZi7kD70H0p0xh8zRqYhZhUFxDiDXXaiVaGneFfVee7Ynglh z/fax1mN2g8mlFZ1rTw4RI3v6Egcdfbid7uLdiBu70fwc0ZJdwcLaitCD9FMc7OiZC Tnq0N/BYpeiaMjP1B0JQdTSjRyaGFp9tGGBvX2xTwEQzX6dAE8aif9P87EVI0Xyhl2 WlGDoa+Rr0t81FBdffIznhsle4Ei63VNi7iEWcMjWoyU6ASV3DmLpCl1xVlAZDRp/E /qO8wcmEJItnSwAS/HKv/c+CDXclsrMgc265TmF+1lUVUo0zTMkToTbO1Dn4nsjnf6 ze9soqt9Ja81g== From: Roger Quadros To: sjg@chromium.org Cc: nm@ti.com, vigneshr@ti.com, u-boot@lists.denx.de, Roger Quadros Subject: [u-boot PATCH v2] binman: Add support for TEE BL32 Date: Sat, 19 Feb 2022 20:50:04 +0200 Message-Id: <20220219185004.5452-1-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 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.5 at phobos.denx.de X-Virus-Status: Clean Add an entry for OP-TEE Trusted OS 'BL32' payload. This is required by platforms using Cortex-A cores with TrustZone technology. Signed-off-by: Roger Quadros Reviewed-by: Simon Glass --- Changelog: v2: - use 'tee-os' for entry name instead of 'bl32' - use ${TEE} instead of ${BL32} for environment variable - Use next available test file number for test device tree - drop size property from test device node. Makefile | 1 + tools/binman/entries.rst | 13 +++++++++++++ tools/binman/etype/tee_os.py | 22 ++++++++++++++++++++++ tools/binman/ftest.py | 7 +++++++ tools/binman/test/220_tee_os.dts | 14 ++++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 tools/binman/etype/tee_os.py create mode 100644 tools/binman/test/220_tee_os.dts diff --git a/Makefile b/Makefile index 184223ec63..0968895fcd 100644 --- a/Makefile +++ b/Makefile @@ -1326,6 +1326,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ -I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \ $(foreach f,$(BINMAN_INDIRS),-I $(f)) \ -a atf-bl31-path=${BL31} \ + -a tee-os-path=${TEE} \ -a opensbi-path=${OPENSBI} \ -a default-dt=$(default_dt) \ -a scp-path=$(SCP) \ diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index c47f7df098..b147223661 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -25,6 +25,19 @@ about ATF. +Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob +--------------------------------------------------------------- + +Properties / Entry arguments: + - tee-os-path: Filename of file to read into entry. This is typically + called tee-pager.bin + +This entry holds the run-time firmware, typically started by U-Boot SPL. +See the U-Boot README for your architecture or board for how to use it. See +https://github.com/OP-TEE/optee_os for more information about OP-TEE. + + + Entry: atf-fip: ARM Trusted Firmware's Firmware Image Package (FIP) ------------------------------------------------------------------- diff --git a/tools/binman/etype/tee_os.py b/tools/binman/etype/tee_os.py new file mode 100644 index 0000000000..6ce4b672de --- /dev/null +++ b/tools/binman/etype/tee_os.py @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/ +# +# Entry-type module for OP-TEE Trusted OS firmware blob +# + +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg + +class Entry_tee_os(Entry_blob_named_by_arg): + """Entry containing an OP-TEE Trusted OS (TEE) blob + + Properties / Entry arguments: + - tee-os-path: Filename of file to read into entry. This is typically + called tee-pager.bin + + This entry holds the run-time firmware, typically started by U-Boot SPL. + See the U-Boot README for your architecture or board for how to use it. See + https://github.com/OP-TEE/optee_os for more information about OP-TEE. + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node, 'tee-os') + self.external = True diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 5400f76c67..b6057da552 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -81,6 +81,7 @@ FSP_M_DATA = b'fsp_m' FSP_S_DATA = b'fsp_s' FSP_T_DATA = b'fsp_t' ATF_BL31_DATA = b'bl31' +TEE_OS_DATA = b'this is some tee OS data' ATF_BL2U_DATA = b'bl2u' OPENSBI_DATA = b'opensbi' SCP_DATA = b'scp' @@ -185,6 +186,7 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('compress', COMPRESS_DATA) TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG) TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA) + TestFunctional._MakeInputFile('tee-pager.bin', TEE_OS_DATA) TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA) TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA) TestFunctional._MakeInputFile('scp.bin', SCP_DATA) @@ -3877,6 +3879,11 @@ class TestFunctional(unittest.TestCase): data = self._DoReadFile('169_atf_bl31.dts') self.assertEqual(ATF_BL31_DATA, data[:len(ATF_BL31_DATA)]) + def testPackTeeOs(self): + """Test that an image with an TEE binary can be created""" + data = self._DoReadFile('220_tee_os.dts') + self.assertEqual(TEE_OS_DATA, data[:len(TEE_OS_DATA)]) + def testPackScp(self): """Test that an image with an SCP binary can be created""" data = self._DoReadFile('172_scp.dts') diff --git a/tools/binman/test/220_tee_os.dts b/tools/binman/test/220_tee_os.dts new file mode 100644 index 0000000000..6885497294 --- /dev/null +++ b/tools/binman/test/220_tee_os.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + tee-os { + filename = "tee-pager.bin"; + }; + }; +};