From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Vinod Koul <vinod.koul@linaro.org>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-msm@vger.kernel.org, Vinod Koul <vkoul@kernel.org>
Subject: Re: [PATCH 3/3] hwrng: msm - Add support for prng v2
Date: Mon, 18 Jun 2018 11:21:23 -0700 [thread overview]
Message-ID: <20180618182123.GT14924@minitux> (raw)
In-Reply-To: <20180618141259.23141-4-vkoul@kernel.org>
On Mon 18 Jun 07:12 PDT 2018, Vinod Koul wrote:
> Qcom 8996 and later chips support prng v2 where we need to only
> implement .read callback for hwrng.
>
The hardware still needs initialization, so I think you should expand
this to mention that the initialization is moved to secure world and
that's the reason why we only implement read.
The question is what happens in projects with other security models.
> Add a new table for v2 which supports this and get version required for
> driver data.
>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> ---
> drivers/char/hw_random/msm-rng.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/msm-rng.c b/drivers/char/hw_random/msm-rng.c
> index 7644474035e5..3f509072a6c6 100644
> --- a/drivers/char/hw_random/msm-rng.c
> +++ b/drivers/char/hw_random/msm-rng.c
> @@ -17,6 +17,7 @@
> #include <linux/io.h>
> #include <linux/module.h>
> #include <linux/of.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
>
> /* Device specific register offsets */
> @@ -132,10 +133,16 @@ static struct hwrng msm_rng = {
> .read = msm_rng_read,
> };
>
> +static struct hwrng msm_rng_v2 = {
> + .name = KBUILD_MODNAME,
> + .read = msm_rng_read,
> +};
> +
> static int msm_rng_probe(struct platform_device *pdev)
> {
> struct resource *res;
> struct msm_rng *rng;
> + unsigned int version;
> int ret;
>
> rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL);
> @@ -154,6 +161,9 @@ static int msm_rng_probe(struct platform_device *pdev)
> return PTR_ERR(rng->clk);
>
> rng->hwrng = &msm_rng;
> + version = (unsigned long)of_device_get_match_data(&pdev->dev);
If this is "version" then please make it 1 or 2, if you agree with
Stephen's suggestion of omitting the initialization of init I think this
would be better as 0/1 and the variable named "skip_init".
> + if (version)
> + rng->hwrng = &msm_rng_v2;
>
> rng->hwrng->priv = (unsigned long)rng;
> ret = devm_hwrng_register(&pdev->dev, rng->hwrng);
> @@ -166,7 +176,8 @@ static int msm_rng_probe(struct platform_device *pdev)
> }
>
> static const struct of_device_id msm_rng_of_match[] = {
> - { .compatible = "qcom,prng", },
> + { .compatible = "qcom,prng", .data = (void *)0},
> + { .compatible = "qcom,prng-v2", .data = (void *)1},
> {}
> };
> MODULE_DEVICE_TABLE(of, msm_rng_of_match);
Regards,
Bjorn
next prev parent reply other threads:[~2018-06-18 18:21 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 14:12 [PATCH 0/3]: hwrng: Add support for qcpm v2 hwrng Vinod Koul
2018-06-18 14:12 ` [PATCH 1/3] hwrng: msm - Move hwrng to a table Vinod Koul
2018-06-18 15:58 ` Stephen Boyd
2018-06-18 16:54 ` Vinod
2018-06-18 14:12 ` [PATCH 2/3] dt-bindings: rng: Add new compatible qcom,prng-v2 Vinod Koul
2018-06-18 14:12 ` [PATCH 3/3] hwrng: msm - Add support for prng v2 Vinod Koul
2018-06-18 18:21 ` Bjorn Andersson [this message]
2018-06-18 20:24 ` Stephen Boyd
2018-06-19 4:06 ` Vinod
2018-06-19 4:04 ` Vinod
2018-06-19 14:28 ` Herbert Xu
2018-06-20 5:32 ` Vinod
2018-06-20 14:37 ` Herbert Xu
2018-06-20 17:45 ` PrasannaKumar Muralidharan
2018-06-21 4:17 ` Vinod
2018-06-21 9:56 ` Stanimir Varbanov
2018-06-21 10:15 ` Herbert Xu
2018-06-21 11:27 ` Stanimir Varbanov
2018-06-21 11:53 ` Herbert Xu
2018-06-22 8:27 ` Stanimir Varbanov
2018-06-22 14:38 ` Herbert Xu
2018-06-22 14:48 ` Vinod
2018-06-22 14:50 ` Herbert Xu
[not found] ` <70ED61EB-BD3E-48D1-8B4D-D7835494C035@chronox.de>
2018-06-27 5:08 ` Vinod
2018-06-27 6:13 ` Stephan Mueller
2018-06-27 6:27 ` Vinod
2018-06-27 6:43 ` Stephan Mueller
2018-06-27 7:01 ` Vinod
2018-06-27 7:51 ` Stephan Mueller
2018-06-22 15:33 ` Stanimir Varbanov
2018-06-28 22:04 ` Timur Tabi
2018-06-29 8:37 ` Vinod
2018-07-01 6:27 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180618182123.GT14924@minitux \
--to=bjorn.andersson@linaro.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=vinod.koul@linaro.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox