From: Horia Geanta <horia.geanta@nxp.com>
To: Adam Ford <aford173@gmail.com>,
Schrempf Frieder <frieder.schrempf@kontron.de>
Cc: "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Aymen Sghaier <aymen.sghaier@nxp.com>,
Fabio Estevam <festevam@gmail.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rob Herring <robh+dt@kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] crypto: caam: Change the i.MX8MQ check support all i.MX8M variants
Date: Tue, 10 Dec 2019 07:56:09 +0000 [thread overview]
Message-ID: <VI1PR0402MB34857B8C5560B912B34674AB985B0@VI1PR0402MB3485.eurprd04.prod.outlook.com> (raw)
In-Reply-To: CAHCN7xLkV1WC=9ACj1Mi8+uE8kRCEjCEe+Y36pXwkNeNrgrNVg@mail.gmail.com
On 12/6/2019 9:55 PM, Adam Ford wrote:
> On Wed, Dec 4, 2019 at 5:38 AM Schrempf Frieder
> <frieder.schrempf@kontron.de> wrote:
>>
>> Hi Adam,
>>
>> On 30.11.19 23:51, Adam Ford wrote:
>>> The i.MX8M Mini uses the same crypto engine as the i.MX8MQ, but
>>> the driver is restricting the check to just the i.MX8MQ.
>>>
>>> This patch lets the driver support all i.MX8M Variants if enabled.
>>>
>>> Signed-off-by: Adam Ford <aford173@gmail.com>
>>
>> What about the following lines in run_descriptor_deco0()? Does this
>> condition also apply to i.MX8MM?
>
> I think that's a question for NXP. I am not seeing that in the NXP
> Linux Release, and I don't have an 8MQ to compare.
>
IIRC the i.MX BSP releases use the JRI for initializing the RNG,
and not the DECO register interface.
> I was able to get the driver working on the i.MXMM with the patch.
>
You are probably using a newer U-boot, which includes
commit dfaec76029f2 ("crypto/fsl: instantiate all rng state handles")
> NXP Team,
>
> Do you have any opinions on this?
>
Since current U-boot initializes both RNG state handles, practically
instantiate_rng() is a no-op.
A simple experiment is to "lie" about the state_handle_mask, to exercise
the DECO acquire code (or, as mentioned above, to run with an older U-boot):
@@ -268,12 +272,19 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
struct caam_ctrl __iomem *ctrl;
u32 *desc, status = 0, rdsta_val;
int ret = 0, sh_idx;
+ static int force_init = 1;
ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl;
desc = kmalloc(CAAM_CMD_SZ * 7, GFP_KERNEL);
if (!desc)
return -ENOMEM;
+ if (force_init && (state_handle_mask == 0x3)) {
+ dev_err(ctrldev, "Forcing reinit of RNG state handle 0!\n");
+ force_init = 0;
+ state_handle_mask = 0x2;
+ }
+
for (sh_idx = 0; sh_idx < RNG4_MAX_HANDLES; sh_idx++) {
/*
* If the corresponding bit is set, this state handle
In this case boot log confirms the DECO cannot be acquired:
[ 2.137101] caam 30900000.crypto: Forcing reinit of RNG state handle 0!
[ 2.172293] caam 30900000.crypto: failed to acquire DECO 0
[ 2.177786] caam 30900000.crypto: failed to instantiate RNG
To sum up, writing to DECORSR is mandatory.
Horia
next prev parent reply other threads:[~2019-12-10 7:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-30 22:51 [PATCH 1/2] crypto: caam: Change the i.MX8MQ check support all i.MX8M variants Adam Ford
2019-11-30 22:51 ` [PATCH 2/2] arm64: dts: imx8mm: Add Crypto CAAM support Adam Ford
2019-12-09 16:23 ` Horia Geanta
2019-12-09 16:47 ` Adam Ford
2019-12-11 14:36 ` Schrempf Frieder
2019-12-04 11:38 ` [PATCH 1/2] crypto: caam: Change the i.MX8MQ check support all i.MX8M variants Schrempf Frieder
2019-12-06 19:55 ` Adam Ford
2019-12-10 7:56 ` Horia Geanta [this message]
2019-12-11 14:23 ` Schrempf Frieder
2019-12-11 14:27 ` Adam Ford
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=VI1PR0402MB34857B8C5560B912B34674AB985B0@VI1PR0402MB3485.eurprd04.prod.outlook.com \
--to=horia.geanta@nxp.com \
--cc=aford173@gmail.com \
--cc=aymen.sghaier@nxp.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=frieder.schrempf@kontron.de \
--cc=herbert@gondor.apana.org.au \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.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).