Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 50e51c1

Browse files
npigginmpe
authored andcommitted
powerpc/64: Add macros for annotating the destination of rfid/hrfid
The rfid/hrfid ((Hypervisor) Return From Interrupt) instruction is used for switching from the kernel to userspace, and from the hypervisor to the guest kernel. However it can and is also used for other transitions, eg. from real mode kernel code to virtual mode kernel code, and it's not always clear from the code what the destination context is. To make it clearer when reading the code, add macros which encode the expected destination context. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent a6978f4 commit 50e51c1

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

arch/powerpc/include/asm/exception-64e.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,11 @@ exc_##label##_book3e:
209209
ori r3,r3,vector_offset@l; \
210210
mtspr SPRN_IVOR##vector_number,r3;
211211

212+
#define RFI_TO_KERNEL \
213+
rfi
214+
215+
#define RFI_TO_USER \
216+
rfi
217+
212218
#endif /* _ASM_POWERPC_EXCEPTION_64E_H */
213219

arch/powerpc/include/asm/exception-64s.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,35 @@
7474
*/
7575
#define EX_R3 EX_DAR
7676

77+
/* Macros for annotating the expected destination of (h)rfid */
78+
79+
#define RFI_TO_KERNEL \
80+
rfid
81+
82+
#define RFI_TO_USER \
83+
rfid
84+
85+
#define RFI_TO_USER_OR_KERNEL \
86+
rfid
87+
88+
#define RFI_TO_GUEST \
89+
rfid
90+
91+
#define HRFI_TO_KERNEL \
92+
hrfid
93+
94+
#define HRFI_TO_USER \
95+
hrfid
96+
97+
#define HRFI_TO_USER_OR_KERNEL \
98+
hrfid
99+
100+
#define HRFI_TO_GUEST \
101+
hrfid
102+
103+
#define HRFI_TO_UNKNOWN \
104+
hrfid
105+
77106
#ifdef CONFIG_RELOCATABLE
78107
#define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
79108
mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \

0 commit comments

Comments
 (0)