]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 11:02:59 +0000 (13:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 11:02:59 +0000 (13:02 +0200)
added patches:
powerpc-pseries-wire-up-rng-during-setup_arch.patch

queue-5.15/powerpc-pseries-wire-up-rng-during-setup_arch.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/powerpc-pseries-wire-up-rng-during-setup_arch.patch b/queue-5.15/powerpc-pseries-wire-up-rng-during-setup_arch.patch
new file mode 100644 (file)
index 0000000..8e74ca4
--- /dev/null
@@ -0,0 +1,82 @@
+From e561e472a3d441753bd012333b057f48fef1045b Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Sat, 11 Jun 2022 17:10:15 +0200
+Subject: powerpc/pseries: wire up rng during setup_arch()
+
+From: Jason A. Donenfeld <Jason@zx2c4.com>
+
+commit e561e472a3d441753bd012333b057f48fef1045b upstream.
+
+The platform's RNG must be available before random_init() in order to be
+useful for initial seeding, which in turn means that it needs to be
+called from setup_arch(), rather than from an init call. Fortunately,
+each platform already has a setup_arch function pointer, which means
+it's easy to wire this up. This commit also removes some noisy log
+messages that don't add much.
+
+Fixes: a489043f4626 ("powerpc/pseries: Implement arch_get_random_long() based on H_RANDOM")
+Cc: stable@vger.kernel.org # v3.13+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20220611151015.548325-4-Jason@zx2c4.com
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/powerpc/platforms/pseries/pseries.h |    2 ++
+ arch/powerpc/platforms/pseries/rng.c     |   11 +++--------
+ arch/powerpc/platforms/pseries/setup.c   |    2 ++
+ 3 files changed, 7 insertions(+), 8 deletions(-)
+
+--- a/arch/powerpc/platforms/pseries/pseries.h
++++ b/arch/powerpc/platforms/pseries/pseries.h
+@@ -115,4 +115,6 @@ extern u32 pseries_security_flavor;
+ void pseries_setup_security_mitigations(void);
+ void pseries_lpar_read_hblkrm_characteristics(void);
++void pseries_rng_init(void);
++
+ #endif /* _PSERIES_PSERIES_H */
+--- a/arch/powerpc/platforms/pseries/rng.c
++++ b/arch/powerpc/platforms/pseries/rng.c
+@@ -10,6 +10,7 @@
+ #include <asm/archrandom.h>
+ #include <asm/machdep.h>
+ #include <asm/plpar_wrappers.h>
++#include "pseries.h"
+ static int pseries_get_random_long(unsigned long *v)
+@@ -24,19 +25,13 @@ static int pseries_get_random_long(unsig
+       return 0;
+ }
+-static __init int rng_init(void)
++void __init pseries_rng_init(void)
+ {
+       struct device_node *dn;
+       dn = of_find_compatible_node(NULL, NULL, "ibm,random");
+       if (!dn)
+-              return -ENODEV;
+-
+-      pr_info("Registering arch random hook.\n");
+-
++              return;
+       ppc_md.get_random_seed = pseries_get_random_long;
+-
+       of_node_put(dn);
+-      return 0;
+ }
+-machine_subsys_initcall(pseries, rng_init);
+--- a/arch/powerpc/platforms/pseries/setup.c
++++ b/arch/powerpc/platforms/pseries/setup.c
+@@ -840,6 +840,8 @@ static void __init pSeries_setup_arch(vo
+       if (swiotlb_force == SWIOTLB_FORCE)
+               ppc_swiotlb_enable = 1;
++
++      pseries_rng_init();
+ }
+ static void pseries_panic(char *str)
index 35506fad99fbdbb46b7cb26c6cc3996c67ccc4d1..91844f9da3526bc7d40460cb8a1f6f91f09bdfc3 100644 (file)
@@ -132,3 +132,4 @@ random-update-comment-from-copy_to_user-copy_to_iter.patch
 perf-build-id-fix-caching-files-with-a-wrong-build-id.patch
 dma-direct-use-the-correct-size-for-dma_set_encrypted.patch
 kbuild-link-vmlinux-only-once-for-config_trim_unused_ksyms-2nd-attempt.patch
+powerpc-pseries-wire-up-rng-during-setup_arch.patch