Received: by 10.223.176.46 with SMTP id f43csp926790wra; Fri, 26 Jan 2018 09:02:53 -0800 (PST) X-Google-Smtp-Source: AH8x225IKfH0/UlUgIZpsk+uAies/PwjTHmj7TPPbS8cdwzF0tDcs9/TaHhloZQCMKkF9OrTK65N X-Received: by 10.99.153.1 with SMTP id d1mr6129469pge.190.1516986173322; Fri, 26 Jan 2018 09:02:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516986173; cv=none; d=google.com; s=arc-20160816; b=rcmTzmd4YiA6jBrSgUj2qJeE8ENaRKza7u6nJ7VDvI5PVyPCrvfDdzOZNVWb9d5trG hFuSbUSROhEV6WBy8Q3zQgsWVpXq1uiB9jsuaLq5jjx37/q9U2PHQmkGr2az2AzSnh4f FApmCGT5yzFgSMPSGCr82MK6HqaEWwDDcfdaawZjf7sZB6PhTkN9yXVLvF0z6/gNXWCD PdtStrB+BtVmm3iqs9xCsLursq8lYAZRaATt4TiUcHVBkhWigpKC8kt+lNYmaoBNi/py 5o1ZLWJGYld+bViZnO1+594uhZcsxxmGAoaVQzqdC0dBe5A38WaqHhjVEjv0Trr5D3XT 2WXQ== 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=UbjgXRp88AGwmgDzoEJuT+PrZJFKxbXwoka6+EN2r+w=; b=m1kq4nl3lizx8FErnCEUtNjHgqX0Y1YUPiIvanbWOMpxAPF4kDjzw4n2CeKaTSCg+f yF+dNEuMEGStpcN3hL3VsJkc3jlhnmeWlVvEAesDQ3BwTBTc+XI8mbKi0V/eeO9c16uU wN8bDs0401ThmzpwZSuUDSlb6km0a/6sXheoIvByybqU0gxEs6+byi1ICIsRN9Wio2Wg tpj+p8TLHyiDurV9ZtvQJ6VEk662JqcGjKBQGaCRpqJmSbk2YRRfFxYnimf+QeLGVJhh VTU9iE20o74lbBd+NwBv1fw588DfW6zl9tt9Sou2Hl8GoFMU8B0rHmqWaCsg/LBv+2Ay 4XVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=VYzomIVU; 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 30-v6si3960014plc.548.2018.01.26.09.02.38; Fri, 26 Jan 2018 09:02:53 -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=VYzomIVU; 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 S1752000AbeAZRAK (ORCPT + 99 others); Fri, 26 Jan 2018 12:00:10 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54126 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751370AbeAZRAH (ORCPT ); Fri, 26 Jan 2018 12:00:07 -0500 Received: by mail-wm0-f65.google.com with SMTP id t74so2581178wme.3 for ; Fri, 26 Jan 2018 09:00:06 -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=UbjgXRp88AGwmgDzoEJuT+PrZJFKxbXwoka6+EN2r+w=; b=VYzomIVUh3ZThMaqxrGAIjCYNs4Wy9tvPjo8GyuvMszkxIQcqw2jkTO31nJJEg+SRU 3/fvL2xtE45HVhHcgsH7v8wFisEbbG5C+AhgtPp7UovyimKgaCsuL3mO0DsumBFF04S+ pgcRGWwQWMPfD43d0gGqeeVaLaWmbEryWwANxRtAx3LAM8/eKjlgWE+3AUrK99KHJrWT fINBOey7BUmzkCuTtJ0he6x/4vI5zXMmy3evZDl0v11zAZ0XGDUEp8d19/htKmOJl5ja 6me/HfsqZhc9vbGjNDjR8nw2NNTIwhXilYBKrKMUOn5euxxrKMH4ZKn/rQmfQILUNbvM K1pQ== 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=UbjgXRp88AGwmgDzoEJuT+PrZJFKxbXwoka6+EN2r+w=; b=PW92RWUpP0RN4nqKunKpA+/U6BVxzWjVQ6zZlX47mhgn5wBA+CR4rvRINwfSbhcegm kD2GynAIyN2P/nIf4w+DP8ls6Gntm+GQ8xHMKs4rmUHe18pONDx+vafH8NeCvxOxfFVS ixGdwGkjGAKRK6C35L7QpNQ2TylJPo/gZT+YidsCnN6PN5vqlR3YsqeGgrIxoa2sa9fF iZrGpJ6Md3ytcZ0cze7JCXZuXojVybGiWAMVtpZaMGPcIh+9pjGu/ZLWUJy9ZRZgDTN6 4ZZjZsuy11wra/RwWy3xKAdSA6dt+7Av76tQ/5WnKMpqk/U4RcqTxlSE79ar9wG80nbk 59zA== X-Gm-Message-State: AKwxytdQO4R62phx92OnsBX1yzhLIlEBfF8FMZh8X5Y/H6XIqlHeLPk4 HlwgKyfQ0meqkCxg9EP8f5a1GA== X-Received: by 10.80.174.245 with SMTP id f50mr34783437edd.28.1516986006170; Fri, 26 Jan 2018 09:00:06 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id d21sm2733949edb.13.2018.01.26.09.00.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 09:00:05 -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: [PATCH v2 0/5] Enable CAAM on i.MX7s fix TrustZone issues Date: Fri, 26 Jan 2018 16:59:59 +0000 Message-Id: <1516986004-25452-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: - 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