From patchwork Fri Jan 19 19:43:17 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: 125215 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp442743ljf; Fri, 19 Jan 2018 11:43:36 -0800 (PST) X-Google-Smtp-Source: AH8x224WHXyS5bQ0iVBu7pCWYuBnSFZqFxCuaR0V0aAOLTAcs+l3wbcAOBfN7GZltE9ziFYAApmt X-Received: by 10.80.172.47 with SMTP id v44mr57022edc.130.1516391016655; Fri, 19 Jan 2018 11:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516391016; cv=none; d=google.com; s=arc-20160816; b=EHdXVQPUq6GDbpORVwc4EJz2SaBJ0dSjvPN/HVVWY6wHVwj0hsE1wV8hq/g0/d5t+U ie+TomCNMNegS7UhRDMjsj/gwPVvb7mNcxNzS8LZdmIWouEatMvcGA5cKNM+XIPDDLnL rI5wmJxo/+Ue0ojciNqQwzuYCpYVY/rv1UpFan4LpIdt/Pn/Xl4V/ss/sSVQgXlonbtx POq+H32lYregnSSJ7YsU16v7USQ9UhFBvV899khTZ++ivXq3rdW3x14nQhu5ewNGbNVO AevXPFjHgGK+dh54an1ntKQ8XZPhxOKKyciAYMAzMRM7A5sr9tUANM8lxHuTc6rLhG5P cIKQ== 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=lhlCBAofLlrAQTt27c1EIpq8iEjdfQG+VeB9uqa6v0E=; b=mIsnNI2IsiAwaep6iBFs4yF50BMY25NP4L9pYwd8+RTYiHftmaY4BM0p6SegLWkgyH aLmbt6XuyON4+8d6sPDSF7GmoEQpUv7/ruHmD0xAkouOxaRwMq6I1YM53FfQAz0futX8 M1apnGFzqTBucErdFbp29vtormTgFj6On3N1eFrVUD3SyTcSGTUsFQnPqdv0nXlto0ev VSmKx26L1Q1qrhSVZtsvF+ceosOfwa/gKwFkzHzIwPHPP7eMcnTRE/h41S6WP1Z5UzRq QcRJ4KTM/5aCmO9DCeQYWe1adxtaXA8b9uDzLQf80c8nGykQ+UGvYnlwx97u+b8aqFyt JJRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=j1wrQomk; 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 o3si19711edb.289.2018.01.19.11.43.36; Fri, 19 Jan 2018 11:43:36 -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=j1wrQomk; 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 3AA32C21F5F; Fri, 19 Jan 2018 19:43:34 +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 8E620C21DDF; Fri, 19 Jan 2018 19:43:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C8FAAC21DDF; Fri, 19 Jan 2018 19:43:30 +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 67B5BC21D64 for ; Fri, 19 Jan 2018 19:43:30 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id v123so5685009wmd.5 for ; Fri, 19 Jan 2018 11:43:30 -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=DFy4vx8xN7V4Trwcha5o8WNqYEp0dx1rlp24hiQZcK8=; b=j1wrQomkWgGf3rkLQ/3UGsJXIW+ugDIUXFzED4spnoPdrnrn40wausX10HXLxFWdwi jb2NsH2pjh3/2gD3pzytYyQIcajiSJpyxUuN0wrRgAIqlzbx3BuBzLn9vOqmk1RdQaIM uGMGV6WtyWvNGP0tARu71XvMb8hcmDkGF+P0M= 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=DFy4vx8xN7V4Trwcha5o8WNqYEp0dx1rlp24hiQZcK8=; b=VR2uLsyToAHoMdjHq9K0Nnh8uoV6SRTiuqNz4KIjh3nf7nLYjAsYvOvG6RMgQtsDau cjdw5nksDU97Z7A7qxbARYCw3hA7pJWZcpKdUcM323ZRPqiheKo9Rx9SPC/kdisTr7ae ifgBBSt+1R49vZY4TbbYi5SLpOkZsZF71J8ZHFo0jnoRdr9m4I8pnYUbfmt0AxE79Mzi ZPNsROtQNEAK4iXCqP+eNH1W1MAwrfxYseoiIcoN9Rj04SvY+S1G1cHAPyUYEvmffDj3 XDLmuc4/c+wyO28UwjgP/Mlaqn1irM9aUaZyJn1Ie7eXetQjlJ35lJqVh3ik7yQ1w6sk TYNA== X-Gm-Message-State: AKwxytdT91Y7Ot1Q4/NsPjfK6VPMUULVdUawYGq2HK7i6enit/QIRV9q dl7HdiVMR9azfxeASgunJxQ45/GHYp0= X-Received: by 10.80.159.175 with SMTP id c44mr58734edf.136.1516391009747; Fri, 19 Jan 2018 11:43:29 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id p6sm5936051edh.68.2018.01.19.11.43.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Jan 2018 11:43:28 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Fri, 19 Jan 2018 19:43:17 +0000 Message-Id: <1516391006-22483-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: harinarayan@ti.com Subject: [U-Boot] [PATCH v2 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" 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: 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 | 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