Received: by 10.223.176.5 with SMTP id f5csp698704wra; Tue, 30 Jan 2018 18:03:55 -0800 (PST) X-Google-Smtp-Source: AH8x227TbS5Fa0Lr1/nt/IruNZ+1PYkflz9lhfpHjQLxh59vTV3qgJ4PZ44k+sdjmvCP5GKkgPyM X-Received: by 2002:a17:902:6b89:: with SMTP id p9-v6mr27284631plk.377.1517364235006; Tue, 30 Jan 2018 18:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517364234; cv=none; d=google.com; s=arc-20160816; b=VYpdCofodJ8YCpO0oCTRU/axMU1LWBfMYSGe0w3mqUZ1uAUVBwNdlYkiVfP/3SsONM CNz9NjuUJbz5ncofw1jlogxH5IAWsKmwAlpkx/+0I8DDv/lxDDsOWXuN79NB+mPM8u9h nSx4/ZmU0GDwBYrFzXpFL+z+fpJSzQn1c6FII6GrLXiOgFlMrPWh9kD85Drzjx8SL+qV vT4sFOy/2OIfinrGs508mj6YVlFQa42snCy8JzxotcMh/Ztmvwzyzee2bxvVn5gRSg6I 06pyiHDBH9ANOHeEThBCMTbldDtmsWs8JopmDRtQb1M5CpFKiTlSAQgMuzQVslTNC3SB CK0g== 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=ekI+iMh9+iwQ9EVud4Eavx2ns7X3cX6eAQwhuqCQ/Yk=; b=P7VzcDyxnJRCrd7M4wl54Lh3Fs+ZsjJiC5SIzMr11jUFu4Iz7TkW2nmvPvmph17GdC dTJiuD5gyaVNYC9/5GYvKoiACqcpjWatsaw/Wt/mnwldVpjYpSu1lXLHpXhOYwmtahef biBp7onVBYWvgH1E8A1W6TS9xFNwHEbNo3Z7/Sm/CyyqKJZdpoSHKByc2tmEJEdQcxeo x4J4NCffuJQwYerqfyo7u4BXp8EgbkZCuD4pya/CPJ/ZX352BfrrttPo9DLKgB2iFOWf ZB65YOnb4bOlJ8CNCG3EYn3Uu7EIRUIkKfO/DyalDOsDQ/a1sDS2x/akoDRODEgt7C4E FWrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=KqCykANg; 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 b20si644702pgn.655.2018.01.30.18.03.40; Tue, 30 Jan 2018 18:03:54 -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=KqCykANg; 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 S1752926AbeAaCAq (ORCPT + 99 others); Tue, 30 Jan 2018 21:00:46 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:40157 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752874AbeAaCAn (ORCPT ); Tue, 30 Jan 2018 21:00:43 -0500 Received: by mail-wm0-f65.google.com with SMTP id v123so4843697wmd.5 for ; Tue, 30 Jan 2018 18:00:42 -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=ekI+iMh9+iwQ9EVud4Eavx2ns7X3cX6eAQwhuqCQ/Yk=; b=KqCykANgBMlIihAMTTfgldAs6Akklb0oOYpfcfZajiChd0mIfPB+q6vb0Aff0LRdiU XIVFEPSUn/5soYW+x8L88euMjBjNuokGIEKNnE++E1Mz1cC0/Q0Pru8AlCMAF/vlQ2g2 Jp6GpOLmzWIEHlTJk6gNJtTfNhOkcmnmUakN/UE7C1zD4e3eipr/DILVtxR2TdfkbWl2 I/eDTLihB5LBe3Sj7coT5FXJ1qJ9Gy70yQa3nC5OK6dSgPQg7J4+HW7UYlJiQ+QDKlpW dC1YupCF0WkofZW90HEvwfEq2f9TpHXtLNja7+yQZtb5r8cvxlJOFueThS2czKBg5of8 lwuw== 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=ekI+iMh9+iwQ9EVud4Eavx2ns7X3cX6eAQwhuqCQ/Yk=; b=NpVsdaVVvwW8XHBkUhE3MwXzA0k37iVYKCkabTjn8ebUBFskD6zYKKLEjnjsdO9mST 1NTheyFCZrOtsP9NLLkp+fsJzIffdd3lwo++eY25T7Yu6zuPdD/2f6//IEtBDGr1uCyZ We1f6mkq15YjTfXJfejnc5gI6nQxN51XDrqqoIzTgJWO3eYSzJ2EfXe2Y8TlfFOl9jJ9 UAaZPlzSnyOO2QbNLjRIOl/1KElxpmNPySQvRYelgx/TDVn309364ugBwY1MASqMFesP mfx9QqAFgFq72bAUL3stxuDmAEFaTTvRVC70Q4hsjdk5AYQyEHY5enFEnhVqfUbVOjHk E22A== X-Gm-Message-State: AKwxyteK8w27PDn5vEXFvoMvzf0PnPP90NKGJsh0nxFGr0XorJtJhFsY 4C6LixFomkIMCm5wtRu6holsCw== X-Received: by 10.80.132.170 with SMTP id 39mr52596356edq.231.1517364041830; Tue, 30 Jan 2018 18:00:41 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w26sm9030867edw.7.2018.01.30.18.00.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jan 2018 18:00:41 -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, davem@davemloft.net, lukas.auer@aisec.fraunhofer.de, rui.silva@linaro.org, ryan.harkin@linaro.org, Bryan O'Donoghue Subject: [PATCH v3 0/5] Enable CAAM on i.MX7s fix TrustZone issues Date: Wed, 31 Jan 2018 02:00:35 +0000 Message-Id: <1517364040-27607-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 V3: - Added Cc: clk driver maintainers - Fabio Estevam - Added Cc: i.MX arch maintainers - Fabio Estevam - Removed bouncing email address for Herbert Xu 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