From patchwork Tue Jan 23 20:41:51 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: 125587 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1993179ljf; Tue, 23 Jan 2018 12:42:09 -0800 (PST) X-Google-Smtp-Source: AH8x227Hk+YzWeJTLgbcSiy+xayuu1e4/xRNsUV55xxvRYR7HZMq+rl1UYOFlORM2a+2cEV33Ja9 X-Received: by 10.80.154.225 with SMTP id p88mr21158915edb.256.1516740129127; Tue, 23 Jan 2018 12:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516740129; cv=none; d=google.com; s=arc-20160816; b=aANBAKF4l7WirqdaLwKjOIC5sR5OqU5dnRbRwNlBG5gTuP/85m3wozkHxs/f5hIVH9 Ewkv2OSlVTzYhVt+I7UaMKyr0VB6ocgCk1Pdb3HaW8v3I4Fm4Z8DtW59YaESASbxG7Ug /A5GbkPApyxCvi+p3TS6+MIdDv8tCIjE3vMXrqCeEZCGTQGf2K47DU1P3epO5TVmwnqg ABWcojcyfiRbplAhPw29bKZlDxplNK7pXdAxoRT/vXYxlkcPPyUPHbWizzHHOCdwGUJr GXO9hMz6xmJjS6Qc9tgY7dCJDmCfXSBj9Splc8KzotuQO5iHZ0KilCz7nY+B2rvaMzNG d4gg== 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:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=HehMPBv9CLt2S7MnOiH8vslGhI4Rke/PNz/VJOYjlWc=; b=YLwSAVnunGatwn3tObjDRRubeiyniXfbmdFtaOzaayh6D46Gc1ukoQZx5G0c0aSaZA yYVELURNu4DwAPXl+tN297Sxqd/rllriA7GyxYrQNEBlV9z+9Sunlmc62N+1p9YGAJg4 7HM1MiNnJQWP97TSIkaQQqc0djOaRMfP+nkha3gCengwBTTvC/L2it8hDxys1sAMjITQ nrL81vnJp6/qjpWnx8C1w4LX5W4gaOFZgzoS2g5dbl/wtLlbIIivSFMigGYnIMEtV7SW BFO3KBlvbExHx7D1HCcu5NQd2KZMEAL8K3mw9iqej15L7R4mew08HP6910WJbpqtotas NNIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SqliL/tj; 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 l15si9032893edc.306.2018.01.23.12.42.08; Tue, 23 Jan 2018 12:42:09 -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=SqliL/tj; 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 76B88C21F0A; Tue, 23 Jan 2018 20:42:06 +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 13F37C21E55; Tue, 23 Jan 2018 20:42:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6590AC21DB5; Tue, 23 Jan 2018 20:42:03 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 9147CC21C51 for ; Tue, 23 Jan 2018 20:42:02 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id r78so4489872wme.0 for ; Tue, 23 Jan 2018 12:42:02 -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=/rLzZnaBf0ZjUB/7h3Rqxk1F8YNMwcSaDoIBLKWTu5Y=; b=SqliL/tjNvLMj+FORRQsj5w9v30kUZDzVf+GTilX92xlx449gAW4jWUGp+1KCdxc1p RiR9U1PHi1k5ouDgfAhWSOHUZhjpL+6jHeApF4zwKIA1pTC59eDFzhTPFzpVeOKfNrRK 0RizABkbGkFxhLVc7zPXHWNRZj8hbrPilRVB0= 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=/rLzZnaBf0ZjUB/7h3Rqxk1F8YNMwcSaDoIBLKWTu5Y=; b=g+qrdNMpyimde5srLv72+pwMCQOTI8uWSwax4dj6tvAxf3keppoiJuNAmJi73n2joi 0kiQV0j4MRQ3x9Jr9erNiLhcBK9/IlxXZMI7Ra1j+K8uFQlCDOiheBFdKtJNFLRQuTYd f9e8KZiOzY8b460qhmOs6IWVkFo41jN4ItB3/EgVA/kULzMfOvuIPbDxQDVNvcOEAGk1 wufE6DuYT+or3PoUFMj2bpHDFJfzLkmvzFGuZ8udCrvLc3x5BLReFWrjFTqpUkBZ92Ci 5bX/53yATlOR3JZ81WZUUEgLVagtd547TllC0++XvbXSo5/eCYTe7UAkqOiarx9kBsin vyOQ== X-Gm-Message-State: AKwxyte3Cf/xBXSxyxACnzQX+ylZQ83JU1knSjPnPoKq4Hx9La+/2tld mXTBwyVf54pFeNBVTuGLaVy/jUAEUHg= X-Received: by 10.80.162.133 with SMTP id 5mr20799872edm.174.1516740121881; Tue, 23 Jan 2018 12:42:01 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id k12sm12400896edl.86.2018.01.23.12.42.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 12:42:01 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Tue, 23 Jan 2018 20:41:51 +0000 Message-Id: <1516740120-948-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: harinarayan@ti.com Subject: [U-Boot] [PATCH v3 0/9] 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" 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 (9): 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() tools: mkimage: add optee image type optee: Add optee_verify_bootm_image() optee: Add error printout bootm: optee: Add mechanism to validate an OPTEE image before boot common/bootm.c | 11 ++++++++- common/image.c | 1 + include/image.h | 1 + include/tee/optee.h | 41 ++++++++++++++++++++++++++++++++ lib/Kconfig | 1 + lib/Makefile | 1 + lib/optee/Kconfig | 24 +++++++++++++++++++ lib/optee/Makefile | 7 ++++++ lib/optee/optee.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/default_image.c | 25 ++++++++++++++----- 10 files changed, 171 insertions(+), 7 deletions(-) create mode 100644 lib/optee/Kconfig create mode 100644 lib/optee/Makefile create mode 100644 lib/optee/optee.c