Skip to contentSkip to conversation

FAILED: patch "[PATCH] powerpc/powernv: wire up rng during setup_arch" failed to apply to 4.9-stable tree

PATCH New [email protected] 2 participants 3 messages Jun 27, 2022 – Jul 4, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.9-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 f3eac426657d985b97c92fa5f7ae1d43f04721f3 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <[email protected]>
Date: Tue, 21 Jun 2022 16:08:49 +0200
Subject: [PATCH] powerpc/powernv: 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.

Complicating things, however, is that POWER8 systems need some per-cpu state and kmalloc, which isn't available at this stage. So we split things up into an early phase and a later opportunistic phase. This commit also removes some noisy log messages that don't add much.

Fixes a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
Cc [email protected] # v3.13+
[mpe: Add of_node_put(), use pnv naming, minor change log editing]
arch/powerpc/platforms/powernv/powernv.h +2 -0
index e297bf4abfcb..866efdc103fd 100644
@@ -42,4 +42,6 @@ ssize_t memcons_copy(struct memcons *mc, char *to, loff_t pos, size_t count);
 u32 __init memcons_get_size(struct memcons *mc);
 struct memcons *__init memcons_init(struct device_node *node, const char *mc_prop_name);
 
+void pnv_rng_init(void);
+
 #endif /* _POWERNV_H */
arch/powerpc/platforms/powernv/rng.c +36 -16

90 lines not on this page · raw message

arch/powerpc/platforms/powernv/setup.c +2 -0
index 824c3ad7a0fa..dac545aa0308 100644
@@ -203,6 +203,8 @@ static void __init pnv_setup_arch(void)
 	pnv_check_guarded_cores();
 
 	/* XXX PMCS */
+
+	pnv_rng_init();
 }
 
 static void __init pnv_init(void)
#1 lore raw

I started to backport this but noticed 4.9 doesn't have the darn wrapper either. Christophe/Michael - if you want to backport this, go for it. But I'll leave it be.

Jason

#2 lore raw

PATCH 1/1 powerpc/powernv: wire up rng during setup_arch

In reply to [email protected]

commit f3eac426657d985b97c92fa5f7ae1d43f04721f3 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.

Complicating things, however, is that POWER8 systems need some per-cpu state and kmalloc, which isn't available at this stage. So we split things up into an early phase and a later opportunistic phase. This commit also removes some noisy log messages that don't add much.

Fixes a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
Cc [email protected] # v3.13+
[mpe: Add of_node_put(), use pnv naming, minor change log editing]
---
 arch/powerpc/include/asm/ppc-opcode.h    |  4 ++
 arch/powerpc/platforms/powernv/powernv.h |  2 +
 arch/powerpc/platforms/powernv/rng.c     | 91 ++++++++++++++++++++----
 arch/powerpc/platforms/powernv/setup.c   |  2 +
 4 files changed, 85 insertions(+), 14 deletions(-)
arch/powerpc/include/asm/ppc-opcode.h +4 -0
index b7067590f15c..8cb3c929641a 100644
@@ -134,6 +134,7 @@
 #define PPC_INST_COPY			0x7c00060c
 #define PPC_INST_COPY_FIRST		0x7c20060c
 #define PPC_INST_CP_ABORT		0x7c00068c
+#define PPC_INST_DARN			0x7c0005e6
 #define PPC_INST_DCBA			0x7c0005ec
 #define PPC_INST_DCBA_MASK		0xfc0007fe
 #define PPC_INST_DCBAL			0x7c2005ec
@@ -328,6 +329,9 @@
 
 /* Deal with instructions that older assemblers aren't aware of */
 #define	PPC_CP_ABORT		stringify_in_c(.long PPC_INST_CP_ABORT)
+#define PPC_DARN(t, l)		stringify_in_c(.long PPC_INST_DARN |  \
+						___PPC_RT(t)	   |  \
+						(((l) & 0x3) << 16))
 #define	PPC_DCBAL(a, b)		stringify_in_c(.long PPC_INST_DCBAL | \
 					__PPC_RA(a) | __PPC_RB(b))
 #define	PPC_DCBZL(a, b)		stringify_in_c(.long PPC_INST_DCBZL | \
arch/powerpc/platforms/powernv/powernv.h +2 -0
index da7c843ac7f1..e98e14a5db4d 100644
@@ -27,4 +27,6 @@ extern void opal_event_shutdown(void);
 
 bool cpu_core_split_required(void);
 
+void pnv_rng_init(void);
+
 #endif /* _POWERNV_H */
arch/powerpc/platforms/powernv/rng.c +77 -14

145 lines not on this page · raw message

arch/powerpc/platforms/powernv/setup.c +2 -0
index b77d5eed9520..e97b714d30d7 100644
@@ -168,6 +168,8 @@ static void __init pnv_setup_arch(void)
 	powersave_nap = 1;
 
 	/* XXX PMCS */
+
+	pnv_rng_init();
 }
 
 static void __init pnv_init(void)
Signature · 1 line
2.35.1