File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -876,6 +876,15 @@ struct OpalIoPhb4ErrorData {
876
876
enum {
877
877
OPAL_REINIT_CPUS_HILE_BE = (1 << 0 ),
878
878
OPAL_REINIT_CPUS_HILE_LE = (1 << 1 ),
879
+
880
+ /* These two define the base MMU mode of the host on P9
881
+ *
882
+ * On P9 Nimbus DD2.0 and Cumlus (and later), KVM can still
883
+ * create hash guests in "radix" mode with care (full core
884
+ * switch only).
885
+ */
886
+ OPAL_REINIT_CPUS_MMU_HASH = (1 << 2 ),
887
+ OPAL_REINIT_CPUS_MMU_RADIX = (1 << 3 ),
879
888
};
880
889
881
890
typedef struct oppanel_line {
Original file line number Diff line number Diff line change @@ -59,18 +59,33 @@ static struct task_struct *kopald_tsk;
59
59
60
60
void opal_configure_cores (void )
61
61
{
62
+ u64 reinit_flags = 0 ;
63
+
62
64
/* Do the actual re-init, This will clobber all FPRs, VRs, etc...
63
65
*
64
66
* It will preserve non volatile GPRs and HSPRG0/1. It will
65
67
* also restore HIDs and other SPRs to their original value
66
68
* but it might clobber a bunch.
67
69
*/
68
70
#ifdef __BIG_ENDIAN__
69
- opal_reinit_cpus ( OPAL_REINIT_CPUS_HILE_BE ) ;
71
+ reinit_flags |= OPAL_REINIT_CPUS_HILE_BE ;
70
72
#else
71
- opal_reinit_cpus ( OPAL_REINIT_CPUS_HILE_LE ) ;
73
+ reinit_flags |= OPAL_REINIT_CPUS_HILE_LE ;
72
74
#endif
73
75
76
+ /*
77
+ * POWER9 always support running hash:
78
+ * ie. Host hash supports hash guests
79
+ * Host radix supports hash/radix guests
80
+ */
81
+ if (cpu_has_feature (CPU_FTR_ARCH_300 )) {
82
+ reinit_flags |= OPAL_REINIT_CPUS_MMU_HASH ;
83
+ if (early_radix_enabled ())
84
+ reinit_flags |= OPAL_REINIT_CPUS_MMU_RADIX ;
85
+ }
86
+
87
+ opal_reinit_cpus (reinit_flags );
88
+
74
89
/* Restore some bits */
75
90
if (cur_cpu_spec -> cpu_restore )
76
91
cur_cpu_spec -> cpu_restore ();
Original file line number Diff line number Diff line change @@ -225,6 +225,8 @@ static void pnv_kexec_wait_secondaries_down(void)
225
225
226
226
static void pnv_kexec_cpu_down (int crash_shutdown , int secondary )
227
227
{
228
+ u64 reinit_flags ;
229
+
228
230
if (xive_enabled ())
229
231
xive_kexec_teardown_cpu (secondary );
230
232
else
@@ -254,8 +256,15 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
254
256
* We might be running as little-endian - now that interrupts
255
257
* are disabled, reset the HILE bit to big-endian so we don't
256
258
* take interrupts in the wrong endian later
259
+ *
260
+ * We reinit to enable both radix and hash on P9 to ensure
261
+ * the mode used by the next kernel is always supported.
257
262
*/
258
- opal_reinit_cpus (OPAL_REINIT_CPUS_HILE_BE );
263
+ reinit_flags = OPAL_REINIT_CPUS_HILE_BE ;
264
+ if (cpu_has_feature (CPU_FTR_ARCH_300 ))
265
+ reinit_flags |= OPAL_REINIT_CPUS_MMU_RADIX |
266
+ OPAL_REINIT_CPUS_MMU_HASH ;
267
+ opal_reinit_cpus (reinit_flags );
259
268
}
260
269
}
261
270
#endif /* CONFIG_KEXEC_CORE */
You can’t perform that action at this time.
0 commit comments