linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <pure.logic@nexus-software.ie>
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 <pure.logic@nexus-software.ie>
Subject: [PATCH v3 0/5] Enable CAAM on i.MX7s fix TrustZone issues
Date: Wed, 31 Jan 2018 02:00:35 +0000	[thread overview]
Message-ID: <1517364040-27607-1-git-send-email-pure.logic@nexus-software.ie> (raw)

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

             reply	other threads:[~2018-01-31  2:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31  2:00 Bryan O'Donoghue [this message]
2018-01-31  2:00 ` [PATCH v3 1/5] crypto: caam: Fix null dereference at error path Bryan O'Donoghue
2018-01-31  2:00 ` [PATCH v3 2/5] crypto: caam: Fix endless loop when RNG is already initialized Bryan O'Donoghue
2018-02-01 12:16   ` Horia Geantă
2018-02-02 11:20     ` Bryan O'Donoghue
2018-02-02 12:54       ` Auer, Lukas
2018-02-05  8:45         ` Horia Geantă
2018-02-05  9:15           ` [PATCH] crypto: caam - fix endless loop when DECO acquire fails Horia Geantă
2018-02-05 13:54           ` [PATCH v3 2/5] crypto: caam: Fix endless loop when RNG is already initialized Auer, Lukas
2018-01-31  2:00 ` [PATCH v3 3/5] crypto: caam: do not use mem and emi_slow clock for imx7x Bryan O'Donoghue
2018-01-31  2:00 ` [PATCH v3 4/5] clk: imx7d: add CAAM clock Bryan O'Donoghue
2018-02-01 14:53   ` Fabio Estevam
2018-01-31  2:00 ` [PATCH v3 5/5] ARM: dts: imx7s: add CAAM device node Bryan O'Donoghue
2018-02-01 11:44   ` Horia Geantă

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517364040-27607-1-git-send-email-pure.logic@nexus-software.ie \
    --to=pure.logic@nexus-software.ie \
    --cc=aymen.sghaier@nxp.com \
    --cc=davem@davemloft.net \
    --cc=fabio.estevam@nxp.com \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.auer@aisec.fraunhofer.de \
    --cc=peng.fan@nxp.com \
    --cc=rui.silva@linaro.org \
    --cc=ryan.harkin@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).