Received: by 10.223.176.46 with SMTP id f43csp848354wra; Wed, 24 Jan 2018 06:53:43 -0800 (PST) X-Google-Smtp-Source: AH8x226g/LBggY6DQEa+FRYZR8mKOXAr8gawuutb1JIVAjC97ltfMZH2YHfzcC+J8Q2DDkznYWPv X-Received: by 10.98.98.1 with SMTP id w1mr5934196pfb.9.1516805623383; Wed, 24 Jan 2018 06:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516805623; cv=none; d=google.com; s=arc-20160816; b=hb35vLi7NZMG83kUhMCYcWQ+FysYaF1CwApLK0TMIwT0bduu1RLHqmpK7SlsEbHA/s Q9xKzPgnsnFMfjR543uk2M8VIGBRoI5yMGVHjsj0cUhgK7W4gLW0fOzxNfiVMDOLSpzM k2rM03RYhsdgR8GvYD3jrS+nT9W/8uuBUlS8bUy4NOY9wO70YKDD10Eufu0R8VE1Pce6 sgzeUWh9zk2fCaBRPzetEFmPMlx+i0uv1DYEXNx0h4aIIUXA8ShM4oAk3IC+LP+JmFes vqriAvCFZ+xbnE+Xjp4GafGsMQDEKR54urDKYaKsuzzcnh1E5qf62ot08et40OmEd+Yr WHJg== 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=tKfkETPWI4oruvfXV15+O8aSfIxsbLOxb4HjudiV84w=; b=nCdzh9ta0qEKe9YjTMagfIQmCCF/VoDqL20WA1MLWdhoLxkMLmtb04K1meuk4YJ6yB OVxBTZ68vH2gfrC84ICkKXMUlTB+9afUb4Ntg/zzb+tjR6NQJosarzcImvlru+JkgzOD O28/nGCuqIN2XhWlp9AG1NVZ+O/DkEbj7d5Mc9YoXtHONnnnthyFZ+BtNz7Xe6K5AoXw K6OICasoh8rCS/CPVz7XEA5kkBIh24BSTkADu0wahsrypsZvWBVpLykeQ7XhH89eTeOO tmTpN7K0VUJoZWaZHQpe25KPhOc8QbnEfZPtSVKc1Os87HHWBcbG8ndc7kE5IKV4z5Tk wlQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=CxBlcJjp; 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 v196si229163pgb.584.2018.01.24.06.53.28; Wed, 24 Jan 2018 06:53:43 -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=CxBlcJjp; 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 S934057AbeAXOum (ORCPT + 99 others); Wed, 24 Jan 2018 09:50:42 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36272 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933783AbeAXOuk (ORCPT ); Wed, 24 Jan 2018 09:50:40 -0500 Received: by mail-wm0-f68.google.com with SMTP id f3so9148018wmc.1 for ; Wed, 24 Jan 2018 06:50:39 -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=tKfkETPWI4oruvfXV15+O8aSfIxsbLOxb4HjudiV84w=; b=CxBlcJjpbtGmXEHFeL43fKFoIuSenTgzPfHe3NkxPyecU9bk/ol1X3JjAxC+uKwlPo SZRhfjBeaed7yeWXKR16dH9ZkcuY2XoKprY4fClJ4Jm90of3IdKzhlx2T75LaJXdRTKz N9m33LKqqmT82vw9tybT1rpS5ziB/21BGW7cpjiu7pzIwSqqItG1SazTgFT2Jl4RMmtl W7s2gGw1dnvHEU/QDCfl79oi1TISgACtKchZMdhE4RefX7+mWEG2F/5G+k/dTEN+QLzc km1tOVWwoRLsvwyZbs14J7SkamolBtwndrIhuej4ei4h/5LSz/lo4oLB8fs1H7MbjA5i GACg== 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=tKfkETPWI4oruvfXV15+O8aSfIxsbLOxb4HjudiV84w=; b=d2Tn1J0rxsv6kdXa2VUF/Re6D6d5tTYA+fJMw9bXojxzdK7vIXSurmth+W5e8V9bSJ jZxbskGRXkekUv6i8MEMcU27ymQokbcTJN4mjcTKqmYEeTO1nruCawTrz3UyQx+22aKc 98PmOrHceMSYlAyP9/JckjdHFrUkS4nTRIGSmluPLdZmRo6NnNd1Cn0buDmvxJVg6ug/ MsOfwWQgjL7AvOZUbiKHkVkf+9DAv4gEdE0ZYJFywWBZxzI5f7JkUL+dEzw+sIleve77 AroVwLceUKyf4B9gVoEPeDO5jsctAXJuW/MsVxBkYyyrNEFW696tdJ0FFQuDLGKh9he8 Z0dQ== X-Gm-Message-State: AKwxytfP9G5B2P8QnNvyjbwgPPzyD+wAwWAF0eK4vbkhnsInrM1/1snh fOu+bCmLr5/YO4yC6LQUa5zcCw== X-Received: by 10.80.206.23 with SMTP id y23mr25515052edi.137.1516805438972; Wed, 24 Jan 2018 06:50:38 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id p6sm324449edb.62.2018.01.24.06.50.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jan 2018 06:50:38 -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 0/6] Enable CAAM on i.MX7s fix TrustZone issues Date: Wed, 24 Jan 2018 14:50:29 +0000 Message-Id: <1516805435-15034-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 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 (3): crypto: caam: Fix endless loop when RNG is already initialized crypto: caam: add logic to detect when running under TrustZone crypto: caam: detect RNG init when TrustZone is active Rui Miguel Silva (3): crypto: caam: Fix null dereference at error path ARM: dts: imx7s: add CAAM device node imx7d: add CAAM clocks arch/arm/boot/dts/imx7s.dtsi | 26 +++++++++++++++++++ drivers/clk/imx/clk-imx7d.c | 3 +++ drivers/crypto/caam/ctrl.c | 45 ++++++++++++++++++++++++++++++--- drivers/crypto/caam/intern.h | 1 + include/dt-bindings/clock/imx7d-clock.h | 5 +++- 5 files changed, 76 insertions(+), 4 deletions(-) -- 2.7.4