Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp209879rwb; Thu, 12 Jan 2023 18:33:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXsaVANz/q60cgFVvsdMx54B0Ty8POftmV1OcLnpPLJlsvlV23YQiczcJ1rLxc60lRQM6Q3u X-Received: by 2002:a17:906:39d8:b0:847:410:ecff with SMTP id i24-20020a17090639d800b008470410ecffmr60800142eje.16.1673577227186; Thu, 12 Jan 2023 18:33:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673577227; cv=none; d=google.com; s=arc-20160816; b=ho7OKfVr6+a+ZXwacCT0JHdiRsgcsiMu+IbI1ibhkFq+dJAgPd9GUZ7TaP8h8JcP1n XxeLOGOY0p32WeRkXozObkvp5ez6tAzoqfoitw9h5h8/Mw3Xc+7bNViPhUO72G7Gbprl X/zWFp2m3bgJKI00GmBrFGWN3Vr5hXVG/OrvEAnieMkUlsXH/MxufJkpEvjLtZBUy8UJ kkAC5E/wXiq9ZcSR+Rw5MJGzRJHQegZmVKHTki5kU5lggfJ4hsryDnvbJtJj9NXfcOgs NWCQkrdjEiFrJIrbXO+2Xe1opxSP9sCI45UYp3ij79hfMWuHke1QqgWqV9PkJjQYzsQ0 Cc/A== 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=4uFMBAn1nuIirY8SC8y9ErmseuPZjWLXsD+7LlyeNk8=; b=VQIG2baR4rZ034beGufm2EhWzHtqYO08onAp0meVfdwSlqzlHMg7r434VTiN3U9scf v6aeLEYZXTm17kUBY7yQJw+iuyCn46PwwQFr0mkpneNFrBm65h5ZrXIA4ddb6tlXjLxi 6R5RiwV0ikQCUgT+9/0XtC9Kqu+nXIhE9Ax4hWIaZYz9grRaTLYNjZU5+DRj0v4huMnw FqmTzlwllldBZAKp2utnJ1VfGcNMj7KDqQpC6QMfvMS5mASJVC6CG51yQ4q7aV4wNPpB 0amNt5+3tmwoykr0FrK9ZPStC3F3xASu3uh1GvrmaM8fm5whjh55UhzqTG2yANO4cTcU clhQ== 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 hp39-20020a1709073e2700b0083b22b31cc2si16345292ejc.370.2023.01.12.18.32.52; Thu, 12 Jan 2023 18:33:47 -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 S232888AbjAMCbC convert rfc822-to-8bit (ORCPT + 99 others); Thu, 12 Jan 2023 21:31:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232586AbjAMCbA (ORCPT ); Thu, 12 Jan 2023 21:31:00 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB9355133A; Thu, 12 Jan 2023 18:30:58 -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 3DEEB24E115; Fri, 13 Jan 2023 10:30:56 +0800 (CST) Received: from EXMBX168.cuchost.com (172.16.6.78) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 13 Jan 2023 10:30:56 +0800 Received: from EXMBX168.cuchost.com (172.16.6.78) by EXMBX168.cuchost.com (172.16.6.78) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 13 Jan 2023 10:30:55 +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; Fri, 13 Jan 2023 10:30:55 +0800 From: JiaJie Ho To: Conor Dooley CC: Olivia Mackall , Herbert Xu , 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 v4 2/3] hwrng: starfive - Add TRNG driver for StarFive SoC Thread-Topic: [PATCH v4 2/3] hwrng: starfive - Add TRNG driver for StarFive SoC Thread-Index: AQHZJj/IHp8vIBNNJEO5ZoaN+GosV66aoj2AgADzXNA= Date: Fri, 13 Jan 2023 02:30:55 +0000 Message-ID: <82979ef41b4a4c9f8a77c950e3c65c86@EXMBX168.cuchost.com> References: <20230112043812.150393-1-jiajie.ho@starfivetech.com> <20230112043812.150393-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 > > +STARFIVE TRNG DRIVER > > +M: Jia Jie Ho > > +S: Maintained > > +F: Documentation/devicetree/bindings/rng/starfive* > > +F: drivers/char/hw_random/starfive-trng.c > > minor nit (so don't submit another version just to fix this): > This should be Supported, no? > Hi Conor, I'll update this in next version together with other comments below. > > diff --git a/drivers/char/hw_random/Makefile > > b/drivers/char/hw_random/Makefile index 3e948cf04476..f68ac370847f > > 100644 > > --- a/drivers/char/hw_random/Makefile > > +++ b/drivers/char/hw_random/Makefile > > @@ -47,3 +47,4 @@ obj-$(CONFIG_HW_RANDOM_XIPHERA) += xiphera- > trng.o > > obj-$(CONFIG_HW_RANDOM_ARM_SMCCC_TRNG) += arm_smccc_trng.o > > obj-$(CONFIG_HW_RANDOM_CN10K) += cn10k-rng.o > > obj-$(CONFIG_HW_RANDOM_POLARFIRE_SOC) += mpfs-rng.o > > +obj-$(CONFIG_HW_RANDOM_STARFIVE) += starfive-trng.o > > Is "STARFIVE" a bit too general of a name here and in the Kconfig entry? > I don't have a TRM for the JH7100, but this name (and the Kconfig text) > would give me the impression that I can use it there too. > Does this driver support both? > 7100 uses a different trng module but this same generator might be used in future products, so I left it generic. Would it be better to specify the product? > > +static int starfive_trng_probe(struct platform_device *pdev) [...] > > + ret = devm_hwrng_register(&pdev->dev, &trng->rng); > > + if (ret) { > > + dev_err_probe(&pdev->dev, ret, "Failed to register > hwrng\n"); > > + goto err_fail_register; > > + } > > + > > + pm_runtime_use_autosuspend(&pdev->dev); > > + pm_runtime_set_autosuspend_delay(&pdev->dev, 100); > > > + pm_runtime_enable(&pdev->dev); > > > + > > + return 0; > > + > > +err_fail_register: > > > + pm_runtime_disable(&pdev->dev); > > This was only enabled after the only goto for this label, does it serve a > purpose? > I know little about runtime PM, it just caught my eye. > I looked at the other rng drivers that had calls to pm_runtime_enable(), but > they all seem to do their pm enablement _before_ calling hwrng_register(). > Again, I am not familiar with runtime PM, but curious why you are doing > things differently, that's all. It does make more sense to move pm_runtime_enable before registering the generator to align with codes in the goto label. I'll fix this part. Thanks again for reviewing the patches. Best regards, Jia Jie