From patchwork Mon Feb 26 12:35:54 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: 129630 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp152534lja; Mon, 26 Feb 2018 04:36:16 -0800 (PST) X-Google-Smtp-Source: AH8x2266nXd77FN/4oMn9TgsPiYYV7CLbwS2btuhxbsGFkuL2He//EB+U3YOc8/4eFJ/u/tSsGIG X-Received: by 10.80.208.2 with SMTP id j2mr14333386edf.134.1519648576089; Mon, 26 Feb 2018 04:36:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519648576; cv=none; d=google.com; s=arc-20160816; b=I9O+0dF+MWbOFZJTuQhfAkIxakDerDae9+lROsgpKrOjbA8gyNf9Ysp0nSlIz4SAZx tpRIvVBCOXT8Le6Ujy7POnJkOwA8+PDFA8Hoqos2M7Gu9j8rd81Mb6Qj7Zpx/U5WOd4w jKGcJx8dsOiUD37NQwjgwbKPDZS7kqdMUTAuP7LsHXBc5K9F344h14F7bGH5o1iBzR6P /mKkMob/EPcUzhhlDJhbjlaT5CIFe6JTLt7PPUjvf1Zb5XXZZ+aH5Zff4HGOZZnaUg4r qbWvkNvBKw7KpPxh+J0U3pv0RTgQ223VI9LQlAe5gB4QbP8Jm3D+r4yfgHxiMqkTZThk zsoA== 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=0jK27hVu+4e7JWM7aUpg3HwMWyWBQJw+jtOJqP7QP2o=; b=CnqT+H6KGDvnDTlWdUbNivZaiVZRSxEZJsvWWCWuL4Gw4zM2ocZtCteC0B7ZvycfQc OBkJTGBN8ydwh/ZQSNfqyTKc6vjYjddHXU3IGoF9RgopBBflKjJ2QpZVb3C1z0osPuNv 1JnO6whmmjnizsLTlNZFR3ZgZarQdaYL4WAbVEc+KI/azfTnwpUYErazfrZiZKp+znt/ JkI9Ow/dVnKoWbKTV56bDS7vz6VprXO/84HnfuXHhx2Gq454bTBsgpf+XkLt+60ud88O m06pSbkoAk6O000etvW3fBN/8hQ5xNQmuaeasc8x+x6wiTz3enZhglB7oOGFUh7SMA6E GqaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FXmtn9cX; 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 33si1419985edy.153.2018.02.26.04.36.15; Mon, 26 Feb 2018 04:36:16 -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=FXmtn9cX; 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 AA98EC220C5; Mon, 26 Feb 2018 12:36:13 +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_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 DD38FC21F48; Mon, 26 Feb 2018 12:36:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C18BEC21EE4; Mon, 26 Feb 2018 12:36:09 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 59673C21DED for ; Mon, 26 Feb 2018 12:36:09 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id q83so17191671wme.5 for ; Mon, 26 Feb 2018 04:36:09 -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=7YJuHAon3Nmsk5/VXdQKxW5B8LFOk2AtyRfCp7VJuGU=; b=FXmtn9cXLjjpST0ADfE8Xxd6ooZZDbeCG8e7pLrCihvfEcLUUXkqWgOgBDTmNRWVff zDDazteqQTWfJSpbRGZRn+GB5xYcRgLqImZC3GTv7VdF+dwHpSFfyYW8MaNBhpEBQPPy Teu3suDpuGa3kh77afWdTehMyhCTMLar3vhKE= 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=7YJuHAon3Nmsk5/VXdQKxW5B8LFOk2AtyRfCp7VJuGU=; b=b2yTTQxhT/Wp3nncEU6MqbpcgLWkRATP+pkO6nE1Kb+8l2osA3DNwIGL/gMeLS+QWF pm2bW6FfP552E6yI59A48P0u5cUk6TGOVg4rccI4XNPjKOSDH+aMyeMPjxN8C8Kk12+6 PWM4V9FB+WJ6vkvlOGeSbcrL+oa98r0V/ATaJy+pl51hcYbH6lCbj+9AttZxUPtL1IEg zIB5wap5fgsl7sCKnIeo2M4XtLG1JrE/y0buRAR9TDKLdinCUqBOdPtVSHyBkRPnanel XM8ZTCOb95eS63htwjplHoqvoi3YkDANFWcGi6psBuh0zWqB6uvUh2YerK/+MatPBfaH XWZw== X-Gm-Message-State: APf1xPDoM7IHQBmesIBCyn3G8hwaNgnluQjL8yDjgmWD2ap1RjDjebMX oLx+G3PaCdnzz95OormIP84mbQxxCec= X-Received: by 10.80.165.84 with SMTP id z20mr14143530edb.300.1519648568175; Mon, 26 Feb 2018 04:36:08 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f6sm2493967edn.45.2018.02.26.04.36.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 04:36:07 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com, harinarayan@ti.com, afd@ti.com, kever.yang@rock-chips.com, philipp.tomsich@theobroma-systems.com, peng.fan@nxp.com Date: Mon, 26 Feb 2018 12:35:54 +0000 Message-Id: <1519648566-12061-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [U-Boot] [PATCH v4 00/12] 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" 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 (12): optee: Add lib entries for sharing OPTEE code across ports optee: Add CONFIG_OPTEE_TZDRAM_SIZE optee: Add CONFIG_OPTEE_TZDRAM_BASE optee: Add optee_image_get_entry_point() optee: Add optee_image_get_load_addr() image: Update comment for IH_TYPE_TEE tools: mkimage: add tee-bootable image type doc: TEE: Add documentation describing TEE in u-boot optee: Add optee_verify_bootm_image() optee: Add error printout bootm: optee: Add mechanism to validate a bootable TEE image optee: Add CONFIG_OPTEE_LOAD_ADDR common/bootm.c | 11 ++- common/image.c | 1 + doc/README.trusted-execution-environment | 123 +++++++++++++++++++++++++++++++ include/image.h | 3 +- include/tee/optee.h | 41 +++++++++++ lib/Kconfig | 1 + lib/Makefile | 1 + lib/optee/Kconfig | 29 ++++++++ lib/optee/Makefile | 7 ++ lib/optee/optee.c | 66 +++++++++++++++++ tools/default_image.c | 25 +++++-- 11 files changed, 300 insertions(+), 8 deletions(-) create mode 100644 doc/README.trusted-execution-environment create mode 100644 lib/optee/Kconfig create mode 100644 lib/optee/Makefile create mode 100644 lib/optee/optee.c