Skip to content

Commit 98ae22e

Browse files
mikeyozbenh
authored andcommitted
powerpc: Add helper functions for transactional memory context switching
Here we add the helper functions to be used when context switching. These allow us to fully reclaim and recheckpoint a transaction. We introduce a new paca field called tm_scratch to help us store away register values when doing the low level tm reclaim register save. Signed-off-by: Matt Evans <[email protected]> Signed-off-by: Michael Neuling <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent afc0770 commit 98ae22e

4 files changed

Lines changed: 411 additions & 1 deletion

File tree

arch/powerpc/include/asm/reg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@
797797
* HV mode in which case it is HSPRG0
798798
*
799799
* 64-bit server:
800-
* - SPRG0 unused (reserved for HV on Power4)
800+
* - SPRG0 scratch for TM recheckpoint/reclaim (reserved for HV on Power4)
801801
* - SPRG2 scratch for exception vectors
802802
* - SPRG3 CPU and NUMA node for VDSO getcpu (user visible)
803803
* - HSPRG0 stores PACA in HV mode

arch/powerpc/include/asm/tm.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Transactional memory support routines to reclaim and recheckpoint
3+
* transactional process state.
4+
*
5+
* Copyright 2012 Matt Evans & Michael Neuling, IBM Corporation.
6+
*/
7+
8+
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
9+
extern void do_load_up_transact_fpu(struct thread_struct *thread);
10+
extern void do_load_up_transact_altivec(struct thread_struct *thread);
11+
#endif
12+
13+
extern void tm_enable(void);
14+
extern void tm_reclaim(struct thread_struct *thread,
15+
unsigned long orig_msr, uint8_t cause);
16+
extern void tm_recheckpoint(struct thread_struct *thread,
17+
unsigned long orig_msr);
18+
extern void tm_abort(uint8_t cause);
19+
extern void tm_save_sprs(struct thread_struct *thread);
20+
extern void tm_restore_sprs(struct thread_struct *thread);

arch/powerpc/kernel/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
121121
obj-y += iomap.o
122122
endif
123123

124+
obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o
125+
124126
obj-$(CONFIG_PPC64) += $(obj64-y)
125127
obj-$(CONFIG_PPC32) += $(obj32-y)
126128

0 commit comments

Comments
 (0)