Skip to content

Commit a08f828

Browse files
npigginmpe
authored andcommitted
powerpc/64: Convert fast_exception_return to use RFI_TO_USER/KERNEL
Similar to the syscall return path, in fast_exception_return we may be returning to user or kernel context. We already have a test for that, because we conditionally restore r13. So use that existing test and branch, and bifurcate the return based on that. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent b8e90cb commit a08f828

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

arch/powerpc/kernel/entry_64.S

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ BEGIN_FTR_SECTION
892892
END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
893893
ACCOUNT_CPU_USER_EXIT(r13, r2, r4)
894894
REST_GPR(13, r1)
895-
1:
895+
896896
mtspr SPRN_SRR1,r3
897897

898898
ld r2,_CCR(r1)
@@ -905,8 +905,22 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
905905
ld r3,GPR3(r1)
906906
ld r4,GPR4(r1)
907907
ld r1,GPR1(r1)
908+
RFI_TO_USER
909+
b . /* prevent speculative execution */
910+
911+
1: mtspr SPRN_SRR1,r3
912+
913+
ld r2,_CCR(r1)
914+
mtcrf 0xFF,r2
915+
ld r2,_NIP(r1)
916+
mtspr SPRN_SRR0,r2
908917

909-
rfid
918+
ld r0,GPR0(r1)
919+
ld r2,GPR2(r1)
920+
ld r3,GPR3(r1)
921+
ld r4,GPR4(r1)
922+
ld r1,GPR1(r1)
923+
RFI_TO_KERNEL
910924
b . /* prevent speculative execution */
911925

912926
#endif /* CONFIG_PPC_BOOK3E */

0 commit comments

Comments
 (0)