Received: by 10.223.176.46 with SMTP id f43csp1056741wra; Fri, 26 Jan 2018 11:06:31 -0800 (PST) X-Google-Smtp-Source: AH8x224kJVMAp3GEZF2XWELr/nrzwUH5ei+NwhUc0RXeGA1XfsBhb8pDwJvc/y2C3K++AQzQxptp X-Received: by 2002:a17:902:8a8a:: with SMTP id p10-v6mr14637950plo.261.1516993591436; Fri, 26 Jan 2018 11:06:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516993591; cv=none; d=google.com; s=arc-20160816; b=z5JMJJv/Jw/fwLwacD/BlYMqfvOJsNtkaxhOCpDeoUSHOvyHsrLZ4eZ2Y+q6gazr/r YTQP40rHk2EcbL+1ROaMtcbWzzWeSbZw/AReCeh83f7dC0osZX0Ghsie3mVRn/6eLIan yVdCVNuWCskF2D5cOEmRwOqmdSbfA4CCYSRBRe5VMCqUs/NmijBWqwZQNrSbxZ2XTuG+ gZB1oArQEMh6NCYTx9p3UoYjWSs8x0f3W9gpxjWWRKux3CQoQG+bpN4Mi43A3PF/KXys qGtVoSGgbU7bsoYKUOHErmO4ZvEE50RcBM2PwSBWU2aWDji6yzpJMl+DKNPqxsFruJRl ThXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=aXa40o7twVb9XxtWCwE79HFvSKnGLUoBoNsXURtw8Q0=; b=IfeEw0K/oT8CiLdL6+5HaGiSCq5vTqvMX6n30HeTzsL1L6wSKNCJzJq65axICVIGcc ZrxX2iWzP6wMNJiVDPCfcJi1TsZuUwl0vVMDp7EV2HlaGYzeyd2EhBpF4Un34i2GrIAS fd/KpfR3x/2QjUVJzhx/Wja9SEl3P80GDL2leNyeY6hhhhISwfN/479gPZgPVZE+ILRu TzLXiawWaBuIrGTcrQmqWOowLHUFY4RdL0/8KfTyvEhVcLrTgnp7E/qVBvrswMaRRteR h1ZTwpMzpSjgAMMFplDUh8aQl3BSIj0sUbNYXePld7lpljH+JK8m0tVRIsALBWSfj0S6 oW9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=aczg8ozJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si1484166plh.780.2018.01.26.11.06.17; Fri, 26 Jan 2018 11:06:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=aczg8ozJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752576AbeAZTFP (ORCPT + 99 others); Fri, 26 Jan 2018 14:05:15 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39293 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752246AbeAZTFN (ORCPT ); Fri, 26 Jan 2018 14:05:13 -0500 Received: by mail-wm0-f67.google.com with SMTP id b21so23166012wme.4 for ; Fri, 26 Jan 2018 11:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aXa40o7twVb9XxtWCwE79HFvSKnGLUoBoNsXURtw8Q0=; b=aczg8ozJaTte2dbPwa8y9yqPRyNCY2GRLw6xc2H2kJSqC30U5/PQOFe7vJiba5LMr/ iQA+i9w1D+E8pYCrJxpXJJD0de6S3ctNNw3Cf6PlXDIu90N6m0bZ86I2VLhhhs8FYLYs v9u/BvzSTKQHARYFURyS5LE6AWt64TxsWgj0fSwfwGjHVnlmA1jTvRTcEnw20px8BlCp SpVhfxnphLnNMRNwyaUFm/YIDXyFUXJSnJJ4DMw9xBwYEdxMV+dgBXMWpdEJQnEIHU23 G24JxSXmb32axSiH5jeRRBTXrh7BD0YL0LaFU1jP7KSz3KVaa6U1afs/uv8FY1s4EFqL 9Ghg== 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:mime-version :content-transfer-encoding; bh=aXa40o7twVb9XxtWCwE79HFvSKnGLUoBoNsXURtw8Q0=; b=gPDfnAlxeMVQ2Adf7adISfMhvRJ2dmKjCRj5grlpE2kR1o6O7jGMOAOORLX0oeOnSE YyyaXlsk4WEEi2o6dQlarjCuSKmZAoLbcltJzJJoQ/wV2KVkrow+d45GAPOEUh737OtY KNOe55rLcFC1ZaRS9sjmN5q3ghIwCTyFZFzwFdh6Hcf8xWOT4jZGj0ynSwy1pHxnTLly opsam4VbAumn5SEYvz6+FbAkgtoU3ARuUN858KlBm6Y4vMmeyAQRFaSarvcNSxaX0afX D1XRKir1E4wxDpyn0j5UbU5SczK9KtZpA38aP4vozaJXl4Y6XNhwKJji7lckr9+QcNur 385A== X-Gm-Message-State: AKwxytf51F0OzRZ42SO+Tm/HBML6HNlzYtsqTpvQKa4cW6Qcr4+n32nN FffgXXB+VArXl8LsmIqUYn+6dQ== X-Received: by 10.80.153.75 with SMTP id l11mr35315862edb.245.1516993512487; Fri, 26 Jan 2018 11:05:12 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id k12sm2719836edl.86.2018.01.26.11.05.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 11:05:11 -0800 (PST) From: Bryan O'Donoghue To: horia.geanta@nxp.com, aymen.sghaier@nxp.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: fabio.estevam@nxp.com, peng.fan@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, lukas.auer@aisec.fraunhofer.de, rui.silva@linaro.org, ryan.harkin@linaro.org, Bryan O'Donoghue Subject: [RESEND PATCH v2 0/5] Enable CAAM on i.MX7s fix TrustZone issues Date: Fri, 26 Jan 2018 19:04:56 +0000 Message-Id: <1516993501-29646-1-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org V2-resend: - Patch 0005 lost in the ether - resending V2: - Endian detection is ok with TrustZone enabled Horia. Endian detection logic tested with TrustZone enabled. The register that this relies on though isn't affected by the lock-down in the first page. Assuming set of affected registers is actually just the 'deco' registers though there is no formal statement of that, that I am aware of. - Moving of TrustZone work-around into u-boot This set actually doesn't need to deal with TrustZone at all now but, for the sake of consistency keeping thread title https://patchwork.ozlabs.org/patch/866460/ https://patchwork.ozlabs.org/patch/866462/ https://patchwork.ozlabs.org/patch/865890/ - Reworded endless loop fix to read a bit better - Fixes to DTS additions - Rui - Fixes to number of clocks declared - Rui V1: This patch-set enables CAAM on the i.MX7s and fixes a number of issues identified with the CAAM driver and hardware when TrustZone mode is enabled. The first block of patches are simple bug-fixes, followed by a second block of patches which are simple enabling patches for the i.MX7Solo - note we aren't enabling for the i.MX7Dual since we don't have hardware to test that out but it should be a 1:1 mapping for others to enable when appropriate. The final block in this series implements a fix for using the CAAM when OPTEE/TrustZone is enabled. The various details are logged in these threads. Link: https://github.com/OP-TEE/optee_os/issues/1408 Link: https://tinyurl.com/yam5gv9a Link: https://patchwork.ozlabs.org/cover/865042 In simple terms, when TrustZone is active the first page of the CAAM becomes inaccessible to Linux as it has a special 'TZ bit' associated with it that software cannot toggle or even view AFAIK. The patches here then 1. Detect when TrustZone is active 2. Detect if u-boot (or OPTEE) has already initialized the RNG and loads the CAAM driver in a different way - skipping over the RNG initialization that Linux now no-longer has permissions to carry out. Should #1 be true but #2 not be true, driver loading stops (and Rui's patch for the NULL pointer dereference fixes a cash on this path). If #2 is true but #1 is not then it's a NOP as Linux has full permission to rewrite the deco registers in the first page of CAAM registers. Finally then if #1 and #2 are true, the fixes here allow the CAAM to come up and for the RNG to be useable again. Bryan O'Donoghue (1): crypto: caam: Fix endless loop when RNG is already initialized Rui Miguel Silva (4): crypto: caam: Fix null dereference at error path crypto: caam: do not use mem and emi_slow clock for imx7x clk: imx7d: add CAAM clock ARM: dts: imx7s: add CAAM device node arch/arm/boot/dts/imx7s.dtsi | 31 +++++++++++++++++++++++ drivers/clk/imx/clk-imx7d.c | 1 + drivers/crypto/caam/ctrl.c | 45 ++++++++++++++++++++------------- include/dt-bindings/clock/imx7d-clock.h | 3 ++- 4 files changed, 61 insertions(+), 19 deletions(-) -- 2.7.4