[2/2] cpu: Unconditionally re-initialise SPRs in opal_reinit_cpus()

Message ID 20171024114100.13714-3-npiggin@gmail.com
State New
Headers show
Series
  • improve ability to pass SPR defaults to Linux
Related show

Commit Message

Nicholas Piggin Oct. 24, 2017, 11:41 a.m.
opal_reinit_cpus should re-initialise SPRs to their boot state,
because it should things according to the boot state.

This solves the problem that the hypervisor may change SPRs before
kexecing to a new kernel.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 core/cpu.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch

diff --git a/core/cpu.c b/core/cpu.c
index 27e0d6cf..02f6a613 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -1246,6 +1246,13 @@  void cpu_set_radix_mode(void)
 
 static void cpu_cleanup_one(void *param __unused)
 {
+	struct cpu_thread *cpu = this_cpu();
+
+	/* Bring SPRs back to boot state */
+	if (cpu_is_thread0(cpu))
+		init_shared_sprs();
+	init_replicated_sprs();
+
 	mtspr(SPR_AMR, 0);
 	mtspr(SPR_IAMR, 0);
 }