From patchwork Fri Jan 26 02:09:36 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: 125885 Delivered-To: patch@linaro.org Received: by 10.46.89.16 with SMTP id n16csp39452ljb; Thu, 25 Jan 2018 18:09:48 -0800 (PST) X-Google-Smtp-Source: AH8x226aUSiKWdaTV29feJ1cJ9U0eum9XcIb04hjVVj2/7m39YCv93T/hoqi1/wgHKTNTq868WPn X-Received: by 10.80.149.88 with SMTP id v24mr32593794eda.242.1516932588024; Thu, 25 Jan 2018 18:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516932588; cv=none; d=google.com; s=arc-20160816; b=xqQvVOKN5lngmTo7TycZ4D+mnF8IgHiAU2lx+vyNzko3q53qmHWgpqtW3wsKkqMCaN d/C4Ps+04H64WeDQlGDTrHoBG5VTUs5L8Y+FJ2g5yApJzBxrLfebApHvDLdpORQ+wjZw KIbWyJtQe1w/KhqYHa9Bs8Z1q+38CHlbyi/X02B7CM71uOVirEfBTMx/CHLV61vX4pOx EU2up/EH6+lCDjMPt+zupDkH8aDzCbJ//SB+wCv58+0BBNGj+4x7zJSvhTAfZJuGgQqQ qyc8piT3cOpOdtFdRuFt/n+lArtdxLBuehzdAmtqfGuRxXnWgQdXtm4NvwrUDxtC2KFP tdLw== 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=W0dvDQwDrtFo397QzUUKkc42yYHE7WzbxljH78FS/Uc=; b=y5X77tISu5trsaIrtl5xAQs2sshUjRdY/DKd6s6dMe0AT2Hc/bksw0V8y/ViZr4J3U zKF/penWa9JTNvY1w53v/sAMtO+u+LjS1AfBnVgfSUpJLbadn57aVzjx7yCjM1j5dTNJ EO/yuJYB+MdeIoZK0O2vfUQO79Fbrh5oqMOCfFyCRjjdpKH4F1WN5t1qgOKRZhauNqnW 1YRS3qW/77GNTfeTLXTL31IWNMVLm8po75WWNCkK2K9vk/RcDIwicNGqJY1je7udeHH8 LK2eY1/3kR8QFWrFcKdV4ynffehz5x+CLj/zuteVMwlzla+1t/fXeyGFs7myPlWXNQbR dPCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gNIrx0Q/; 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 q3si689880eda.48.2018.01.25.18.09.47; Thu, 25 Jan 2018 18:09:48 -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=gNIrx0Q/; 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 A8751C22381; Fri, 26 Jan 2018 02:09:44 +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 18A1AC222EB; Fri, 26 Jan 2018 02:09:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5D75DC223B7; Fri, 26 Jan 2018 02:09:39 +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 54E7EC223B8 for ; Fri, 26 Jan 2018 02:09:39 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id x4so33418996wmc.0 for ; Thu, 25 Jan 2018 18:09:39 -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=1N2bHtTWU30xXVY7bSbLUkn78E5Fy4pTJh27JJMrBFo=; b=gNIrx0Q/lwUTSAkn9OBcPmC+kdfYA2GxW+Ak9kA+sr6+Mff3fE3jM7x5BTpxQryTx7 q0PaqA3iw0LHPwAXktyjDIXPy55xYn+5neAnE6vIPwoWo1bYeoQsiKEJbQQYmFG92h9V +ipePmcG3ifot3pjHcZwDVmepNa2urqkMInHs= 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=1N2bHtTWU30xXVY7bSbLUkn78E5Fy4pTJh27JJMrBFo=; b=l9LeQ46NOdTR7tK46e8+DY5NbS/qyg+4Mz+XwXlgmQ4YWuzTZqIRyWzXZGhzgqyNbu KHciCNo4p158IPgDOyVslm5WiPG4+W5rsjotECXqbpKroh4ImlzJfA+3+gb/xiZVKIQe T/TqyjQuMpLhz1sQP2pxwGmXS2HMg9Hj+TqY+TOrsjEM9Kn2uRYHWqx4D9aXEj1qOMlC yDg36mWjGBeGSYpOQdgPUAPlTCzR7IL/KAkvgj5V2aun8oD0WL15/syII2tp8SWA4rgD 4FKftWBMY+9C6YBGgRV0TX0yMwWQrEVAH5AVxqvou5cnhOE00l1FFAD9htQ2FLwMJSyv bETg== X-Gm-Message-State: AKwxytftWBTUwknuAsRKyAZ0/WcEHvbAxB86PR9ZZu5hJO1XsKEofPf9 U2a9XQ1NRPD3KN4D4Rx4wQfqkH2GrFc= X-Received: by 10.80.150.33 with SMTP id y30mr10396633eda.114.1516932578775; Thu, 25 Jan 2018 18:09:38 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w41sm1935792edd.32.2018.01.25.18.09.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Jan 2018 18:09:38 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Fri, 26 Jan 2018 02:09:36 +0000 Message-Id: <1516932578-19992-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 v2 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" V2: - Add an explicit assignment of JRMID when setting job-ring ownership Required on my reference part where the JRMID field is not set on the third job-ring V1: 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 | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-)