Skip to content

Commit bc40320

Browse files
committed
Merge tag 'powerpc-5.18-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fix from Michael Ellerman: - Fix KVM PR on 32-bit, which was broken by some MMU code refactoring. Thanks to: Alexander Graf, and Matt Evans. * tag 'powerpc-5.18-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: KVM: PPC: Book3S PR: Enable MSR_DR for switch_mmu_context()
2 parents 79dc4fc + ee83484 commit bc40320

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

arch/powerpc/kvm/book3s_32_sr.S

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,27 @@
122122

123123
/* 0x0 - 0xb */
124124

125-
/* 'current->mm' needs to be in r4 */
126-
tophys(r4, r2)
127-
lwz r4, MM(r4)
128-
tophys(r4, r4)
129-
/* This only clobbers r0, r3, r4 and r5 */
125+
/* switch_mmu_context() needs paging, let's enable it */
126+
mfmsr r9
127+
ori r11, r9, MSR_DR
128+
mtmsr r11
129+
sync
130+
131+
/* switch_mmu_context() clobbers r12, rescue it */
132+
SAVE_GPR(12, r1)
133+
134+
/* Calling switch_mmu_context(<inv>, current->mm, <inv>); */
135+
lwz r4, MM(r2)
130136
bl switch_mmu_context
131137

138+
/* restore r12 */
139+
REST_GPR(12, r1)
140+
141+
/* Disable paging again */
142+
mfmsr r9
143+
li r6, MSR_DR
144+
andc r9, r9, r6
145+
mtmsr r9
146+
sync
147+
132148
.endm

0 commit comments

Comments
 (0)