diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2017-06-30 18:37:32 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-07-10 07:12:27 -0400 |
commit | 1c0eaf0f56d6128af7f0f252855173fcee85d202 (patch) | |
tree | b732d645cd49c2cf38fce17f175f7ddd1257aed3 | |
parent | 1e2a516e89fc412a754327522ab271b42f99c6b4 (diff) |
powerpc/powernv: Tell OPAL about our MMU mode on POWER9
That will allow OPAL to configure the CPU in an optimal way.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/include/asm/opal-api.h | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal.c | 19 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/setup.c | 11 |
3 files changed, 36 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index ef930ba500f9..3130a73652c7 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h | |||
@@ -876,6 +876,15 @@ struct OpalIoPhb4ErrorData { | |||
876 | enum { | 876 | enum { |
877 | OPAL_REINIT_CPUS_HILE_BE = (1 << 0), | 877 | OPAL_REINIT_CPUS_HILE_BE = (1 << 0), |
878 | OPAL_REINIT_CPUS_HILE_LE = (1 << 1), | 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 | typedef struct oppanel_line { | 890 | typedef struct oppanel_line { |
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 59684b4af4d1..9b87abb178f0 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c | |||
@@ -59,6 +59,8 @@ static struct task_struct *kopald_tsk; | |||
59 | 59 | ||
60 | void opal_configure_cores(void) | 60 | void opal_configure_cores(void) |
61 | { | 61 | { |
62 | u64 reinit_flags = 0; | ||
63 | |||
62 | /* Do the actual re-init, This will clobber all FPRs, VRs, etc... | 64 | /* Do the actual re-init, This will clobber all FPRs, VRs, etc... |
63 | * | 65 | * |
64 | * It will preserve non volatile GPRs and HSPRG0/1. It will | 66 | * It will preserve non volatile GPRs and HSPRG0/1. It will |
@@ -66,11 +68,24 @@ void opal_configure_cores(void) | |||
66 | * but it might clobber a bunch. | 68 | * but it might clobber a bunch. |
67 | */ | 69 | */ |
68 | #ifdef __BIG_ENDIAN__ | 70 | #ifdef __BIG_ENDIAN__ |
69 | opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_BE); | 71 | reinit_flags |= OPAL_REINIT_CPUS_HILE_BE; |
70 | #else | 72 | #else |
71 | opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_LE); | 73 | reinit_flags |= OPAL_REINIT_CPUS_HILE_LE; |
72 | #endif | 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 | /* Restore some bits */ | 89 | /* Restore some bits */ |
75 | if (cur_cpu_spec->cpu_restore) | 90 | if (cur_cpu_spec->cpu_restore) |
76 | cur_cpu_spec->cpu_restore(); | 91 | cur_cpu_spec->cpu_restore(); |
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 2dc7e5fb86c3..897aa1400eb8 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c | |||
@@ -225,6 +225,8 @@ static void pnv_kexec_wait_secondaries_down(void) | |||
225 | 225 | ||
226 | static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) | 226 | static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) |
227 | { | 227 | { |
228 | u64 reinit_flags; | ||
229 | |||
228 | if (xive_enabled()) | 230 | if (xive_enabled()) |
229 | xive_kexec_teardown_cpu(secondary); | 231 | xive_kexec_teardown_cpu(secondary); |
230 | else | 232 | else |
@@ -254,8 +256,15 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) | |||
254 | * We might be running as little-endian - now that interrupts | 256 | * We might be running as little-endian - now that interrupts |
255 | * are disabled, reset the HILE bit to big-endian so we don't | 257 | * are disabled, reset the HILE bit to big-endian so we don't |
256 | * take interrupts in the wrong endian later | 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 | #endif /* CONFIG_KEXEC_CORE */ | 270 | #endif /* CONFIG_KEXEC_CORE */ |