Skip to content

Commit faf37c4

Browse files
mikeympe
authored andcommitted
powerpc/64s: Clear PCR on boot
Clear the PCR (Processor Compatibility Register) on boot to ensure we are not running in a compatibility mode. We've seen this cause problems when a crash (and kdump) occurs while running compat mode guests. The kdump kernel then runs with the PCR set and causes problems. The symptom in the kdump kernel (also seen in petitboot after fast-reboot) is early userspace programs taking sigills on newer instructions (seen in libc). Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: stable@vger.kernel.org Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent c1d2a31 commit faf37c4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

arch/powerpc/kernel/cpu_setup_power.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ _GLOBAL(__setup_cpu_power7)
2828
beqlr
2929
li r0,0
3030
mtspr SPRN_LPID,r0
31+
mtspr SPRN_PCR,r0
3132
mfspr r3,SPRN_LPCR
3233
li r4,(LPCR_LPES1 >> LPCR_LPES_SH)
3334
bl __init_LPCR_ISA206
@@ -41,6 +42,7 @@ _GLOBAL(__restore_cpu_power7)
4142
beqlr
4243
li r0,0
4344
mtspr SPRN_LPID,r0
45+
mtspr SPRN_PCR,r0
4446
mfspr r3,SPRN_LPCR
4547
li r4,(LPCR_LPES1 >> LPCR_LPES_SH)
4648
bl __init_LPCR_ISA206
@@ -57,6 +59,7 @@ _GLOBAL(__setup_cpu_power8)
5759
beqlr
5860
li r0,0
5961
mtspr SPRN_LPID,r0
62+
mtspr SPRN_PCR,r0
6063
mfspr r3,SPRN_LPCR
6164
ori r3, r3, LPCR_PECEDH
6265
li r4,0 /* LPES = 0 */
@@ -78,6 +81,7 @@ _GLOBAL(__restore_cpu_power8)
7881
beqlr
7982
li r0,0
8083
mtspr SPRN_LPID,r0
84+
mtspr SPRN_PCR,r0
8185
mfspr r3,SPRN_LPCR
8286
ori r3, r3, LPCR_PECEDH
8387
li r4,0 /* LPES = 0 */
@@ -99,6 +103,7 @@ _GLOBAL(__setup_cpu_power9)
99103
mtspr SPRN_PSSCR,r0
100104
mtspr SPRN_LPID,r0
101105
mtspr SPRN_PID,r0
106+
mtspr SPRN_PCR,r0
102107
mfspr r3,SPRN_LPCR
103108
LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
104109
or r3, r3, r4
@@ -123,6 +128,7 @@ _GLOBAL(__restore_cpu_power9)
123128
mtspr SPRN_PSSCR,r0
124129
mtspr SPRN_LPID,r0
125130
mtspr SPRN_PID,r0
131+
mtspr SPRN_PCR,r0
126132
mfspr r3,SPRN_LPCR
127133
LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
128134
or r3, r3, r4

arch/powerpc/kernel/dt_cpu_ftrs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static void __restore_cpu_cpufeatures(void)
101101
if (hv_mode) {
102102
mtspr(SPRN_LPID, 0);
103103
mtspr(SPRN_HFSCR, system_registers.hfscr);
104+
mtspr(SPRN_PCR, 0);
104105
}
105106
mtspr(SPRN_FSCR, system_registers.fscr);
106107

0 commit comments

Comments
 (0)