Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5616810rwl; Sun, 8 Jan 2023 19:08:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXtRaDolJMcJ1w6fxUdule8hcE4OAp22KhhBf+P8YnOgcneYncrz2QOZmVX/umP9RGX1knYf X-Received: by 2002:aa7:d7c2:0:b0:472:cee9:bbd3 with SMTP id e2-20020aa7d7c2000000b00472cee9bbd3mr56472305eds.27.1673233732654; Sun, 08 Jan 2023 19:08:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673233732; cv=none; d=google.com; s=arc-20160816; b=ThM4uA+NffyCbo1L2tU9v2XYr6pkDpsMHgcerhnPV4+0KYOVxXebfqqik1F2IymbjG DwBHwQySffxl5NhuKtK3otNzJaforTxFpnOxk8HJqC+UrAcqGL7Bc9drE9n8Cf0fJ2qW UhideEznaC0gaI+aRh6xK89SctYFPvX2VjimXbPV2qh9uHiWw5q9UG8SCDfhHUImiuPY yCDMttqN2kzqkOGYy2FU20ZQMldssawTPS7g4ufW2VqAxUSryBFYda/EbR9kHlbw1a4w QEsUUvI7sPf1jiWNg5akD8/M6690PbtK6s3xuat7l7E/MSv1741Kbapd+ME6M0IkUB5t qkvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=hwbMpEQ8RmZYO+YC4Dons8KDSQi9l5HYvKyJbABd1iw=; b=z1Ha37WfuuwnP8Xl1u+7tjGuPVeq5BDBmuvH5+1Baj3CWB3UH0FLhe+ZzY+2czfG6O bv8RzvKsTCgo8uTxj59L7tHu53oFEI1qDM2QxDCKtQdivxsJ8h0y7xaOvUoL1njUIaQH 55s8tYJIUaFF1r45eBsNgwMKvH9tBJy7HTCPzuvxDFvv/RFip+ThYDAsf1ewwwvXHKFr oXVe2Ns8NgPMkhuLRoWvcvDqF8DhtZm2rTxIjMzaM8kS7g2YrC+vPLLskPpe5Zs48rKb XSJ2NtPlCPDWgTub1kC8zc9aVy7gFB2JYqUy+fu0byQPvx4J6mzH8LkWNYMvzm8WJVH0 nQ7A== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm12-20020a0564020c8c00b004823533c5bdsi7441154edb.211.2023.01.08.19.08.22; Sun, 08 Jan 2023 19:08:52 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbjAIC60 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 8 Jan 2023 21:58:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbjAIC6Z (ORCPT ); Sun, 8 Jan 2023 21:58:25 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3C471114F; Sun, 8 Jan 2023 18:58:22 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id AD34324E161; Mon, 9 Jan 2023 10:58:14 +0800 (CST) Received: from EXMBX064.cuchost.com (172.16.6.64) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 9 Jan 2023 10:58:14 +0800 Received: from EXMBX168.cuchost.com (172.16.6.78) by EXMBX064.cuchost.com (172.16.6.64) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 9 Jan 2023 10:58:14 +0800 Received: from EXMBX168.cuchost.com ([fe80::3c2d:dee5:4938:3fc4]) by EXMBX168.cuchost.com ([fe80::3c2d:dee5:4938:3fc4%16]) with mapi id 15.00.1497.044; Mon, 9 Jan 2023 10:58:14 +0800 From: JiaJie Ho To: Herbert Xu CC: Olivia Mackall , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Conor Dooley , "linux-crypto@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-riscv@lists.infradead.org" Subject: RE: [PATCH v2 2/3] hwrng: starfive - Add TRNG driver for StarFive SoC Thread-Topic: [PATCH v2 2/3] hwrng: starfive - Add TRNG driver for StarFive SoC Thread-Index: AQHZGoveBWEVWeSp5UqGtlmGFQKs8K6QmY4AgATZceA= Date: Mon, 9 Jan 2023 02:58:14 +0000 Message-ID: <7c2cc6e9cdf241318fc73162a5ec221d@EXMBX168.cuchost.com> References: <20221228071103.91797-1-jiajie.ho@starfivetech.com> <20221228071103.91797-3-jiajie.ho@starfivetech.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [202.190.108.220] x-yovoleruleagent: yovoleflag Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS 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 > -----Original Message----- > From: Herbert Xu > Sent: 6 January, 2023 4:39 PM > To: JiaJie Ho > Cc: Olivia Mackall ; Rob Herring ; > Krzysztof Kozlowski ; Emil Renner > Berthing ; Conor Dooley ; > linux-crypto@vger.kernel.org; devicetree@vger.kernel.org; linux- > kernel@vger.kernel.org; linux-riscv@lists.infradead.org > Subject: Re: [PATCH v2 2/3] hwrng: starfive - Add TRNG driver for StarFive > SoC > > On Wed, Dec 28, 2022 at 03:11:02PM +0800, Jia Jie Ho wrote: > > +static int starfive_trng_read(struct hwrng *rng, void *buf, size_t > > +max, bool wait) > > You should respect the wait argument and not do polling/sleeping if it is false. > Hi Herbert, My trng device requires sending a generate new number cmd before each read. It then only populates the data registers with new random number and raise an interrupt when ready. If user choose to not wait, they will always get stale bits. Is it okay to always return error if wait=false ? Thanks Jia Jie