Browse Source

powerpc: Export tm_enable()/tm_disable/tm_abort() APIs

This patch exports tm_enable()/tm_disable/tm_abort() APIs, which
will be used for PR KVM transactional memory logic.

Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Reviewed-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Simon Guo 7 years ago
parent
commit
eacbb218fb

+ 3 - 0
arch/powerpc/include/asm/asm-prototypes.h

@@ -141,4 +141,7 @@ unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip);
 void pnv_power9_force_smt4_catch(void);
 void pnv_power9_force_smt4_catch(void);
 void pnv_power9_force_smt4_release(void);
 void pnv_power9_force_smt4_release(void);
 
 
+void tm_enable(void);
+void tm_disable(void);
+void tm_abort(uint8_t cause);
 #endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */
 #endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */

+ 0 - 2
arch/powerpc/include/asm/tm.h

@@ -10,12 +10,10 @@
 
 
 #ifndef __ASSEMBLY__
 #ifndef __ASSEMBLY__
 
 
-extern void tm_enable(void);
 extern void tm_reclaim(struct thread_struct *thread,
 extern void tm_reclaim(struct thread_struct *thread,
 		       uint8_t cause);
 		       uint8_t cause);
 extern void tm_reclaim_current(uint8_t cause);
 extern void tm_reclaim_current(uint8_t cause);
 extern void tm_recheckpoint(struct thread_struct *thread);
 extern void tm_recheckpoint(struct thread_struct *thread);
-extern void tm_abort(uint8_t cause);
 extern void tm_save_sprs(struct thread_struct *thread);
 extern void tm_save_sprs(struct thread_struct *thread);
 extern void tm_restore_sprs(struct thread_struct *thread);
 extern void tm_restore_sprs(struct thread_struct *thread);
 
 

+ 12 - 0
arch/powerpc/kernel/tm.S

@@ -12,6 +12,7 @@
 #include <asm/ptrace.h>
 #include <asm/ptrace.h>
 #include <asm/reg.h>
 #include <asm/reg.h>
 #include <asm/bug.h>
 #include <asm/bug.h>
+#include <asm/export.h>
 
 
 #ifdef CONFIG_VSX
 #ifdef CONFIG_VSX
 /* See fpu.S, this is borrowed from there */
 /* See fpu.S, this is borrowed from there */
@@ -55,6 +56,16 @@ _GLOBAL(tm_enable)
 	or	r4, r4, r3
 	or	r4, r4, r3
 	mtmsrd	r4
 	mtmsrd	r4
 1:	blr
 1:	blr
+EXPORT_SYMBOL_GPL(tm_enable);
+
+_GLOBAL(tm_disable)
+	mfmsr	r4
+	li	r3, MSR_TM >> 32
+	sldi	r3, r3, 32
+	andc	r4, r4, r3
+	mtmsrd	r4
+	blr
+EXPORT_SYMBOL_GPL(tm_disable);
 
 
 _GLOBAL(tm_save_sprs)
 _GLOBAL(tm_save_sprs)
 	mfspr	r0, SPRN_TFHAR
 	mfspr	r0, SPRN_TFHAR
@@ -78,6 +89,7 @@ _GLOBAL(tm_restore_sprs)
 _GLOBAL(tm_abort)
 _GLOBAL(tm_abort)
 	TABORT(R3)
 	TABORT(R3)
 	blr
 	blr
+EXPORT_SYMBOL_GPL(tm_abort);
 
 
 /* void tm_reclaim(struct thread_struct *thread,
 /* void tm_reclaim(struct thread_struct *thread,
  *		   uint8_t cause)
  *		   uint8_t cause)

+ 1 - 0
arch/powerpc/mm/hash_utils_64.c

@@ -64,6 +64,7 @@
 #include <asm/trace.h>
 #include <asm/trace.h>
 #include <asm/ps3.h>
 #include <asm/ps3.h>
 #include <asm/pte-walk.h>
 #include <asm/pte-walk.h>
+#include <asm/asm-prototypes.h>
 
 
 #ifdef DEBUG
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
 #define DBG(fmt...) udbg_printf(fmt)