]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
powerpc/64: Add macros for annotating the destination of rfid/hrfid
authorNicholas Piggin <npiggin@gmail.com>
Tue, 9 Jan 2018 16:07:15 +0000 (03:07 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Feb 2018 11:35:54 +0000 (12:35 +0100)
commit 50e51c13b3822d14ff6df4279423e4b7b2269bc3 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/include/asm/exception-64e.h
arch/powerpc/include/asm/exception-64s.h

index a703452d67b62f63b455098e88988fcc0b3776c6..555e22d5e07f9e21c322af718df72bdf2da0dfa4 100644 (file)
@@ -209,5 +209,11 @@ exc_##label##_book3e:
        ori     r3,r3,vector_offset@l;          \
        mtspr   SPRN_IVOR##vector_number,r3;
 
+#define RFI_TO_KERNEL                                                  \
+       rfi
+
+#define RFI_TO_USER                                                    \
+       rfi
+
 #endif /* _ASM_POWERPC_EXCEPTION_64E_H */
 
index 9a3eee66129766d84d8bd5063fd8ecd142e8fc21..6771cbe44594154eb5008a2f7f3475da5351849e 100644 (file)
 #define EX_PPR         88      /* SMT thread status register (priority) */
 #define EX_CTR         96
 
+/* Macros for annotating the expected destination of (h)rfid */
+
+#define RFI_TO_KERNEL                                                  \
+       rfid
+
+#define RFI_TO_USER                                                    \
+       rfid
+
+#define RFI_TO_USER_OR_KERNEL                                          \
+       rfid
+
+#define RFI_TO_GUEST                                                   \
+       rfid
+
+#define HRFI_TO_KERNEL                                                 \
+       hrfid
+
+#define HRFI_TO_USER                                                   \
+       hrfid
+
+#define HRFI_TO_USER_OR_KERNEL                                         \
+       hrfid
+
+#define HRFI_TO_GUEST                                                  \
+       hrfid
+
+#define HRFI_TO_UNKNOWN                                                        \
+       hrfid
+
 #ifdef CONFIG_RELOCATABLE
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)                   \
        mfspr   r11,SPRN_##h##SRR0;     /* save SRR0 */                 \