From patchwork Fri Mar 9 16:55:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 131164 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1212066lja; Fri, 9 Mar 2018 08:55:44 -0800 (PST) X-Google-Smtp-Source: AG47ELux0wfG2DIKx+uedxoEArIqBD0yCfZCKs7vGnDU7oGMzqZQCH6fObwQWN4g6xBb8XFefpTK X-Received: by 10.80.231.133 with SMTP id b5mr38684003edn.219.1520614544219; Fri, 09 Mar 2018 08:55:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520614544; cv=none; d=google.com; s=arc-20160816; b=sI6rN04y/4rZaXNRptIOEy0JnYzw95vw2W4zylXh2fnnTh8Vz7tLzcKdrzcSE+yIes STBy8Se9Yoaf9cmvk3dB8EpWWV06anOlbddHN8bPsYFlhc51x8SgA/0eLKDq7d8lkeM5 A7tncUmqML4Oetx8sQXWx1ttMljd9FyZ24OM/vxKJz/dhga/TjeQKr3r3b9WAhIDReqE p7oiRITCG6WvjVhGbFD/ms/dV6JoTCpapo0sxn5uWmPcSnnkdN74laEzcgM2Txl5KKp0 opWgZDq+YS46hutBWHiYAYGu4yZr7RQk9VKZNarMewA4/kmLDlGvLyv5VJ6VYBCGjq+g rmtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=fLsvTmU71ag4h21/t9W4Q4hPQrxzuN6NWwuuWClRs70=; b=XOcx0mS+ahwMWUoPx39z1lBpYljPZmuDDeQJC4XRZiaK02YwE9TK4woCOytSs/dzFb kfm8TX9meLop4+wlC7r7Aoho1/vHnRIz1/Jb+iAAlcy3Y4k5esVr04ZvjTO4Sb9wqdch 0w1wSrboHAZ/Ka1i/qY7UXVb8p5cfhhU4r3/6/stAfAbKJVwi4rFTAEZ/+n8ArLBhO4U cDFPYSTHweaaEs0gRdet2MqoYo7uLyxzNzmm7ze5c7D7a5CHnL9kyfWiP7nwik5jsYT0 ivcAkCj5rtK5ZGy+PMLb6LltxE+kmZ/OurEosM68tWTpAlGJB0ogmQ8GWmglcmwoGXUg Whvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GZPIRA6s; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id p92si1464781edd.177.2018.03.09.08.55.43; Fri, 09 Mar 2018 08:55:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GZPIRA6s; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 72FA1C21D65; Fri, 9 Mar 2018 16:55:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4076CC21C93; Fri, 9 Mar 2018 16:55:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D3AE7C21C27; Fri, 9 Mar 2018 16:55:34 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 532B8C21C6A for ; Fri, 9 Mar 2018 16:55:34 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id z9so5036533wmb.3 for ; Fri, 09 Mar 2018 08:55:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=SRv05olNhIJeNvahp50m58U/gJBv2V6TNGxFadym+8s=; b=GZPIRA6ssQqMiLpwLz1m+T4gqfKQV8vBs8H3EsB8Tfl8qHUQx7oqQeOJPKRCeXYM6y dBO5fIs3hPGCwrL7GbLNIxImh/pm0qKRldL6B6f961EEHBxwsEKaq/YsMmhHa2mBavO0 rigVZMQuie3cI8NnOqiOjJPw3US9r2Ww+PNSY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SRv05olNhIJeNvahp50m58U/gJBv2V6TNGxFadym+8s=; b=d4iDUVsMihz59RA90QESJGJS4yYrKGnAaPHigUNWadRqZSs+ubVD4IsEN+8BMraurP oA96SLJ/bUItRJZ+mORydOAHHi7G89rS7hxeFNq9MDML5bN9mFKo4AvapQFHT4Ip7KGm DKLkQ0vitUNGewDr/GhYQhVLe9pGbBA9p9hJoV44O6OzIqdL1dgB9j6ANozoa/lligdg zPZ21+tiSwt0cFaByMG8hWJlSP33jPpop+rbXBQsR3ncJQgxV0qtFhQwWqscaT8o2gki qTlE2ETyXVkwsmytSleSElplBcBlX0pQ9E6+wjNty+yI1KNcd1/oQoyTqdCKAUPCT39S +fxA== X-Gm-Message-State: APf1xPCaVyZ7KHkcN8kehskt5icQ6+MoBWYGe813R+FDpHD2SvtoAeNI nK6AIxxN6NYZi3yqfg8e5N3jr2H044M= X-Received: by 10.80.212.43 with SMTP id t43mr37896847edh.53.1520614533449; Fri, 09 Mar 2018 08:55:33 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id e40sm960335ede.15.2018.03.09.08.55.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 08:55:32 -0800 (PST) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, trini@konsulko.com, afd@ti.com, kever.yang@rock-chips.com, philipp.tomsich@theobroma-systems.com, peng.fan@nxp.com Date: Fri, 9 Mar 2018 16:55:21 +0000 Message-Id: <1520614531-2164-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [U-Boot] [PATCH v5 00/10] Add new OPTEE bootm support to u-boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" v5: This patchset now works by making a bootable OPTEE image mkimage -A arm -T kernel -O tee -C none -d tee.bin uTee.optee The concept is the same as the earlier version of this patchset except instead of "mkimage -T tee" we do "mkimage -T kernel -O tee". Andrew suggested this and it is technically feasible. So here is the revised patchset. - Converted IH_TYPE_OPTEE to IH_OS_TEE - Andrew - Removed Tested-by: for Peng Fan on patches with churn as a result - Added patch for CONFIG_OPTEE_ADDR This CONFIG entry will be used in an upcoming set of patch for the board I'm working with. v4: - New type "optee" renamed to "tee-bootable". We discussed making the namespace here more logical and obvious in another thread. Kever may or may not end up adding "tee-combo". This patchset will result in "tee" and "tee-bootable" being valid names. Since "tee" is an existing image type the name will be maintained. - Tom - Added doc/README.trusted-execution-environment This gives a brief introduction on TEE plus some links to the spec and the op-tee website. In then lays out the difference between these two types "tee" (tee-standalone) "tee-bootable" - Bryan, Philipp - Small change made to comment on existing TEE - Bryan - Reworded the Kconfig option "OPTEE" Makes a little bit more sense to me re-reading now - Bryan - Add patch to define CONFIG_OPTEE_LOAD_ADDR An upcoming set of patches for a board will make use of this define in an OPTEE context. v3: - Rework printout to be added at the end as opposed to churn over three separate patches - Andrew - Reword patch 006 to better explain the thinking behind new image type - Andrew v2: - Added CONFIG_OPTEE_TZDRAM_BASE instead of #ifndef OPTEE_TZDRAM_BASE as an error. - Tom Rini - Added Tested-by: Peng Fan - as indicated - Added better explanation text to patch 6/9 "tools: mkimage: add optee image type" - Fixed some checkpatch warnings in optee.c v1: This series adds a new OPTEE bootable image type to u-boot, which is directly bootable with the bootm command. There is already a TEE image type but, in this case the TEE firmware is loaded into RAM, jumped into and then back out of. This image type is a directly bootable image as described here : http://mrvan.github.io/optee-imx6ul Instead of reusing the Linux bootable image type instead a new image type is defined, which allows us to perform additional image verification, prior to handing off control via bootm. OPTEE images get linked to a specific address at compile time and must be loaded to this address too. This series extends out mkimage with a new image type that allows the OPTEE binary link location to be validated against CONFIG_OPTEE_TZDRAM_BASE and CONFIG_OPTEE_TZDRAM_SIZE respectively prior to proceeding through the bootm phase. Once applied you can generate a bootable OPTEE image like this mkimage -A arm -T optee -C none -d ./out/arm-plat-imx/core/tee.bin uTee.optee That image can then be booted directly by bootm. bootm will verify the header contents of the OPTEE binary against the DRAM area carved out in u-boot. If the defined DRAM area does not match the link address specified we refuse to boot. Kever - I'd like to suggest that your OPTEE SPL image takes a different image type IH_TYPE_OPTEE_SPL ? to indicate the different behavior your image type has versus a directly bootable bootm image. Bryan O'Donoghue (10): optee: Add lib entries for sharing OPTEE code across ports optee: Add CONFIG_OPTEE_TZDRAM_SIZE optee: Add CONFIG_OPTEE_TZDRAM_BASE optee: Add CONFIG_OPTEE_LOAD_ADDR optee: Add optee_image_get_entry_point() optee: Add optee_image_get_load_addr() optee: Add optee_verify_bootm_image() optee: Add error printout image: Add IH_OS_TEE for TEE chain-load boot bootm: optee: Add a bootm command for type IH_OS_TEE common/bootm_os.c | 32 +++++++++++++++++++++++++ common/image.c | 1 + include/image.h | 1 + include/tee/optee.h | 41 ++++++++++++++++++++++++++++++++ lib/Kconfig | 1 + lib/Makefile | 1 + lib/optee/Kconfig | 39 ++++++++++++++++++++++++++++++ lib/optee/Makefile | 7 ++++++ lib/optee/optee.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/default_image.c | 15 ++++++++++-- 10 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 lib/optee/Kconfig create mode 100644 lib/optee/Makefile create mode 100644 lib/optee/optee.c