From patchwork Fri Jan 26 12:24:42 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: 125952 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp297185ljd; Fri, 26 Jan 2018 04:24:54 -0800 (PST) X-Google-Smtp-Source: AH8x226z9l9vSOyc+51rYg5E1EqLnhrK+l8mBd+FXAgTlh+n2ZOgSUsKYdxklAsDlSSBtikBLqQd X-Received: by 10.80.165.21 with SMTP id y21mr35228014edb.148.1516969494439; Fri, 26 Jan 2018 04:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516969494; cv=none; d=google.com; s=arc-20160816; b=KYXsuUJTMrITGSmv2V0N1u1ghEzI35eBduY2Zx21SYvExfmeQ5NbJhGXj8Q6VnVpB8 RTlJORaWzfTtnMXE3Bj9LPhzNfdIGyVr/smSgSv8Xl/I/bmh1E01OQhUoFbqbnuulmPw 1pm1McsenUNfsarLfgjkxSxRcedrZBYfm20JOrQHWz+g5/qUCB/lkDuCArUhl7QT2oeq /TIomaqtkHKEMy5cSeR2a103WREA5hvuYZz+f1x/O4qB5cdYwFruy4usy8juaHXI+l8l 1cOlOoRwpHrujDAj2ciJ7UL0K4ZEAK4fkYJsnZDySmMkOENYMaHouAJ7ZwZyQHX923V9 MrwA== 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=dpe/qd9uRt8PVcHhp2Nde0bG0ulki52Hh2IEpnWYW20=; b=cRW7/6l7ZlJrZJch5wDgelTMkuVmjD7G9NQClg6f+ESSGUMiAxjx15GR0I/NhS30qe bJzxp79wLwn0H75s3NSpCar1OQwyZhPqJt5msYGxDXEU8e4dbQBcYqms59lVManec2RY n5ymFR6q8I0tEfd5Owe+h8CNTycODWU6yn3z69fCwVy84Lw812tiJaK+4sqocZ/UcUrw LWldZn+0kAdn3Q/QRlLNz+v3ll1JiiwJIgnMMvI753BAeBYxPHhYf2ZwakCJ/6vGzFge tiPQuUICRFcEq82IyAfctzJELU3jMkR7Nm29iqKB3NGXWW0l41fMhb7vd49XmHfR5PuJ xJ0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=G7GwzC6W; 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 r12si3994235edb.443.2018.01.26.04.24.54; Fri, 26 Jan 2018 04:24:54 -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=G7GwzC6W; 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 10278C224E4; Fri, 26 Jan 2018 12:24:52 +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_BLOCKED, 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 2AFEAC223C5; Fri, 26 Jan 2018 12:24:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 910D2C22052; Fri, 26 Jan 2018 12:24:48 +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 3A9B3C21DA1 for ; Fri, 26 Jan 2018 12:24:48 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id r71so936287wmd.1 for ; Fri, 26 Jan 2018 04:24:48 -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=bUiR90BZAOmsR4jM5sTTTIz8BfrbW3c1Ldr/sa4Ma6c=; b=G7GwzC6WvqpfDYrr98RMRIHtJ9UAN7Q6MWzy3gC+JrVo1T+n+WwI+NLBRGAwRQsa5Q ZfZY83ouZx82+r/cQ5JjFt7QyGaXMkJSx4UjPQXerxEEKiDLeLjL3fUZtckz+Ir7Got6 Z1C8wfpBBIXHfisjKGYFzLf0zdbpgt4KY15sY= 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=bUiR90BZAOmsR4jM5sTTTIz8BfrbW3c1Ldr/sa4Ma6c=; b=UPF/FnGrTVYwq4qieIiNoPM3L9vJnzZNnkn06OzSEBkga21H+vliC4RQDPf2cyC9NF 6+B+SlgQzxme4TNIvbxuMe0DF13qOJaf0dikPi9Pc2jCdikJhX3FhpY3qNae6Nc/0hU6 11TjL2ZNRTe4Urjc8cc5GkLt8aPLAqrw/4HisWa1rWCdZCKLRI2qu3yk3qDSIvd6jajW 7iK+OI5RECPbbCr/ekpLoqxeBdQxJOQAY3X3aaH4bstJxpHpdINvNtiZHt8EPgfftIT3 1iJAzDEfBSk8Umc2rZM8+hM+ATVcqTgsKUvhT0IOORpsJmcq39lo/hSRjlYSPJwM54RO jbUg== X-Gm-Message-State: AKwxyteP1wMBYQGD/Y5PXAzv7cv43zOUSkAptzm+/osSVL+8OKxjetXC wscRAgG72hnQZpo8IyXN3jMdJ47khac= X-Received: by 10.80.174.177 with SMTP id e46mr33985236edd.49.1516969487692; Fri, 26 Jan 2018 04:24:47 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id 15sm2546827eds.54.2018.01.26.04.24.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 04:24:47 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Fri, 26 Jan 2018 12:24:42 +0000 Message-Id: <1516969484-19409-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: fabio.estevam@nxp.com Subject: [U-Boot] [RESEND PATCH v3 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" V3: - Changed location of sec_init() from warp.c::board_init() to soc.c::arch_misc_init() which will allow any i.MX7 which defines CONFIG_FSL_CAAM to forget about running sec_init(). 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 imx: mx7: run sec_init for CAAM RNG arch/arm/mach-imx/mx7/soc.c | 4 ++++ drivers/crypto/fsl/jr.c | 9 +++++++++ drivers/crypto/fsl/jr.h | 2 ++ 3 files changed, 15 insertions(+)