From patchwork Tue Jan 23 21:10: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: 125598 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp2007246ljf; Tue, 23 Jan 2018 13:11:03 -0800 (PST) X-Google-Smtp-Source: AH8x226UgDq9Ixk2gVXH+BeyFs2HF/k2AyvTZF4IcUFoyc6xzpgSWS+mbPBK6mi3pPi+WsDFpqCV X-Received: by 10.80.135.196 with SMTP id 4mr20743528edz.262.1516741863012; Tue, 23 Jan 2018 13:11:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516741863; cv=none; d=google.com; s=arc-20160816; b=XP5Is/tIM4kCWm7XnsRP7G36EXIn727jrxX+OZZ8hvOeQ2tC96aSJNprjj1saLfOK3 7u2JEg1Z/CxIXHgbXhm6yOf7dyr1Nmlm4HeOVQaahVPBllAEzNcAcvBPAzA5+4HOSrgT EoLAYY6vkBwjIhU1w4UJsgEGnmuJ/R0+N+5IpKDiMJ5xkp7s9/DMi9EcdEKwSR7MqUlH VUncAf0XlberV7G+dpkSu9ZOOO6MLx0Zt+Rhg7RQnR399vYadcrLExmJR/gU6HKDXc95 skQBigDvwhGhDc7RcBJ3ynpOQHHkSXG7b6WNbdNbS+be1VYsPWA+HaPlpGNSHf5Qb2pG NDsQ== 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=qL3sRVg9rtCIFEEK8DHH/PhWbjpZOu09hA+FhpQBw1E=; b=Qjnf+Tog/H7QrvTBt51/je9fBMPes5+ZAFLJvjpAFO63fkd+gJdsIJMwo/4NJeKtJj 8jsc6GOeGyZHGjX8/a2FE+XoHqCrCiYrelaJ8CD6fDMWRkckd9Tk0gENPoGcj4HSSM6q RV/yeVwH1BC0DzbnxcwyGEQD87znGHt9r+6Y48eyFQHMItVbT2oi5EwHCxvqaokw82vD JgD+R59vxuEa71G2tdLocQbskRouvIylPedUDZ2asxYN1suCgSIvVIl7XFku8wZvsOEp gnSoNqvsuB7EiSqgLEjqSUdd0wUvUcH3hHrEdrl6OYckGadHVmsPqqDRhmPhYmda3jp7 cJrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TPTPUuBI; 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 h4si2841914edc.130.2018.01.23.13.11.02; Tue, 23 Jan 2018 13:11:02 -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=TPTPUuBI; 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 3245AC2212D; Tue, 23 Jan 2018 21:11:01 +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 05872C21E55; Tue, 23 Jan 2018 21:10:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A1382C21DD7; Tue, 23 Jan 2018 21:10:56 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 44BF5C21C93 for ; Tue, 23 Jan 2018 21:10:56 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id b21so4579721wme.4 for ; Tue, 23 Jan 2018 13:10:56 -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=nGUlw06EdU6gEEPLAgSycKIDw5DqPy7ADq4okdr6XUc=; b=TPTPUuBIN8aboiecD3fYq9yTysgSDZKaHhA4klQb9/IIE6W5l6/5xWscMMwrELfQT1 slc+JKz1mhOwtNVLGgu5YK/iot0mdr59uAQMkAqXp2EBQMem7uej5/+NIuRQVhVw4Xrb o/oQTzTAq48gvOxvHs8+ny/pMnaTB+JiUe3lw= 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=nGUlw06EdU6gEEPLAgSycKIDw5DqPy7ADq4okdr6XUc=; b=nnAPcxhxILXUtgteYwJCpewefv+OIAGX3zD1s1EMNwUgNBoTwjzizXBbbc2r3aT7y9 AwBs/RRr3znbRTisYscxKERILzUX2HgvE5oON3iQ3OvrsTMqvV0FBVMPQkr5XV5LXWp1 6zBL1QBU7l3PpUTs6gYjjk0CZHNClgxJq91bkGADtG7F8tulXe/RQbL+WmxtoggUW6bK N1qKY9bJ3vASPr2RoM1YtQKjrJMTXhXZ8KBOzyTIwOMoRDC+f+DuA/6q/2t0kb3fxn5H JgqEb+E28BNkKglLXDlX5y3D5u5ABsgqA0BXyawasg5dCaIG+AOKOmgXrqgZOwaRgI+v dOQQ== X-Gm-Message-State: AKwxytccJMggqJ9Qzkym0k1DNCgzb9ZHaq5rjj36VByt1d9a4C3Kyx4W F9IBRfFiVRN/jkO/24WNJwggsK21vJM= X-Received: by 10.80.166.218 with SMTP id f26mr20687848edc.266.1516741855713; Tue, 23 Jan 2018 13:10:55 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id x25sm13860657eda.8.2018.01.23.13.10.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 13:10:54 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Tue, 23 Jan 2018 21:10:51 +0000 Message-Id: <1516741853-12458-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: fabio.estevam@nxp.com Subject: [U-Boot] [PATCH 0/2] Fix CAAM for TrustZone enable for warp7 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 is the u-boot fix to a problem we encountered when enabling OPTEE/TrustZone on the WaRP7. The symptom is once TrustZone is activated the first page of CAAM registers becomes read-only, read-zero from the perspective of Linux and other non TrustZone contexts. Offlining the problem with Peng Fan[1] we eventually came to realise the problem could be worked around by 1. Making Linux skip RNG initialisation - a set of patches should be hitting LKML to do just that. 2. Initialising the RNG either from u-boot or OPTEE. In this case u-boot is the right place to-do that because there's upstream code in u-boot that just works. Patch #2 does that for the WaRP7. 3. Ensuring the job-ring registers are assigned to the non TrustZone mode. On the i.MX7 after the BootROM runs the job-ring registers are assigned to TrustZone. Patch #1 does that for all CAAM hardware. On point #3 this ordinarily isn't a problem because unless TrustZone is activated the restrictions on the job-ring registers don't kick in, its only after enabling TrustZone that Linux will loose access to the job-ring registers. Finally should OPTEE or another TEE want to do things with the job-ring registers it will have sufficient privilege to assign whichever job-ring registers it wants to OPTEE/TEE but will naturally then have to arbitrate with Linux to inform the Kernel CAAM driver which job-ring registers it can and cannot access. That arbitration process is for a future putative OPTEE/TEE CAAM driver to solve and is out of scope of this patchset. [1] Thanks for all of your help BTW - Peng, there's no way this would be working without you giving direction on how. Bryan O'Donoghue (2): drivers/crypto/fsl: assign job-rings to non-TrustZone warp7 : run sec_init for CAAM RNG board/warp7/warp7.c | 6 +++++- drivers/crypto/fsl/jr.c | 9 +++++++++ drivers/crypto/fsl/jr.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) Tested-by: Ryan Harkin