diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/mmu-book3e.h | 9 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 2 | ||||
-rw-r--r-- | arch/powerpc/mm/tlb_low_64e.S | 19 |
3 files changed, 20 insertions, 10 deletions
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h index 89b785d16846..901dac6b6cb7 100644 --- a/arch/powerpc/include/asm/mmu-book3e.h +++ b/arch/powerpc/include/asm/mmu-book3e.h | |||
@@ -287,11 +287,14 @@ extern int mmu_linear_psize; | |||
287 | extern int mmu_vmemmap_psize; | 287 | extern int mmu_vmemmap_psize; |
288 | 288 | ||
289 | struct tlb_core_data { | 289 | struct tlb_core_data { |
290 | /* | ||
291 | * Per-core spinlock for e6500 TLB handlers (no tlbsrx.) | ||
292 | * Must be the first struct element. | ||
293 | */ | ||
294 | u8 lock; | ||
295 | |||
290 | /* For software way selection, as on Freescale TLB1 */ | 296 | /* For software way selection, as on Freescale TLB1 */ |
291 | u8 esel_next, esel_max, esel_first; | 297 | u8 esel_next, esel_max, esel_first; |
292 | |||
293 | /* Per-core spinlock for e6500 TLB handlers (no tlbsrx.) */ | ||
294 | u8 lock; | ||
295 | }; | 298 | }; |
296 | 299 | ||
297 | #ifdef CONFIG_PPC64 | 300 | #ifdef CONFIG_PPC64 |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index da9c42f53bb1..4933909cc5c0 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -102,6 +102,8 @@ static void setup_tlb_core_data(void) | |||
102 | { | 102 | { |
103 | int cpu; | 103 | int cpu; |
104 | 104 | ||
105 | BUILD_BUG_ON(offsetof(struct tlb_core_data, lock) != 0); | ||
106 | |||
105 | for_each_possible_cpu(cpu) { | 107 | for_each_possible_cpu(cpu) { |
106 | int first = cpu_first_thread_sibling(cpu); | 108 | int first = cpu_first_thread_sibling(cpu); |
107 | 109 | ||
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S index 6bf50507a4b5..1e50249e900b 100644 --- a/arch/powerpc/mm/tlb_low_64e.S +++ b/arch/powerpc/mm/tlb_low_64e.S | |||
@@ -284,7 +284,7 @@ itlb_miss_fault_bolted: | |||
284 | * r14 = page table base | 284 | * r14 = page table base |
285 | * r13 = PACA | 285 | * r13 = PACA |
286 | * r11 = tlb_per_core ptr | 286 | * r11 = tlb_per_core ptr |
287 | * r10 = crap (free to use) | 287 | * r10 = cpu number |
288 | */ | 288 | */ |
289 | tlb_miss_common_e6500: | 289 | tlb_miss_common_e6500: |
290 | /* | 290 | /* |
@@ -293,15 +293,18 @@ tlb_miss_common_e6500: | |||
293 | * | 293 | * |
294 | * MAS6:IND should be already set based on MAS4 | 294 | * MAS6:IND should be already set based on MAS4 |
295 | */ | 295 | */ |
296 | addi r10,r11,TCD_LOCK | 296 | 1: lbarx r15,0,r11 |
297 | 1: lbarx r15,0,r10 | 297 | lhz r10,PACAPACAINDEX(r13) |
298 | cmpdi r15,0 | 298 | cmpdi r15,0 |
299 | cmpdi cr1,r15,1 /* set cr1.eq = 0 for non-recursive */ | ||
299 | bne 2f | 300 | bne 2f |
300 | li r15,1 | 301 | stbcx. r10,0,r11 |
301 | stbcx. r15,0,r10 | ||
302 | bne 1b | 302 | bne 1b |
303 | 3: | ||
303 | .subsection 1 | 304 | .subsection 1 |
304 | 2: lbz r15,0(r10) | 305 | 2: cmpd cr1,r15,r10 /* recursive lock due to mcheck/crit/etc? */ |
306 | beq cr1,3b /* unlock will happen if cr1.eq = 0 */ | ||
307 | lbz r15,0(r11) | ||
305 | cmpdi r15,0 | 308 | cmpdi r15,0 |
306 | bne 2b | 309 | bne 2b |
307 | b 1b | 310 | b 1b |
@@ -379,9 +382,11 @@ tlb_miss_common_e6500: | |||
379 | 382 | ||
380 | tlb_miss_done_e6500: | 383 | tlb_miss_done_e6500: |
381 | .macro tlb_unlock_e6500 | 384 | .macro tlb_unlock_e6500 |
385 | beq cr1,1f /* no unlock if lock was recursively grabbed */ | ||
382 | li r15,0 | 386 | li r15,0 |
383 | isync | 387 | isync |
384 | stb r15,TCD_LOCK(r11) | 388 | stb r15,0(r11) |
389 | 1: | ||
385 | .endm | 390 | .endm |
386 | 391 | ||
387 | tlb_unlock_e6500 | 392 | tlb_unlock_e6500 |