diff options
author | Anton Blanchard <anton@samba.org> | 2012-05-29 08:22:00 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-07-03 00:14:43 -0400 |
commit | ac1dc36558da25934f83a2871b9e70239a987351 (patch) | |
tree | 155d119bd3534b9f324e02a0454d0fbba58d6a88 /arch/powerpc/kernel/entry_64.S | |
parent | a9514dc69d5c4f5d6d9e4b8eed40172abd150c61 (diff) |
powerpc: Clear RI and EE at the same time in system call exit
mtmsrd is an expensive instruction, we save a few cycles by
doing it once instead of twice.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_64.S')
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 5971c85df136..cf38a17ab28a 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -197,7 +197,16 @@ syscall_exit: | |||
197 | wrteei 0 | 197 | wrteei 0 |
198 | #else | 198 | #else |
199 | ld r10,PACAKMSR(r13) | 199 | ld r10,PACAKMSR(r13) |
200 | mtmsrd r10,1 | 200 | /* |
201 | * For performance reasons we clear RI the same time that we | ||
202 | * clear EE. We only need to clear RI just before we restore r13 | ||
203 | * below, but batching it with EE saves us one expensive mtmsrd call. | ||
204 | * We have to be careful to restore RI if we branch anywhere from | ||
205 | * here (eg syscall_exit_work). | ||
206 | */ | ||
207 | li r9,MSR_RI | ||
208 | andc r11,r10,r9 | ||
209 | mtmsrd r11,1 | ||
201 | #endif /* CONFIG_PPC_BOOK3E */ | 210 | #endif /* CONFIG_PPC_BOOK3E */ |
202 | 211 | ||
203 | ld r9,TI_FLAGS(r12) | 212 | ld r9,TI_FLAGS(r12) |
@@ -214,17 +223,6 @@ BEGIN_FTR_SECTION | |||
214 | END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) | 223 | END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) |
215 | andi. r6,r8,MSR_PR | 224 | andi. r6,r8,MSR_PR |
216 | ld r4,_LINK(r1) | 225 | ld r4,_LINK(r1) |
217 | /* | ||
218 | * Clear RI before restoring r13. If we are returning to | ||
219 | * userspace and we take an exception after restoring r13, | ||
220 | * we end up corrupting the userspace r13 value. | ||
221 | */ | ||
222 | #ifdef CONFIG_PPC_BOOK3S | ||
223 | /* No MSR:RI on BookE */ | ||
224 | li r12,MSR_RI | ||
225 | andc r11,r10,r12 | ||
226 | mtmsrd r11,1 /* clear MSR.RI */ | ||
227 | #endif /* CONFIG_PPC_BOOK3S */ | ||
228 | 226 | ||
229 | beq- 1f | 227 | beq- 1f |
230 | ACCOUNT_CPU_USER_EXIT(r11, r12) | 228 | ACCOUNT_CPU_USER_EXIT(r11, r12) |
@@ -271,6 +269,9 @@ syscall_enosys: | |||
271 | b syscall_exit | 269 | b syscall_exit |
272 | 270 | ||
273 | syscall_exit_work: | 271 | syscall_exit_work: |
272 | #ifdef CONFIG_PPC_BOOK3S | ||
273 | mtmsrd r10,1 /* Restore RI */ | ||
274 | #endif | ||
274 | /* If TIF_RESTOREALL is set, don't scribble on either r3 or ccr. | 275 | /* If TIF_RESTOREALL is set, don't scribble on either r3 or ccr. |
275 | If TIF_NOERROR is set, just save r3 as it is. */ | 276 | If TIF_NOERROR is set, just save r3 as it is. */ |
276 | 277 | ||