Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp790545pxb; Thu, 21 Apr 2022 10:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/Hokwx5nIlNUMUMTFincDQRq72ou/OMM3sLzsmNVXKU0HIbvoTvJC2dBpQokWsvHLxzwY X-Received: by 2002:aa7:cd18:0:b0:41d:8df8:86e5 with SMTP id b24-20020aa7cd18000000b0041d8df886e5mr631521edw.248.1650561612672; Thu, 21 Apr 2022 10:20:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1650561612; cv=pass; d=google.com; s=arc-20160816; b=Lq04i2D6GsWWXa3xzkKn6QM/B3RMyZukNWPebOeQqgkeUkXy880OCyPc0C/8rhz1OC XZHCcQk1OqJwfqJViDpleMLLAuGULXiStbNS7oPdLTYOJmOCGxnaqe/ACSopGK2FFXTC F5wASYdiOr2o4hnxkQSFzltzGVjkQuUyb4Nwi89Nj/08F7UP1GHlCKMaBYK+icaEXU0w hrictnkP3lYQFddRQWpkENYV0KnZb4SrTw3NkLw8d5KfQCKb1/R7Rg+64mUnFoZKgilU 5cisCJqEii5mh4igCylazn3c6dQQFrMVD/DVlmtyXzPGA0krT93PoFhFQQfvCbYGFQCX WESw== 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=Ewh1Xc9chOREcsoEr7sTd2EOWj+NJS65CBzQH2mXp1Q=; b=U2VRKWe6BKCEw4TZt7ZDricFog3P7APPTZzeiECSFVe2lvX4qipzNp2qLAgnVzGy+9 0sz041vmZhSAidMfvl5SyEozpy0MsIImROjG9ni3uqf9RzWxWwAfbEvx6f+dst4hZLl2 NfL4ry1epgU3fUJM6y20dzYZtWWv+3u6cAU4Fr+e2TyAucMmlHtj8RNLSyHE2Z+4fvV/ dx35RTch32kLcqpTH5mqNbG8nL7rgeMrrefHBhXZsQSuIvo8gns6TYSlFPlGjnWZ9bbo h459Dlo6+m9wV2vM48E1SV6yDCAdFaG4nW+94sjcWepCUX4fPC1KnwX/xKIn398N6sZR eLdQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=hjDOphVh; 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 r9-20020a170906704900b006df7eafe421si4511687ejj.127.2022.04.21.10.19.39; Thu, 21 Apr 2022 10:20:12 -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=hjDOphVh; 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 S235564AbiDSKag (ORCPT + 99 others); Tue, 19 Apr 2022 06:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242210AbiDSKaf (ORCPT ); Tue, 19 Apr 2022 06:30:35 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2074.outbound.protection.outlook.com [40.107.20.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D80732A72F for ; Tue, 19 Apr 2022 03:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WEafgNDfvMi9nWVcV7qW2NMVw3K/tbXBGN4m5y+MZnYN6WhxRcCSEUUDIY/vcKuWumcD3lH+PlXtXtqJn41WHogLL96GZQtXjljrcx+xujiOow8pGAVs3ixVIpwOWHKRiXwGn8SdevMgnjTmnq2JaWmGHiwRveDcYUcO5Wak7Ebzr1zxuJq7m68HY5J/g+yLBcps3H5gmB/GduUK2OdEDySlSd0zncq02TnlaLSOeGkFgHHGV17iH0UH9+5CjADV6wnK4/p3N6jkFFObmhP9BPHvZn1hWWfoXitGkZbupv4Gvv2HZFcKb3Fs4uR9ijyKHRciicdN1ImrS+hGBAQ5Tw== 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=Ewh1Xc9chOREcsoEr7sTd2EOWj+NJS65CBzQH2mXp1Q=; b=Uv9Q+EZnifi4TRFTYyR2OHwPbowpPuWGN8yiD0NexXPS+jqD6yLP9VweEgQKhPfKcLnDABuPsG1VWLRpCD4lUm7Ke4FsA42k57mJih3kP2uV1s44TqKcAA4Se+vRiXBwUzcvGTjWbgLOurwIE251zb2uyaYbn1Zmf6i1v3inxUraaEGtXFSl/QOLIs/Uxtav742R8Am15JkMWnD0UdnjV/1PlkpXuk216fdEdWORuMl0Ar9ep1kGMqSm/qbIaLDlfND7DawM5VP5diIMwqepy58rEMSPrNpAKDCqY1+Xf+l/K7yB+8xSItXKRRFDj0lYZohAr9Y+mIl0PtkV+UMYhA== 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=Ewh1Xc9chOREcsoEr7sTd2EOWj+NJS65CBzQH2mXp1Q=; b=hjDOphVh8oyicw5bSidbg0A+NjT7pr0ROLhSKLNq4rJy1P4gzhlDVsNuhVSO9kLzdvEUX8cy6ibYbeV2gGFOEYybkvVHmbd3zj5ji4lnfZv0h8jREx2thvhini9OKIISpMwVM6jrqB27QoLefGaa2P+K3+zvs3Q4E93o75KH6i8= 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 VE1PR04MB6366.eurprd04.prod.outlook.com (2603:10a6:803:12a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Tue, 19 Apr 2022 10:27:49 +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; Tue, 19 Apr 2022 10:27:49 +0000 Message-ID: <231ab1ae-7fb0-79dc-0784-e61e48d0f454@nxp.com> Date: Tue, 19 Apr 2022 13:27:45 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v3] crypto: caam - fix i.MX6SX entropy delay value Content-Language: en-US To: Fabio Estevam , "herbert@gondor.apana.org.au" Cc: Gaurav Jain , Varun Sethi , "linux-crypto@vger.kernel.org" , Fabio Estevam References: <20220418122728.203919-1-festevam@gmail.com> From: =?UTF-8?Q?Horia_Geant=c4=83?= In-Reply-To: <20220418122728.203919-1-festevam@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AM0PR01CA0135.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::40) 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: 0f96e566-59a5-4671-bf95-08da21ef40a4 X-MS-TrafficTypeDiagnostic: VE1PR04MB6366: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: Ez1mvReuLgMAz1SpMpLFwneh41ift4t9E34FyEGH8EhGA6EYAVM1C6O6lrF7qXkkPk7e9C1aUhi+Qi8/dUlaFpPjYQTy36Kv66MvV1dEZFxWRJxW9NDmo8A+5JnpnpTA44EmuHt173MPQZwVeTnJtf9SnBuk16IVryVqwLkP17OeaV7BwxEpVVNtyZuQWuW1Tiueqrfb3fsk7jM0G2V45TW9mg71lH1/HVKz5YM/WUtVvVnCYXdVPklyjFxt2bp8BnN2dNr5SnIjGEZR0szuALwc0CgLe4JnJ4/9kE4/tIr/xXuUR/GBky+UM8uLVlYQl/cISZ4+lw36Oyj44qh/Eu8HcKMrvRQhetskz+z5M0h6vCQPQWkZQpllo7ytS0HCq16wBvvAeA7Va9NZdEwKzhJMwyEe3/6quNeQ1VVEcvcorZT73tuyH2yRTwbfSUt2GF9E7sZWMjFYRR99fdod5xxTD6mi/kTjShwOx3Wt/b4d8vFi/dg+wGdpUbzTaCH0lwavT1F3G0BmJUphON0Va0Zx/EXz2mWHii6EYqTfkr8XHsB9zQKcEAw4B0s8vJ3pOd+2z/lioSzMEiabVm2Sjth+7xqeH6tUB0m4HwBEJ0QkFXyalx6uFS8VZN8PX4Uj+5AqC++YcV6+TIkwJ/3bC0TvgPuOJBtpJeWxWFQ19yBmsiXICY/OijS5bKT20/QH1meA3KeSjuWGLiLUuMUtVfwscogoc0KO7wimUTTxuBh4WrhhS0uRBuzLcjR2FJJnlNMjUdQqx5C2R6PsP+kzXmbFPbbmbc+CS5X+Bks5Xzb4ep6xydr38UGRPXwM+Cx9rL2Xk9awyZrqnGqCVVHKEQ== 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)(52116002)(110136005)(8676002)(55236004)(2906002)(86362001)(38350700002)(26005)(38100700002)(6506007)(6666004)(6512007)(83380400001)(31686004)(316002)(54906003)(4326008)(36756003)(53546011)(66556008)(66946007)(66476007)(2616005)(31696002)(6486002)(966005)(186003)(5660300002)(8936002)(508600001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aHUxU0RGekcvSTZ3eVpXNWdzR0t3YnpDbU5EWVJ4ZktXNFRUK2RyaGdJMHhD?= =?utf-8?B?TFpQODNRTlUrK0NacXJGdEJKREUydUNobmp6RjlkOC8zVElkN1UwcHNuWEor?= =?utf-8?B?MCtoeVhWUFBlUzZ3L3luRmszTTdHTXFvbXllZFhmZU5COFZxYWMxdGNUZldj?= =?utf-8?B?Z2JrWWg0VElJYlhOQXA2OHNpL3REMTU0eUhFeW0yd0pCWVhTY0p6ZVV5T2hT?= =?utf-8?B?VDdLaTVWWWhjUEh2OGpFV3JKWmcxSlJpZTZLNzRLMnVVbWtJSjFZbGdyR3Ny?= =?utf-8?B?ODE0ZGZZQ3hzMlg1WlA2NmQwb2V3TUFFdk1TdU9DTWQ1ak9WVDFUWGhsZHVq?= =?utf-8?B?V3Q1dFBzQWgxdHBFSUlsTU50Z3FrN2FsWTgzWDRab3hMeXJvd3U5NWYvZ2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ErZ0xPNis4OHA1NzJKNTcwUmZtMG9NNllZ?= =?utf-8?B?QkdVQlJFckhWdWR0WTlYaW9pYmVQT1M3MUY4anlSMytDdnpsSlNHRlM4dnVT?= =?utf-8?B?UEZlRlhCd1htcWpuT2Z3YVh4ejJmZzI2aVFVMytOMHAvYzdXaHhuWDFSVy8w?= =?utf-8?Q?u+V2aXWW5U3Xthfs=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f96e566-59a5-4671-bf95-08da21ef40a4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9517.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2022 10:27:49.4611 (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: mH+cFp30gzPEUEP3tiZvBFpzkhdjEbn4uAh5CJ/MqObH82v9W49OE8ZEM4DkRAcdq/qWeR70Nb74Lx9WfFm7lg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6366 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/18/2022 3:27 PM, 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/ > > Fixes: 358ba762d9f1 ("crypto: caam - enable prediction resistance in HRWNG") > Signed-off-by: Fabio Estevam > --- > Changes since v2: > - Added Fixes tag. (Horia) > > Change since v1: > - Align the fix with U-Boot. > > drivers/crypto/caam/ctrl.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c > index ca0361b2dbb0..c515c20442d5 100644 > --- a/drivers/crypto/caam/ctrl.c > +++ b/drivers/crypto/caam/ctrl.c > @@ -648,6 +648,8 @@ static int caam_probe(struct platform_device *pdev) > return ret; > } > > + if (of_machine_is_compatible("fsl,imx6sx")) > + ent_delay = 12000; > This looks rather randomly placed in the probe() function. I'd suggest moving it into the RNG initialization area. Another benefit would be calling of_machine_is_compatible() only once. > /* Get configuration properties from device tree */ > /* First, get register page */ > @@ -871,6 +873,15 @@ static int caam_probe(struct platform_device *pdev) > */ > ret = instantiate_rng(dev, inst_handles, > gen_sk); > + /* > + * Entropy delay is calculated via self-test method. > + * Self-test is run across different voltages and > + * temperatures. A clarification wrt. terminology: -"self-tests" refer to HW checks done when initializing the RNG (instantiating the RNG state handle), they are statistical tests to check the quality of the entropy -"TRNG characterization" is the offline process of determining the entropy delay values that are "suitable" - i.e. allowing TRNG to work correctly across ranges of temperature, voltage and clock frequency > + * If worst case value for ent_dly is identified, > + * the loop can be skipped for that platform. > + */ > + if (of_machine_is_compatible("fsl,imx6sx")) > + break; > if (ret == -EAGAIN) > /* > * if here, the loop will rerun, Thanks, Horia