From patchwork Fri Jan 26 16:27:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 126000 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp451897ljd; Fri, 26 Jan 2018 08:28:36 -0800 (PST) X-Google-Smtp-Source: AH8x225++QNNkPDwSrIAD9oDNTCXXruLCubIciVGu/ibH7IfuDgqwtZrBZmYuuAEXqvblzBLLVw/ X-Received: by 10.80.181.197 with SMTP id a63mr25365397ede.138.1516984116374; Fri, 26 Jan 2018 08:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516984116; cv=none; d=google.com; s=arc-20160816; b=NruomYNSnNJbCwUVPqn5yafBDJnQSsClJtd4QpbCJljq8rFWSo5D8lx1fIcChsoZc1 c+flGtnI8I0LjJ0qQ+Oh+VgZ72Gs+CZpFkuPPufv1z7Qcezb9QjDZCgMyqSEHBFnsxKh r0lt4j6NhvLm9WUufffmsGoRBRG6ycH6dwd0EugOr8QbTEnlGrxRmNRukFkJtli7iwsS 1fjjUrIRnseyqW+ioNl4teSRtHoc9+X+TGDoylNTuwP3ZpfNp18q6BExf2RtkkKG9j3E 8jqI0OLiVUoVKDVMnbYUXVjgXzuuew6fQq6oBzmWNhTSn2jnynTaE3KCyQJimVxL/PQZ u4Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=yA6ZDKNSabaX6XOExIVzH5M3YUQMp+M3NNj+9fq+ycY=; b=pRfNYNZlwlvJhS10JaWrx5cALLzj7nWefvUS8hdTC52aAjSdmX3W7VzmerdVWqFnsV OUMNGVhNFLSfAZEXDuyd2AC6XQQHrRfE1kf+F5L3hU0GVCJTBhn+XGmFwg79nPSQ0lnU IvrPGDkJCQUpi4CY0bP0XteNfeVYJhOrZxkLhvUAPU+Os7gUWuKaFzUnxMmo07iPAo3U l0q7nReBEbnjdxqFRJBRQ7L14+slQQn202faaXxC2lfJbTlpIJqb07bHGlJVRVLVyOXO XOw5LvnHirM1vCRdLfNvU8NwhpBd2pfJD07zF0/U8IiWpJgtjXpkMcWgLNVqf/2C2d8x NdLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZDrRKBeM; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id y14si4175189edd.111.2018.01.26.08.28.36; Fri, 26 Jan 2018 08:28:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZDrRKBeM; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id E5976C22031; Fri, 26 Jan 2018 16:28:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D03CEC223E3; Fri, 26 Jan 2018 16:28:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 94E46C2202C; Fri, 26 Jan 2018 16:28:03 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id 40249C21F7B for ; Fri, 26 Jan 2018 16:28:03 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id f3so22343166wmc.1 for ; Fri, 26 Jan 2018 08:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=UFektGUT0F8H8ofO36X+fxQvqJsjUkgfEn7jIDmCJ8U=; b=ZDrRKBeMxR655VLdv1BGajl9ppynVfC1P8SHosvs2/ETO5z0PC07JANOGMzVtRaAah 37kJBLXCRwTfk/gcfVGtyevehPSKFZL4RnX5Z6nU0uc3Sy917q7wmp+YlmuPmnovcLrJ StesYNOWLWhkzmzk3NrAInyJQdCPzW2rlnfA4= 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; bh=UFektGUT0F8H8ofO36X+fxQvqJsjUkgfEn7jIDmCJ8U=; b=sOd3SGpStVl6sTlcUvkZFXVzd0+rVSynMNi0bI4x3BYtJXzFtCylmzuupWlyLFfQy+ HkX///1P3ECOGJE5ufzVNuRx3EGe2Tofc2Cacl/43oCGlla4828vKHLfc+/wF93M1+/0 r+rIm3Y1hBYe8Tu85fZDMLFWdErireS/a81oW3eoJlSctF2X3jqi+9TE03ZM80/eywtH WM2Wnn2Jx+6TBYTizJxRG9uPSBuS97sAQmyxsmSn4+q2y+tX2F8HudKJk9rGJdKwwA8o OrBMnMRPWO3oOhlLjwHzqDMtzKFa4hOe4A2D6WLfQR26eQIKm6iQ0kxjZYd0LskqeAXu uhoQ== X-Gm-Message-State: AKwxytfYAx8PdElyTawiqP2bhvL1f5hB+d3m6M/8ly0gldPQC8N+ZBgO uZGpnXqiU3oAvt8AHj08mLYFbZjwDEw= X-Received: by 10.80.215.222 with SMTP id m30mr35000226edj.296.1516984082745; Fri, 26 Jan 2018 08:28:02 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id z11sm1951741edh.94.2018.01.26.08.28.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 08:28:02 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Fri, 26 Jan 2018 16:27:58 +0000 Message-Id: <1516984078-21030-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Vanessa Maegima , fabio.estevam@nxp.com, Marco Franchi Subject: [U-Boot] [PATCH v4 2/2] imx: mx7: run sec_init for CAAM RNG X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch adds a sec_init call into arch_misc_init(). Doing so in conjunction with the patch "drivers/crypto/fsl: assign job-rings to non-TrustZone" enables use of the CAAM in Linux when OPTEE/TrustZone is active. u-boot will initialise the RNG and assign ownership of the job-ring registers to a non-TrustZone context. With recent changes by Lukas Auer to fully initialize the RNG in sec_init() this means that u-boot will hand-off the CAAM in a state that Linux then can use the CAAM without touching the reserved DECO registers. This change is safe both for the OPTEE/TrustZone boot path and the regular non-OPTEE/TrustZone boot path. Signed-off-by: Bryan O'Donoghue Cc: Fabio Estevam Cc: Peng Fan Cc: Marco Franchi Cc: Vanessa Maegima Cc: Stefano Babic Cc: Lukas Auer Tested-by: Lukas Auer Reviewed-by: Fabio Estevam --- arch/arm/mach-imx/mx7/soc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index d160e80..d444046 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -17,6 +17,7 @@ #include #include #include +#include #if defined(CONFIG_IMX_THERMAL) static const struct imx_thermal_plat imx7_thermal_plat = { @@ -262,6 +263,10 @@ int arch_misc_init(void) env_set("soc", "imx7s"); #endif +#ifdef CONFIG_FSL_CAAM + sec_init(); +#endif + return 0; } #endif