[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCrIL_ZXL-UtaLdJ@gondor.apana.org.au>
Date: Mon, 19 May 2025 13:57:03 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Qunqin Zhao <zhaoqunqin@...ngson.cn>
Cc: lee@...nel.org, davem@...emloft.net, peterhuewe@....de,
jarkko@...nel.org, linux-kernel@...r.kernel.org,
loongarch@...ts.linux.dev, linux-crypto@...r.kernel.org,
jgg@...pe.ca, linux-integrity@...r.kernel.org,
pmenzel@...gen.mpg.de, Yinggang Gu <guyinggang@...ngson.cn>,
Huacai Chen <chenhuacai@...ngson.cn>
Subject: Re: [PATCH v9 2/5] crypto: loongson - add Loongson RNG driver support
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@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists