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: 124351 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2150121qgn; Fri, 12 Jan 2018 06:52:31 -0800 (PST) X-Google-Smtp-Source: ACJfBotUUEH6KhxsY65Hi1+pmckfNW7eRedoByOWXojaTGVaYpg98ybuFcGTYlrkSo+cTVSIbyPO X-Received: by 10.80.141.134 with SMTP id r6mr36551092edh.286.1515768751713; Fri, 12 Jan 2018 06:52:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515768751; cv=none; d=google.com; s=arc-20160816; b=ZWsNnuxu5IgYm8cVTmg36+rdj9EwAtx2+2JEOFy1D3aUeB0kn0VlAQVS8z30Gc/xJR SLjziUbDe1yYXMB8DzsBpqt/twMRWJuU4CUDgnexsI6x3XvchKp2kpIxgFczybZAPuLx TNshUr1LdhkfasXIkFFRCdPSBrDJWUno22SQSEQQX8lhYmDeEw/jYmMjrV3F2I+f9wKb a36NOvJIatSeS0REJ3rkphbKVNpew1EVhZbuYQTsL69ol3NqJtGxFnCgZielqnfmgm9N 6wIBfkJdIjd6uLvPi7wdjkxFMp9W40lHb4hec97ejvJd0bYQggBtuWV/UELjP1c/zLpE REEA== 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=yMxFt49LaSOKI/RW8MrK19Syo6oF02gmSf2Vv4vV12I=; b=PVVB88LOnGgFDQ58LrxFMWbhERhI72IJQsIdutDrDudlF0DzrPjUS/NDPsscIEO5dt LQBKfb9YpedXyx9hgj1uGKbjv5QR4nx7Ub3RVX71OJn0qW2nvnmZR41ljPf7OlT7tJ80 +fIl6j01GAhz/XDOtEwDxZT134ZjPiWAzVlzBljLIhk7c21AVctNwPc4DC2qUanpC3xB aJ6ntjib59BZn2uIZwvvYbGIg/9zR2KMMX2IMuASF0i8udhmCB2HJwiPHJvU/eARcHJ9 5CUoLfLyAtnxIDZ0yhNV2Z6YRYlp6uWXwQKpsbcyYw0lhHymNJxDy45MUMZvqv+TyCGe aYVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Wf+i6p7/; 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 d12si3543665edj.420.2018.01.12.06.52.31; Fri, 12 Jan 2018 06:52:31 -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=Wf+i6p7/; 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 00642C22258; 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-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