Merge tag 'mm-nonmm-stable-2022-10-11' of git://git.kernel.org/pub/scm/linux/kernel...
[platform/kernel/linux-starfive.git] / arch / powerpc / include / asm / processor.h
index 92e3324..6318029 100644 (file)
@@ -354,11 +354,23 @@ static inline unsigned long __pack_fe01(unsigned int fpmode)
 
 #ifdef CONFIG_PPC64
 
-#define spin_begin()   HMT_low()
-
-#define spin_cpu_relax()       barrier()
-
-#define spin_end()     HMT_medium()
+#define spin_begin()                                                   \
+       asm volatile(ASM_FTR_IFCLR(                                     \
+               "or 1,1,1", /* HMT_LOW */                               \
+               "nop", /* v3.1 uses pause_short in cpu_relax instead */ \
+               %0) :: "i" (CPU_FTR_ARCH_31) : "memory")
+
+#define spin_cpu_relax()                                               \
+       asm volatile(ASM_FTR_IFCLR(                                     \
+               "nop", /* Before v3.1 use priority nops in spin_begin/end */ \
+               PPC_WAIT(2, 0), /* aka pause_short */                   \
+               %0) :: "i" (CPU_FTR_ARCH_31) : "memory")
+
+#define spin_end()                                                     \
+       asm volatile(ASM_FTR_IFCLR(                                     \
+               "or 2,2,2", /* HMT_MEDIUM */                            \
+               "nop",                                                  \
+               %0) :: "i" (CPU_FTR_ARCH_31) : "memory")
 
 #endif
 
@@ -425,6 +437,8 @@ extern int fix_alignment(struct pt_regs *);
 #endif
 
 int do_mathemu(struct pt_regs *regs);
+int do_spe_mathemu(struct pt_regs *regs);
+int speround_handler(struct pt_regs *regs);
 
 /* VMX copying */
 int enter_vmx_usercopy(void);