From 5403315509ed058d47630854e83fa3bcdfd5c132 Mon Sep 17 00:00:00 2001 From: "song.han" Date: Wed, 23 Feb 2022 14:20:28 +0800 Subject: [PATCH] boottime: reduce boot time [1/1] PD#SWPL-71744 Problem: 1.Jitter rng is doing 1024 rounds of tests and causing long initialization time. Solution: 1.change jent_mod_int to delaywork to reduce boot time. Verify: c2_af400 Signed-off-by: song.han Change-Id: I90e67854b213dd673077c72bb4830264d17f1f88 --- crypto/jitterentropy-kcapi.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c index e8a4165a1874..1dcd05ea62cc 100644 --- a/crypto/jitterentropy-kcapi.c +++ b/crypto/jitterentropy-kcapi.c @@ -197,6 +197,7 @@ static struct rng_alg jent_alg = { } }; +#if !IS_ENABLED(CONFIG_AMLOGIC_BOOT_TIME) static int __init jent_mod_init(void) { int ret = 0; @@ -208,6 +209,32 @@ static int __init jent_mod_init(void) } return crypto_register_rng(&jent_alg); } +#else +static struct delayed_work jent_work; +static void __jent_mod_init(struct work_struct *work) +{ + int ret = 0; + + ret = jent_entropy_init(); + if (ret) { + pr_info("jitterentropy: Initialization failed with : %d\n", ret); + return; + } + ret = crypto_register_rng(&jent_alg); + if (ret) { + pr_err("registering jent_alg failed: %d\n", ret); + return; + } +} + +static int __init jent_mod_init(void) +{ + INIT_DELAYED_WORK(&jent_work, __jent_mod_init); + schedule_delayed_work(&jent_work, msecs_to_jiffies(1000)); + + return 0; +} +#endif static void __exit jent_mod_exit(void) {