powerpc/64s: Add support for RFI flush of L1-D cache
[platform/kernel/linux-exynos.git] / arch / powerpc / include / asm / exception-64s.h
index 0c8863f..ccf10c2 100644 (file)
  */
 #define EX_R3          EX_DAR
 
-/* Macros for annotating the expected destination of (h)rfid */
+/*
+ * Macros for annotating the expected destination of (h)rfid
+ *
+ * The nop instructions allow us to insert one or more instructions to flush the
+ * L1-D cache when returning to userspace or a guest.
+ */
+#define RFI_FLUSH_SLOT                                                 \
+       RFI_FLUSH_FIXUP_SECTION;                                        \
+       nop;                                                            \
+       nop;                                                            \
+       nop
 
 #define RFI_TO_KERNEL                                                  \
        rfid
 
 #define RFI_TO_USER                                                    \
-       rfid
+       RFI_FLUSH_SLOT;                                                 \
+       rfid;                                                           \
+       b       rfi_flush_fallback
 
 #define RFI_TO_USER_OR_KERNEL                                          \
-       rfid
+       RFI_FLUSH_SLOT;                                                 \
+       rfid;                                                           \
+       b       rfi_flush_fallback
 
 #define RFI_TO_GUEST                                                   \
-       rfid
+       RFI_FLUSH_SLOT;                                                 \
+       rfid;                                                           \
+       b       rfi_flush_fallback
 
 #define HRFI_TO_KERNEL                                                 \
        hrfid
 
 #define HRFI_TO_USER                                                   \
-       hrfid
+       RFI_FLUSH_SLOT;                                                 \
+       hrfid;                                                          \
+       b       hrfi_flush_fallback
 
 #define HRFI_TO_USER_OR_KERNEL                                         \
-       hrfid
+       RFI_FLUSH_SLOT;                                                 \
+       hrfid;                                                          \
+       b       hrfi_flush_fallback
 
 #define HRFI_TO_GUEST                                                  \
-       hrfid
+       RFI_FLUSH_SLOT;                                                 \
+       hrfid;                                                          \
+       b       hrfi_flush_fallback
 
 #define HRFI_TO_UNKNOWN                                                        \
-       hrfid
+       RFI_FLUSH_SLOT;                                                 \
+       hrfid;                                                          \
+       b       hrfi_flush_fallback
 
 #ifdef CONFIG_RELOCATABLE
 #define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)                   \