FAILED: patch "[PATCH] powerpc/pseries: wire up rng during setup_arch()" failed to apply to 5.18-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e561e472a3d441753bd012333b057f48fef1045b Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <[email protected]>
Date: Sat, 11 Jun 2022 17:10:15 +0200
Subject: [PATCH] powerpc/pseries: wire up rng during setup_arch()
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.
arch/powerpc/platforms/pseries/pseries.h +2 -0
@@ -122,4 +122,6 @@ void pseries_lpar_read_hblkrm_characteristics(void);static inline void pseries_lpar_read_hblkrm_characteristics (void ) { }#endif +void pseries_rng_init (void ); +#endif /* _PSERIES_PSERIES_H */
arch/powerpc/platforms/pseries/rng.c +3 -8
@@ -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(unsigned long *v)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);
arch/powerpc/platforms/pseries/setup.c +1 -0
@@ -839,6 +839,7 @@ static void __init pSeries_setup_arch(void) } ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; +pseries_rng_init (); }static void pseries_panic (char *str)
PATCH 1/1 powerpc/pseries: wire up rng during setup_arch()
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.
--- 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(-)
arch/powerpc/platforms/pseries/pseries.h +2 -0
@@ -121,4 +121,6 @@ void pseries_lpar_read_hblkrm_characteristics(void);static inline void pseries_lpar_read_hblkrm_characteristics (void ) { }#endif +void pseries_rng_init (void ); +#endif /* _PSERIES_PSERIES_H */
arch/powerpc/platforms/pseries/rng.c +3 -8
@@ -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(unsigned long *v)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);
arch/powerpc/platforms/pseries/setup.c +2 -0
@@ -852,6 +852,8 @@ static void __init pSeries_setup_arch(void)if (swiotlb_force ==SWIOTLB_FORCE ) ppc_swiotlb_enable =1 ; + +pseries_rng_init (); }static void pseries_panic (char *str)
Signature · 1 line
2.35.1
Greg KH
maintainerRe: [PATCH stable 5.18 5.15 5.10 5.4] powerpc/pseries: wire up rng during setup_arch()
Quoted 16 lines · Jason A. Donenfeld
commit
e561e472a3d441753bd012333b057f48fef1045bupstream.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 fromsetup_arch(), rather than from an init call. Fortunately, each platform already has asetup_archfunction 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 [email protected] # v3.13+Signed-off-by Jason A. Donenfeld <[email protected]>Reviewed-by Christophe Leroy <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>
Quoted 4 lines
--- arch/powerpc/platforms/pseries/pseries.h | 2 ++ arch/powerpc/platforms/pseries/rng.c | 11 +++-------- arch/powerpc/platforms/pseries/setup.c | 2 ++
All now queued up, thanks.
greg k-h