From: Herbert Xu <herbert@gondor.apana.org.au>
To: Qunqin Zhao <zhaoqunqin@loongson.cn>
Cc: lee@kernel.org, davem@davemloft.net, peterhuewe@gmx.de,
jarkko@kernel.org, linux-kernel@vger.kernel.org,
loongarch@lists.linux.dev, linux-crypto@vger.kernel.org,
jgg@ziepe.ca, linux-integrity@vger.kernel.org,
pmenzel@molgen.mpg.de, Yinggang Gu <guyinggang@loongson.cn>,
Huacai Chen <chenhuacai@loongson.cn>
Subject: Re: [PATCH v9 2/5] crypto: loongson - add Loongson RNG driver support
Date: Mon, 19 May 2025 13:57:03 +0800 [thread overview]
Message-ID: <aCrIL_ZXL-UtaLdJ@gondor.apana.org.au> (raw)
In-Reply-To: <20250506031947.11130-3-zhaoqunqin@loongson.cn>
On Tue, May 06, 2025 at 11:19:44AM +0800, Qunqin Zhao wrote:
>
> +static int loongson_rng_init(struct crypto_tfm *tfm)
> +{
> + struct loongson_rng_ctx *ctx = crypto_tfm_ctx(tfm);
> + struct loongson_rng *rng;
> + int ret = -EBUSY;
> +
> + mutex_lock(&rng_devices.lock);
> + list_for_each_entry(rng, &rng_devices.list, list) {
> + if (!rng->is_used) {
> + rng->is_used = true;
> + ctx->rng = rng;
> + ret = 0;
> + break;
> + }
> + }
> + mutex_unlock(&rng_devices.lock);
> +
> + return ret;
> +}
This isn't right. The number of TFMs in the system is unlimited.
You should not pair each tfm with an individual hardwre device.
If you want to do load-balancing you could certainly pick a device
per tfm, but each device must be able to support an unlimited number
of tfms.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2025-05-19 5:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 3:19 [PATCH v9 0/5] Add Loongson Security Engine chip driver Qunqin Zhao
2025-05-06 3:19 ` [PATCH v9 1/5] mfd: Add support for Loongson Security Engine chip controller Qunqin Zhao
2025-05-22 13:46 ` Lee Jones
2025-05-26 2:26 ` Qunqin Zhao
2025-05-06 3:19 ` [PATCH v9 2/5] crypto: loongson - add Loongson RNG driver support Qunqin Zhao
2025-05-19 5:57 ` Herbert Xu [this message]
2025-05-19 8:13 ` Qunqin Zhao
2025-05-19 8:22 ` Herbert Xu
2025-05-19 8:49 ` Qunqin Zhao
2025-05-19 8:52 ` Herbert Xu
2025-05-19 12:54 ` liulongfang
2025-05-06 3:19 ` [PATCH v9 3/5] MAINTAINERS: Add entry for Loongson crypto driver Qunqin Zhao
2025-05-06 3:19 ` [PATCH v9 4/5] tpm: Add a driver for Loongson TPM device Qunqin Zhao
2025-05-06 14:13 ` Stefano Garzarella
2025-05-07 1:33 ` Qunqin Zhao
2025-05-07 9:32 ` Stefano Garzarella
2025-05-08 19:57 ` Jarkko Sakkinen
2025-05-08 19:56 ` Jarkko Sakkinen
2025-05-13 7:20 ` Qunqin Zhao
2025-05-11 9:34 ` [PATCH v9 0/5] Add Loongson Security Engine chip driver Huacai Chen
2025-05-13 7:12 ` Qunqin Zhao
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=aCrIL_ZXL-UtaLdJ@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=chenhuacai@loongson.cn \
--cc=davem@davemloft.net \
--cc=guyinggang@loongson.cn \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=lee@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=peterhuewe@gmx.de \
--cc=pmenzel@molgen.mpg.de \
--cc=zhaoqunqin@loongson.cn \
/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
all inboxes | Powered by JetHome®