]> git.itanic.dy.fi Git - linux-stable/commit
hw_random: use add_hwgenerator_randomness() for early entropy
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 6 Nov 2022 15:02:43 +0000 (16:02 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 18 Nov 2022 01:18:10 +0000 (02:18 +0100)
commitdb516da95ce458f0cab5e7ae2db93fd821484d7d
tree7025999d032360dfcd0f5dc4c772f5206dff0fd0
parent19258d05b619d26622bdcfa11eca1f457b69e4da
hw_random: use add_hwgenerator_randomness() for early entropy

Rather than calling add_device_randomness(), the add_early_randomness()
function should use add_hwgenerator_randomness(), so that the early
entropy can be potentially credited, which allows for the RNG to
initialize earlier without having to wait for the kthread to come up.

This requires some minor API refactoring, by adding a `sleep_after`
parameter to add_hwgenerator_randomness(), so that we don't hit a
blocking sleep from add_early_randomness().

Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/hw_random/core.c
drivers/char/random.c
include/linux/random.h