Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4927933ybl; Wed, 22 Jan 2020 07:13:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxTjhFKa2UiCjRre1b7LUzsXEmR74/Y1a75/bIswX4Ezi8o4lmftV9ydguDEgxhxVIGqbMt X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr7122030oig.81.1579705986104; Wed, 22 Jan 2020 07:13:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1579705986; cv=pass; d=google.com; s=arc-20160816; b=z1JRp2pAftz3QaZMsLj8D6YI680W4Y6SFaJkTW5CBjHiysZpkf8sJ/PSzbaON7dEmU dg8S4BoqtRVdLXP94iTNTGHccaabH0N+49WA86QG2HTNaAD0yaVfb6MHMicEB0gg9EnO niVKj9LGkJox+nRyetB934/z50a7kQiuseqEySqH3kjrPQEdbg02XoFWkBAgKBin8WwN IIhaHu8eXy+b11SjVcGfm8yXf75Bfm34WSVB5pQxRt+JRJyyVihaZHE9BgOVSLhG2YYO ufrOHa7CUi6uOCD5vTT20lELQPk7lS06RsWpuVIiP7geSgAMIqvkqPryMEvL+vX6YUk7 seNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=4Gi/JVocE/IQO1CICKM3jipHINJ9lHvNGOkKoTPNg+g=; b=QzyNVBAY2t+hR3p4fgQD2DTyvYz64w40tKdhgJZ56/l1KsFB8ZR0AO/tKPBXQX3Zmj bdR4XUSIIMYfcHdmilUHpoojl/ACbiCV/wYMEm+ycvrQTwh6/4I8HxgSfvBYW00B7FnF iWrrYB6raZ6SC1YxOi+UEsJfFPZS5uY6jlHvpdn2X33AfHifWT9n9BkuF6s6OJohxFeu yMADqxUZcSrCteUNeliMLOrdjjtHFwS6k73pei6lJsamlS1LQOamCOK4gVRka9pr0e7P 2UCwjMqf+KG6HLSUOTjesGYLBgvd9CkXdN1nsvcCYmvAy6QEl0UGDahkbtmwuB+gDpLa VydQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=kuh+mD9W; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t74si20733124oih.155.2020.01.22.07.12.53; Wed, 22 Jan 2020 07:13:06 -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=@nxp.com header.s=selector2 header.b=kuh+mD9W; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726191AbgAVPL4 (ORCPT + 99 others); Wed, 22 Jan 2020 10:11:56 -0500 Received: from mail-vi1eur05on2053.outbound.protection.outlook.com ([40.107.21.53]:50108 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725928AbgAVPLz (ORCPT ); Wed, 22 Jan 2020 10:11:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aEyOvh99v69RjfBhzM7Cshpo7xWvEIwGSlijk1jcVGJBWA7E6evOwGg0mIxOmUsVenUKDEXbfaE6RwKKU6zo6naM7oHKMGPjcXCvlVeH/kcfXGkaE5Bv/g1vrUjXIQ5FzjasISlDsDSnLtGNjJHPaUlm0eTL+sw+B5hCG/4tVbIcxs+++zb7h2erlAeSh0xW5gOSMQUhhgqs8nwJujgtm61XKtjWUKpSPn26kw+6VKw0irepK17O7xGMv6yumobMiU8sUJfCPYK7xCaa+BP21eaIf4BBmejNRlUvzpZuCOMYFEiPE8iUxpN/OgwA9D2QnKvn4UE2F434NgqVsc7Tzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4Gi/JVocE/IQO1CICKM3jipHINJ9lHvNGOkKoTPNg+g=; b=eMkPad1yOWWnr/NQhXoaRfXWlgE7zbJGgYRWnNu/jqDd0UMvvml8psgIEZ7suDr3gISB5Ad79lSRKNLqB4IwlAXc+ZBfcbhcd7RKx1sIlBzaZkclfMG1IqBbmg4ZjvuWmwDs/21WcvLYTa9gVDzmINtj49H4t5ndzKFySJMRJxGwGrCDcTXQXFoLoqDaQPv/S78pwwD3xfLwoPhI7ZMEMOnXLLEa1BlnRCrVn2RHyk6kaQ/2Y08oB7QwHaVwUrNwjeH5JIv+zWi+bdJXqB94lde4we1tAprnltmj753oM9YZcBI+FyJgDd/ca7tDOPgs63IS8bru6/91OeGBKk/wkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4Gi/JVocE/IQO1CICKM3jipHINJ9lHvNGOkKoTPNg+g=; b=kuh+mD9WGRhAPc/YREskCZfP0Qz2HLaF1/6GQ5gg6h3FL4MM6j5GxRASFLgmmVapPXqIq6wqnj2Zgd6YfUcXkqSNkGtjo4DAtQb0Mol/s9IF9HWwGv7yWDyQqmtvcMC/ecD8HVh7aGRgYyUHfvuDjX4SU3F9O/FyXaun09Q74+4= Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com (52.134.3.153) by VI1PR0402MB3469.eurprd04.prod.outlook.com (52.134.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.24; Wed, 22 Jan 2020 15:11:51 +0000 Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::85e9:f844:f8b0:27d]) by VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::85e9:f844:f8b0:27d%7]) with mapi id 15.20.2644.027; Wed, 22 Jan 2020 15:11:51 +0000 From: Horia Geanta To: Andrey Smirnov , "linux-crypto@vger.kernel.org" CC: Chris Healy , Lucas Stach , Herbert Xu , Iuliana Prodan , "linux-kernel@vger.kernel.org" , dl-linux-imx , Andrei Botila , Laurentiu Tudor Subject: Re: [PATCH v6 0/7] enable CAAM's HWRNG as default Thread-Topic: [PATCH v6 0/7] enable CAAM's HWRNG as default Thread-Index: AQHVxjopojbABEfYu0izDuntHRvy8g== Date: Wed, 22 Jan 2020 15:11:51 +0000 Message-ID: References: <20200108154047.12526-1-andrew.smirnov@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=horia.geanta@nxp.com; x-originating-ip: [212.146.100.6] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 428647f0-fd9f-40fd-c886-08d79f4d68b5 x-ms-traffictypediagnostic: VI1PR0402MB3469:|VI1PR0402MB3469: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 029097202E x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(366004)(39860400002)(396003)(376002)(346002)(199004)(189003)(26005)(186003)(86362001)(53546011)(6506007)(55016002)(52536014)(76116006)(66946007)(5660300002)(91956017)(64756008)(478600001)(7696005)(66556008)(66476007)(66446008)(44832011)(8676002)(110136005)(71200400001)(2906002)(4326008)(9686003)(316002)(81156014)(33656002)(81166006)(54906003)(8936002)(309714004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3469;H:VI1PR0402MB3485.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ag8VoGjDGnL3NcX3L3Ex4XZVsW2hG351mcMlRoEUzP2l0P8sKYDk4o1DiGfEZvDJSRKsyUPMKivrF2DgEaaaojpOK1e1xMApklw9IA2DFgMic39Az4Ea2l5wgZRRpBfdBjMCC+gWeEnv5Ft1hjSfPIsupBiiaqot6b2o/iztgSCG7kkA5Cfb1k/VjgGJvxDbPF2yV77hYWb15jP0syRq4WUUo1ySxDH343FrxN+TD9BrTsNYwJYZNCAuW7ur8lOG1pPZz/qW1fZK4P5PSwkm03S0gxpOhiSeE6kQZ9hqiIU+rjQTfKBTCgD6JTlmNaaz5i3gfVia8pRr+c36sMgM0osH+C5jwXjIypuvEGGub4ixDzdqsNfSWmVnMOPngQpzekEgAjNzKG5HDvaVvi/aj6l3XyXvP9q115b1eXKnfvV4NnPSqD2dj6yJkfNfTh/5zKIyW1AIdJkplxFOmvIdVg9tCJ333d0HjkOnCW3sbcpEvmEAPH++YKO8dyUiyzOl Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 428647f0-fd9f-40fd-c886-08d79f4d68b5 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2020 15:11:51.1985 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zYO2oR418R1zCoO7NAqRDwD32uvxOVzXB1/vU/lqG3Apat1F80qsEiixZZIKAJ81nwE+7eD02bVqUpyl1G0AbQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3469 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/8/2020 5:41 PM, Andrey Smirnov wrote:=0A= > Everyone:=0A= > =0A= > This series is a continuation of original [discussion]. I don't know=0A= > if what's in the series is enough to use CAAMs HWRNG system wide, but=0A= > I am hoping that with enough iterations and feedback it will be.=0A= > =0A= Testing on DPAA2-based Layerscape platforms, for e.g. LS1088A:=0A= [...]=0A= [ 12.379136] caam_jr 8010000.jr: 20000256: CCB: desc idx 2: RNG: Predicti= on resistance=0A= [ 12.387036] hwrng: no data available=0A= [...]=0A= =0A= caamrng driver fails, because RNG initialization is skipped=0A= in ctrl.c - caam_probe():=0A= [...]=0A= np =3D of_find_compatible_node(NULL, NULL, "fsl,qoriq-mc");=0A= ctrlpriv->mc_en =3D !!np;=0A= [...]=0A= /*=0A= * If SEC has RNG version >=3D 4 and RNG state handle has not been=0A= * already instantiated, do RNG instantiation=0A= * In case of SoCs with Management Complex, RNG is managed by MC f/w.=0A= */=0A= if (!ctrlpriv->mc_en && rng_vid >=3D 4) {=0A= [...]=0A= =0A= NXP is working at adding RNG Prediction Resistance support in MC f/w=0A= (will be available in v10.20.1).=0A= =0A= However, there's a backwards-compatibility requirement: kernel should work= =0A= with older MC f/w versions.=0A= To fix this, my suggestion is to force RNG (re)initialization in case=0A= MC f/w is present and its version is < 10.20.1, i.e.:=0A= if ((!ctrlpriv->mc_en || (fsl_mc_get_version() < "10.20.1")) &&=0A= rng_vid >=3D 4) {=0A= [...]=0A= =0A= fsl_mc_get_version() - I've made this up, it currently doesn't exist,=0A= it should be added in fsl-mc bus driver (drivers/bus/fsl-mc).=0A= We will provide this shortly, the plan being to integrate this change=0A= as part of this series.=0A= =0A= Thanks,=0A= Horia=0A=