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: 865027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SqliL/tj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zR0bY1xs5z9s82 for ; Wed, 24 Jan 2018 07:42:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E1988C21E55; 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-Google-Smtp-Source: AH8x224J4ixjUBFYR2zkLsoyOPS+p9zcxBbVw8XAJY+oPEw+BbY+yUu/uAqxcc8fOfqTmsezBwX1wQ== 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