Skip to content

Commit b133ef6

Browse files
committed
Merge tag 'powerpc-4.17-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fix from Michael Ellerman: "Just one fix, to make sure the PCR (Processor Compatibility Register) is reset on boot. Otherwise if we're running in compat mode in a guest (eg. pretending a Power9 is a Power8) and the host kernel oopses and kdumps then the kdump kernel's userspace will be running in Power8 mode, and will SIGILL if it uses Power9-only instructions. Thanks to Michael Neuling" * tag 'powerpc-4.17-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/64s: Clear PCR on boot
2 parents f287fe3 + faf37c4 commit b133ef6

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)