aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-08-07 00:20:50 -0400
committerPaul Mackerras <paulus@samba.org>2007-08-15 01:12:50 -0400
commitaa1cf632bd6f998cb4567ccf1a9d2e5daaa9fb44 (patch)
tree83a94ce1f8ec1749cfefd8c280297c9e404e6452 /arch/powerpc
parentfa6b769a8e981afea869285982640168f76774df (diff)
[POWERPC] Fix small race in 44x tlbie function
The 440 family of processors don't have a tlbie instruction. So, we implement TLB invalidates by explicitly searching the TLB with tlbsx., then clobbering the relevant entry, if any. Unfortunately the PID for the search needs to be stored in the MMUCR register, which is also used by the TLB miss handler. Interrupts were enabled in _tlbie(), so an interrupt between loading the MMUCR and the tlbsx could cause incorrect search results, and thus a failure to invalide TLB entries which needed to be invalidated. This fixes the problem in both arch/ppc and arch/powerpc by inhibiting interrupts (even critical and debug interrupts) across the relevant instructions. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/misc_32.S12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index e708ab7ca9e8..8533de50347d 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -301,9 +301,19 @@ _GLOBAL(_tlbie)
301 mfspr r4,SPRN_MMUCR 301 mfspr r4,SPRN_MMUCR
302 mfspr r5,SPRN_PID /* Get PID */ 302 mfspr r5,SPRN_PID /* Get PID */
303 rlwimi r4,r5,0,24,31 /* Set TID */ 303 rlwimi r4,r5,0,24,31 /* Set TID */
304 mtspr SPRN_MMUCR,r4
305 304
305 /* We have to run the search with interrupts disabled, even critical
306 * and debug interrupts (in fact the only critical exceptions we have
307 * are debug and machine check). Otherwise an interrupt which causes
308 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
309 mfmsr r5
310 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
311 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
312 andc r6,r5,r6
313 mtmsr r6
314 mtspr SPRN_MMUCR,r4
306 tlbsx. r3, 0, r3 315 tlbsx. r3, 0, r3
316 mtmsr r5
307 bne 10f 317 bne 10f
308 sync 318 sync
309 /* There are only 64 TLB entries, so r3 < 64, 319 /* There are only 64 TLB entries, so r3 < 64,