Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3765002pxb; Tue, 19 Apr 2022 09:21:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPSk5FkX+hLCRV9zPNTWsGiL5DyLelW6/zcVkO9OOdRFeJt/dGj0mxFVwIYQwKjjneY7n7 X-Received: by 2002:a17:907:7f24:b0:6e8:b5a9:3434 with SMTP id qf36-20020a1709077f2400b006e8b5a93434mr13988343ejc.254.1650385308331; Tue, 19 Apr 2022 09:21:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1650385308; cv=pass; d=google.com; s=arc-20160816; b=IAUTbpIOr3oWiHiqkuA9+bYXzkUnnzdM1vOG1Z33y3B/vlDsZWRn5e7gXS7Y2Y2ezt mVSmDqOmjovgzzXqAmlDV1oxNZWByBjP1mGHW/Wy0YiOIgenIY8mK3LpiUVPyZaYGJR+ Tya2rLYXQG8e3ADKDH8KNbLFLznHeg30B3q0yjjxfCcyvlvcB57LlwFz2WacrkWL7Qb4 4MtblLSs/E0j3biPc/GHD3gD5pLKB8jyDXL7qiPGMQiSfqaBZdkcJ4tMt4bTOJsk1OGy JBM1v0w2/qL7bq1+9TmSlvpvq+rODy+8FJJ+lO0CPxhuVjlOr7UxiACKAkbfafgL38Fw lCbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=CC3pXKyaddg4dOkweotze9l/atf5G/1ppF2ShY5NDV0=; b=rFZJYsWTSWtEDEEw3DC3bsASWE0tdhef300tyH6/WK7NfX2uONvCIyYXFJdszlhSXD n45D21d06EXYdku/h8FLY0AfCXj3hL+A04Ocox7y0x1lc0nyrrECTWix3i0AMZRVDZ3r HTLbL5lzgkBklpx1O4ktoM8WP/ihfZqA2Blt7Ot0W5xuBiKy90d7toAnHVAR18r76bgL pwrfcOdCoLHXCjs/ADjkqQM6roE5ZVZYahuBkS/XyOGf7KLKFoYKHXD9ripSXNfi+FkW 7z9F9dq8np3mgc1DmPN7dCnFn2n+t6Pk8YIEnsbPH3TkSFik3eP7ocvU398Hhj/uQomP 0O+g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=boEGmCLm; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fy14-20020a1709069f0e00b006e7aa3c462esi8184416ejc.276.2022.04.19.09.21.14; Tue, 19 Apr 2022 09:21:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=boEGmCLm; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 S241596AbiDRPbr (ORCPT + 99 others); Mon, 18 Apr 2022 11:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241347AbiDRPbO (ORCPT ); Mon, 18 Apr 2022 11:31:14 -0400 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40049.outbound.protection.outlook.com [40.107.4.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD605F9F for ; Mon, 18 Apr 2022 07:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ka3/oDBPHJw2msxHNlHcAWo99WFLD69MCpI1pw6sf6cHlUgqjMuQw2oAviRltmQL8bXefDEk4btJjoO9uz/oUUcHyF2cRMdJ090mNQGS/FyCZMjB7mfNULy70bN23M0OhQ735fzFB2miCgfJyxez4lzolxfKW1JZa56ZDwyFxWW6RGwATUDw4ZOivrnkaNbhvi225dMYjBLCv368IK4ynhYtzeWZtw+S6n+/BShtMydgNa1Hnlj9kR8nqFVxGu3WyJJ0gR5sFJL9cC3tbIZBxwmFw68Xl5VwBEo5g1bhQdlsujXnYrW1AK/U1rHiLPmhxRZVr4CXldzCAo/sqSE+Ig== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CC3pXKyaddg4dOkweotze9l/atf5G/1ppF2ShY5NDV0=; b=O9/6pq63qKJ58tsF/43TZnJg90QHC4pBWbiccMk4OjFX++asnd0+PzRe51mEktLnbMH+F2DcZhP0Um/hbzrAFsiF1erGxtCoBoP4Qw+pgWAnRnZugg0N6f3FeVlpbQ1/kdZgKQfVxP5/QTbKNkA4+dpvqK+Nah/7Pp4md0O2FJVdeheklvOF4OTR53xnCw9DtXzTAIkjTR4v+4fAn3BWDuB9c275nXxyyIhU5DD5+/220wwdFDT2lrd3MmRfC5/s46Zq5SeDpWlPaY86D7BU8uXSkzaYBwuLFKsngt9YBGgeRQNzU1W1WCUX2dh52sLGZhCRIgOY3t4MJLFef+4Ldw== 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=CC3pXKyaddg4dOkweotze9l/atf5G/1ppF2ShY5NDV0=; b=boEGmCLmY7lks289JS5WafEVX1aMurnoM1gTdWPeM5XTHdC3A4u949msmIVVu89z9zqt6EWcD+99bH1ySIuCxCnNfU4oCUpPsgG83cGzvbaH3CFaFy54/Da36BI+J7X8nSF4Nr9PoE0diPL35huZ3K1V5aIhYP+Rxe5+An88RWs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9517.eurprd04.prod.outlook.com (2603:10a6:102:229::20) by AS8PR04MB7608.eurprd04.prod.outlook.com (2603:10a6:20b:293::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 14:43:28 +0000 Received: from PAXPR04MB9517.eurprd04.prod.outlook.com ([fe80::ecbc:8286:8006:fb5f]) by PAXPR04MB9517.eurprd04.prod.outlook.com ([fe80::ecbc:8286:8006:fb5f%6]) with mapi id 15.20.5164.025; Mon, 18 Apr 2022 14:43:28 +0000 Message-ID: Date: Mon, 18 Apr 2022 17:43:25 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v2] crypto: caam - fix i.MX6SX entropy delay value Content-Language: en-US To: Fabio Estevam , Herbert Xu Cc: Gaurav Jain , Varun Sethi , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Fabio Estevam References: <20220416135412.4109213-1-festevam@gmail.com> From: =?UTF-8?Q?Horia_Geant=c4=83?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AM0PR02CA0086.eurprd02.prod.outlook.com (2603:10a6:208:154::27) To PAXPR04MB9517.eurprd04.prod.outlook.com (2603:10a6:102:229::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a75bc050-fa54-41ba-1431-08da2149cc8b X-MS-TrafficTypeDiagnostic: AS8PR04MB7608:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fF79ZJFoQObSmAjRFBu5y9LKNdSEoFlLMlaxd3IcBJQcURMgGLq+4u+rzmmB9oPhuQN98c9byL+vHY/oUNvJ3mGQcalpPE8wu10Nhb0GEIlG7LkHytsOOvzHY1Edca5DcNOmtGGrHpKQN65Dh4KIKHB81YDSq1ckoCq8CHSi0bchTt2dcTW834X6Fnpg+P9CUfRB8Ewsvsn8EN96ZtB3Fg61G3uyVF8YnALOse+AU6mOeTwGPW2laIcoAQkXKPN1bSI7I4AyyrDRBMHr0jRNuxLwGF9ss6uoL0pKT2Va+/cxBOKshYilruItaCpr7dh5HjEL+Qpb2YAhomkudzuLod8RQKxGfGobmdalF3J2Znj0BkQoLlV2pAl+Pp3pcGtATHUpCdkcgCd2WNOgvHXtq+7Pa9tzomH7d4NEPdiPdIn6KC6Sa2yBgZXd3RQATpMiuc+zZ6QbKMFFQQnNwA+TLjQJTOamKhhSXCeSP6XiX3BGy43pq0OBa9u+9LVGd9nXHfmgqmegXNQks9WtfapQ1Jz6BekdXNvKp1FskHHtQrteRthuj+1+VSzTw44BhaUjt+SCLGdqEwm49akbZWrr5i9uiTm4tdw2cJxMo3e1pwD3gVESV0e+QcSoH4yQiiSe810UCV3sOhhG0Uj0aEgHwOnrQA7QC06vvWfBKtz+b4h2rzDd+z86hFacGPWoKy2Ta/7MSqlocQoEHJoTvP3tFU/E6J0zeuyXk61dSRes3dxdMSQgmUqsWJzo2mLRktVp/WnxQbgdQmmbGTUq8O8gCarCCvM0sL6Vp+PDXMJX2zs5+NYioLBrop6qfwHdUv+ARg3+BcdzCVTNMjoc1tHHlQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9517.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(53546011)(508600001)(52116002)(31696002)(38100700002)(6486002)(8936002)(38350700002)(8676002)(26005)(186003)(2616005)(66476007)(6506007)(6512007)(6666004)(86362001)(966005)(83380400001)(5660300002)(66556008)(31686004)(66946007)(4326008)(2906002)(36756003)(316002)(110136005)(54906003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SEZHMUN5eUIrUFNmeTNOQ0d5d0cxVk4zUndMNXpKQWpsWktWa3ZMc2pvTGhy?= =?utf-8?B?alRUZ3JTRzE1V1Badm9FbExuU1J1bkhzckZtbk11WlV4L09kQURjcTM3WHRq?= =?utf-8?B?RDArVXpMMHgxYWVLMzBzQ3dRT3lmdmNiM2xPTE56djk5R1BhMDBCdDREdExF?= =?utf-8?B?OTVUNlVHSHRtWW1JcXFsV0JkMVR6MFhiaS9JV3l3NW9ZSTNCVVdMMWFNbi8v?= =?utf-8?B?eGF1WStnVnpBZmtUc1IxbjJSQmRpSUgrSW9STzQzd3pWSVFhY2Z1b0JmVUJz?= =?utf-8?B?dTFJMWludjhUUDdsS0JHV0RMVHdVNEFxRHNGZVVDdUk0QzR4N1NNN09RWHVa?= =?utf-8?B?YjBqQnd2ZmtiVnhUU1RtOGR0ekZHOFQ1ZWhPN0JnWTNtNjUrNWZPMXBPUDlF?= =?utf-8?B?eDg1NzRpQXdlMGgzZmU1bWVMMHpMU0NHS3lLZXdUVzZqRU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TEpUS0V3TTN2V0hJNVdNU1BmZko1NVhkd05xdnZPSWdZS3RFa3k4ODcv?= =?utf-8?B?TnJEVDBySTNha2tDVE9VYjg5OHJ5ZkpTRjlzdzNVbGhWdG9KSk9BSmxvUDJs?= =?utf-8?Q?qVHF2yaNlzws7ZVo=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a75bc050-fa54-41ba-1431-08da2149cc8b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9517.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 14:43:27.9667 (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: gotqabYSE4f3/GOSr+m9J1GsLynAKb1nDjEHrYk/rVzed8Cwb2eh3nHBCopyeevI8rqdLWDGyuc3epFo2ZqR+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7608 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 4/16/2022 5:34 PM, Fabio Estevam wrote: > Hi Horia and Varun, > > On Sat, Apr 16, 2022 at 10:54 AM Fabio Estevam wrote: >> >> From: Fabio Estevam >> >> Since commit 358ba762d9f1 ("crypto: caam - enable prediction resistance >> in HRWNG") the following CAAM errors can be seen on i.MX6SX: >> >> caam_jr 2101000.jr: 20003c5b: CCB: desc idx 60: RNG: Hardware error >> hwrng: no data available >> caam_jr 2101000.jr: 20003c5b: CCB: desc idx 60: RNG: Hardware error >> ... >> >> This error is due to an incorrect entropy delay for i.MX6SX. >> >> Fix it by increasing the minimum entropy delay for i.MX6SX >> as done in U-Boot: >> https://patchwork.ozlabs.org/project/uboot/patch/20220415111049.2565744-1-gaurav.jain@nxp.com/ >> >> Signed-off-by: Fabio Estevam >> --- >> Change since v1: >> - Align the fix with U-Boot. > > Actually, after thinking more about it, I realize that this issue is > not i.MX6SX specific as > I have seen reports of the same failures on i.MX6D as well. > Someone will need to check whether this solves the issue on i.MX6D, the root cause might be different. Besides this, as Varun said, we should check with the HW team, such that the value used for entropy delay is optimal. IOW we need TRNG characterization for i.MX6D. > Would it make sense to fix it like this instead? > > --- a/drivers/crypto/caam/regs.h > +++ b/drivers/crypto/caam/regs.h > @@ -516,7 +516,7 @@ struct rng4tst { > }; > #define RTSDCTL_ENT_DLY_SHIFT 16 > #define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT) > -#define RTSDCTL_ENT_DLY_MIN 3200 > +#define RTSDCTL_ENT_DLY_MIN 12000 > #define RTSDCTL_ENT_DLY_MAX 12800 > u32 rtsdctl; /* seed control register */ > union { > > Any drawbacks in using this generic approach? > One drawback is performance, not sure if there are others. Horia