From patchwork Fri Jan 12 14:52:15 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: 859982 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="Wf+i6p7/"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zJ5MC5FJLz9sNw for ; Sat, 13 Jan 2018 01:52:39 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 55727C221C3; Fri, 12 Jan 2018 14:52:30 +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_NONE, 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 45535C21EE5; Fri, 12 Jan 2018 14:52:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C89CFC21EE5; Fri, 12 Jan 2018 14:52:26 +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 7252BC21C40 for ; Fri, 12 Jan 2018 14:52:26 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id f140so12289705wmd.2 for ; Fri, 12 Jan 2018 06:52:26 -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=dddL8V+NEVWpcwlP6vFdByq+3pAGxiPOJ7bmWdTY4Jg=; b=Wf+i6p7/V0nqtZcxE0TKg1RG9mpdPh0VnW8FPyPz/UNRaUSLaxLxmg9faS5XzD7rKB czkKha5wmZcwnuYmBlKIwzulJOsoQI0YtdiTbCnV3/CbXpqUWGTs8FCCt+sQGk0l3M7V /QCJ/LuEziS2lkjdUue0WNnuBHp2757R4B9mU= 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=dddL8V+NEVWpcwlP6vFdByq+3pAGxiPOJ7bmWdTY4Jg=; b=qzSqA6pBvC4ukC0ABVBq1UCD4jEmUwjcE95IphiS1xIvzAE8YCRmkqQmzipYt7vCmL tvEXv+qZ+Z7uyHp5OXalSdUde7gFnohubS/Ix6bIenQUrme3ON+CAiYZ7gkONO7a1bsw Rqx7Awm0WXU/DX87B4T3+FQx4+iTr9GPgp1T9ZW04WIPztZOkcgvGS2bUUXBvA8A7yfi pu3lfpPfFaasntqskZPdDq1AbkDveupBRqkf4XsLZ90bDM6jBqDJRgsFtWJ11BD2hGOx YXxjUFdQSukPZ5K5kMJ09/9tjVkbRyNUNPokaGaOASiQ55OJ5GU7oTfOZ3mLWvB645v9 xPpQ== X-Gm-Message-State: AKwxytftxqkzywuRTNBMZE1pRIGeN3vN/XNBsiAD3knWbMsVEVRB9Lcc 0aIjaQjIZpP1UbsrvXwGPvTBboLtJKA= X-Google-Smtp-Source: ACJfBovJFYP/MDosQdRPxnKAwjyVS5usqDTW1AQxL5BWMdL0zJqxoEq8OYdGrZw+9nlr3HtiwNcGKA== X-Received: by 10.80.240.141 with SMTP id v13mr16388145edl.90.1515768745888; Fri, 12 Jan 2018 06:52:25 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id d20sm1318629ede.16.2018.01.12.06.52.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 06:52:25 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de Date: Fri, 12 Jan 2018 14:52:15 +0000 Message-Id: <1515768744-25246-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: trini@konsulko.com, harinarayan@ti.com Subject: [U-Boot] [PATCH 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" 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: Make OPTEE_TZDRAM_BASE a mandatory define 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: Improve 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 | 16 ++++++++++++ lib/optee/Makefile | 7 ++++++ lib/optee/optee.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/default_image.c | 25 ++++++++++++++----- 10 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 lib/optee/Kconfig create mode 100644 lib/optee/Makefile create mode 100644 lib/optee/optee.c Tested-by: Peng Fan