diff options
author | Michael Neuling <mikey@neuling.org> | 2013-02-13 11:21:32 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-02-15 00:58:50 -0500 |
commit | 8b3c34cf0e0ab334a24aad7367cd06a5ba09a898 (patch) | |
tree | a0dbebeaee859a25117559f7a4aff9c59224d847 /arch/powerpc/include/asm | |
parent | f4c3aff2230bfe696a0683073b77446248d7895c (diff) |
powerpc: New macros for transactional memory support
This adds new macros for saving and restoring checkpointed architected state
from and to the thread_struct.
It also adds some debugging macros for when your brain explodes trying to debug
your transactional memory enabled kernel.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r-- | arch/powerpc/include/asm/ppc_asm.h | 83 | ||||
-rw-r--r-- | arch/powerpc/include/asm/processor.h | 1 |
2 files changed, 84 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index c2d0e58aba31..54219cea9e88 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h | |||
@@ -123,6 +123,89 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) | |||
123 | #define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base) | 123 | #define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base) |
124 | #define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) | 124 | #define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) |
125 | 125 | ||
126 | /* Save/restore FPRs, VRs and VSRs from their checkpointed backups in | ||
127 | * thread_struct: | ||
128 | */ | ||
129 | #define SAVE_FPR_TRANSACT(n, base) stfd n,THREAD_TRANSACT_FPR0+ \ | ||
130 | 8*TS_FPRWIDTH*(n)(base) | ||
131 | #define SAVE_2FPRS_TRANSACT(n, base) SAVE_FPR_TRANSACT(n, base); \ | ||
132 | SAVE_FPR_TRANSACT(n+1, base) | ||
133 | #define SAVE_4FPRS_TRANSACT(n, base) SAVE_2FPRS_TRANSACT(n, base); \ | ||
134 | SAVE_2FPRS_TRANSACT(n+2, base) | ||
135 | #define SAVE_8FPRS_TRANSACT(n, base) SAVE_4FPRS_TRANSACT(n, base); \ | ||
136 | SAVE_4FPRS_TRANSACT(n+4, base) | ||
137 | #define SAVE_16FPRS_TRANSACT(n, base) SAVE_8FPRS_TRANSACT(n, base); \ | ||
138 | SAVE_8FPRS_TRANSACT(n+8, base) | ||
139 | #define SAVE_32FPRS_TRANSACT(n, base) SAVE_16FPRS_TRANSACT(n, base); \ | ||
140 | SAVE_16FPRS_TRANSACT(n+16, base) | ||
141 | |||
142 | #define REST_FPR_TRANSACT(n, base) lfd n,THREAD_TRANSACT_FPR0+ \ | ||
143 | 8*TS_FPRWIDTH*(n)(base) | ||
144 | #define REST_2FPRS_TRANSACT(n, base) REST_FPR_TRANSACT(n, base); \ | ||
145 | REST_FPR_TRANSACT(n+1, base) | ||
146 | #define REST_4FPRS_TRANSACT(n, base) REST_2FPRS_TRANSACT(n, base); \ | ||
147 | REST_2FPRS_TRANSACT(n+2, base) | ||
148 | #define REST_8FPRS_TRANSACT(n, base) REST_4FPRS_TRANSACT(n, base); \ | ||
149 | REST_4FPRS_TRANSACT(n+4, base) | ||
150 | #define REST_16FPRS_TRANSACT(n, base) REST_8FPRS_TRANSACT(n, base); \ | ||
151 | REST_8FPRS_TRANSACT(n+8, base) | ||
152 | #define REST_32FPRS_TRANSACT(n, base) REST_16FPRS_TRANSACT(n, base); \ | ||
153 | REST_16FPRS_TRANSACT(n+16, base) | ||
154 | |||
155 | |||
156 | #define SAVE_VR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VR0+(16*(n)); \ | ||
157 | stvx n,b,base | ||
158 | #define SAVE_2VRS_TRANSACT(n,b,base) SAVE_VR_TRANSACT(n,b,base); \ | ||
159 | SAVE_VR_TRANSACT(n+1,b,base) | ||
160 | #define SAVE_4VRS_TRANSACT(n,b,base) SAVE_2VRS_TRANSACT(n,b,base); \ | ||
161 | SAVE_2VRS_TRANSACT(n+2,b,base) | ||
162 | #define SAVE_8VRS_TRANSACT(n,b,base) SAVE_4VRS_TRANSACT(n,b,base); \ | ||
163 | SAVE_4VRS_TRANSACT(n+4,b,base) | ||
164 | #define SAVE_16VRS_TRANSACT(n,b,base) SAVE_8VRS_TRANSACT(n,b,base); \ | ||
165 | SAVE_8VRS_TRANSACT(n+8,b,base) | ||
166 | #define SAVE_32VRS_TRANSACT(n,b,base) SAVE_16VRS_TRANSACT(n,b,base); \ | ||
167 | SAVE_16VRS_TRANSACT(n+16,b,base) | ||
168 | |||
169 | #define REST_VR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VR0+(16*(n)); \ | ||
170 | lvx n,b,base | ||
171 | #define REST_2VRS_TRANSACT(n,b,base) REST_VR_TRANSACT(n,b,base); \ | ||
172 | REST_VR_TRANSACT(n+1,b,base) | ||
173 | #define REST_4VRS_TRANSACT(n,b,base) REST_2VRS_TRANSACT(n,b,base); \ | ||
174 | REST_2VRS_TRANSACT(n+2,b,base) | ||
175 | #define REST_8VRS_TRANSACT(n,b,base) REST_4VRS_TRANSACT(n,b,base); \ | ||
176 | REST_4VRS_TRANSACT(n+4,b,base) | ||
177 | #define REST_16VRS_TRANSACT(n,b,base) REST_8VRS_TRANSACT(n,b,base); \ | ||
178 | REST_8VRS_TRANSACT(n+8,b,base) | ||
179 | #define REST_32VRS_TRANSACT(n,b,base) REST_16VRS_TRANSACT(n,b,base); \ | ||
180 | REST_16VRS_TRANSACT(n+16,b,base) | ||
181 | |||
182 | |||
183 | #define SAVE_VSR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VSR0+(16*(n)); \ | ||
184 | STXVD2X(n,R##base,R##b) | ||
185 | #define SAVE_2VSRS_TRANSACT(n,b,base) SAVE_VSR_TRANSACT(n,b,base); \ | ||
186 | SAVE_VSR_TRANSACT(n+1,b,base) | ||
187 | #define SAVE_4VSRS_TRANSACT(n,b,base) SAVE_2VSRS_TRANSACT(n,b,base); \ | ||
188 | SAVE_2VSRS_TRANSACT(n+2,b,base) | ||
189 | #define SAVE_8VSRS_TRANSACT(n,b,base) SAVE_4VSRS_TRANSACT(n,b,base); \ | ||
190 | SAVE_4VSRS_TRANSACT(n+4,b,base) | ||
191 | #define SAVE_16VSRS_TRANSACT(n,b,base) SAVE_8VSRS_TRANSACT(n,b,base); \ | ||
192 | SAVE_8VSRS_TRANSACT(n+8,b,base) | ||
193 | #define SAVE_32VSRS_TRANSACT(n,b,base) SAVE_16VSRS_TRANSACT(n,b,base); \ | ||
194 | SAVE_16VSRS_TRANSACT(n+16,b,base) | ||
195 | |||
196 | #define REST_VSR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VSR0+(16*(n)); \ | ||
197 | LXVD2X(n,R##base,R##b) | ||
198 | #define REST_2VSRS_TRANSACT(n,b,base) REST_VSR_TRANSACT(n,b,base); \ | ||
199 | REST_VSR_TRANSACT(n+1,b,base) | ||
200 | #define REST_4VSRS_TRANSACT(n,b,base) REST_2VSRS_TRANSACT(n,b,base); \ | ||
201 | REST_2VSRS_TRANSACT(n+2,b,base) | ||
202 | #define REST_8VSRS_TRANSACT(n,b,base) REST_4VSRS_TRANSACT(n,b,base); \ | ||
203 | REST_4VSRS_TRANSACT(n+4,b,base) | ||
204 | #define REST_16VSRS_TRANSACT(n,b,base) REST_8VSRS_TRANSACT(n,b,base); \ | ||
205 | REST_8VSRS_TRANSACT(n+8,b,base) | ||
206 | #define REST_32VSRS_TRANSACT(n,b,base) REST_16VSRS_TRANSACT(n,b,base); \ | ||
207 | REST_16VSRS_TRANSACT(n+16,b,base) | ||
208 | |||
126 | /* Save the lower 32 VSRs in the thread VSR region */ | 209 | /* Save the lower 32 VSRs in the thread VSR region */ |
127 | #define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,R##base,R##b) | 210 | #define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,R##base,R##b) |
128 | #define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base) | 211 | #define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base) |
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index fc41ab3aa114..7ff9eaa3ea6c 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -152,6 +152,7 @@ typedef struct { | |||
152 | #define TS_FPROFFSET 0 | 152 | #define TS_FPROFFSET 0 |
153 | #define TS_VSRLOWOFFSET 1 | 153 | #define TS_VSRLOWOFFSET 1 |
154 | #define TS_FPR(i) fpr[i][TS_FPROFFSET] | 154 | #define TS_FPR(i) fpr[i][TS_FPROFFSET] |
155 | #define TS_TRANS_FPR(i) transact_fpr[i][TS_FPROFFSET] | ||
155 | 156 | ||
156 | struct thread_struct { | 157 | struct thread_struct { |
157 | unsigned long ksp; /* Kernel stack pointer */ | 158 | unsigned long ksp; /* Kernel stack pointer */ |