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 <herb...@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt