diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2010-05-07 13:03:05 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-08 05:44:30 -0400 |
commit | b8349b569aae661dea9d59d7d2ee587ccea3336c (patch) | |
tree | 297ce3147521e0658321d61114a045bef4eca1d0 | |
parent | f4d6477f7f073b99220386d62f5bf54bec3482cc (diff) |
ARM: 6112/1: Use the Inner Shareable I-cache and BTB ops on ARMv7 SMP
The standard I-cache Invalidate All (ICIALLU) and Branch Predication
Invalidate All (BPIALL) operations are not automatically broadcast to
the other CPUs in an ARMv7 MP system. The patch adds the Inner Shareable
variants, ICIALLUIS and BPIALLIS, if ARMv7 and SMP.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/include/asm/cacheflush.h | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/tlbflush.h | 29 | ||||
-rw-r--r-- | arch/arm/mm/cache-v7.S | 4 | ||||
-rw-r--r-- | arch/arm/mm/tlb-v7.S | 8 |
4 files changed, 44 insertions, 1 deletions
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index 0d08d4170b64..4656a24058d2 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
@@ -371,6 +371,10 @@ static inline void __flush_icache_all(void) | |||
371 | #ifdef CONFIG_ARM_ERRATA_411920 | 371 | #ifdef CONFIG_ARM_ERRATA_411920 |
372 | extern void v6_icache_inval_all(void); | 372 | extern void v6_icache_inval_all(void); |
373 | v6_icache_inval_all(); | 373 | v6_icache_inval_all(); |
374 | #elif defined(CONFIG_SMP) && __LINUX_ARM_ARCH__ >= 7 | ||
375 | asm("mcr p15, 0, %0, c7, c1, 0 @ invalidate I-cache inner shareable\n" | ||
376 | : | ||
377 | : "r" (0)); | ||
374 | #else | 378 | #else |
375 | asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n" | 379 | asm("mcr p15, 0, %0, c7, c5, 0 @ invalidate I-cache\n" |
376 | : | 380 | : |
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index e085e2c545eb..bd863d8608cd 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h | |||
@@ -46,6 +46,9 @@ | |||
46 | #define TLB_V7_UIS_FULL (1 << 20) | 46 | #define TLB_V7_UIS_FULL (1 << 20) |
47 | #define TLB_V7_UIS_ASID (1 << 21) | 47 | #define TLB_V7_UIS_ASID (1 << 21) |
48 | 48 | ||
49 | /* Inner Shareable BTB operation (ARMv7 MP extensions) */ | ||
50 | #define TLB_V7_IS_BTB (1 << 22) | ||
51 | |||
49 | #define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */ | 52 | #define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */ |
50 | #define TLB_DCLEAN (1 << 30) | 53 | #define TLB_DCLEAN (1 << 30) |
51 | #define TLB_WB (1 << 31) | 54 | #define TLB_WB (1 << 31) |
@@ -183,7 +186,7 @@ | |||
183 | #endif | 186 | #endif |
184 | 187 | ||
185 | #ifdef CONFIG_SMP | 188 | #ifdef CONFIG_SMP |
186 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ | 189 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_V7_IS_BTB | \ |
187 | TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID) | 190 | TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID) |
188 | #else | 191 | #else |
189 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ | 192 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ |
@@ -339,6 +342,12 @@ static inline void local_flush_tlb_all(void) | |||
339 | dsb(); | 342 | dsb(); |
340 | isb(); | 343 | isb(); |
341 | } | 344 | } |
345 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
346 | /* flush the branch target cache */ | ||
347 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
348 | dsb(); | ||
349 | isb(); | ||
350 | } | ||
342 | } | 351 | } |
343 | 352 | ||
344 | static inline void local_flush_tlb_mm(struct mm_struct *mm) | 353 | static inline void local_flush_tlb_mm(struct mm_struct *mm) |
@@ -376,6 +385,12 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm) | |||
376 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); | 385 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); |
377 | dsb(); | 386 | dsb(); |
378 | } | 387 | } |
388 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
389 | /* flush the branch target cache */ | ||
390 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
391 | dsb(); | ||
392 | isb(); | ||
393 | } | ||
379 | } | 394 | } |
380 | 395 | ||
381 | static inline void | 396 | static inline void |
@@ -416,6 +431,12 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | |||
416 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); | 431 | asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc"); |
417 | dsb(); | 432 | dsb(); |
418 | } | 433 | } |
434 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
435 | /* flush the branch target cache */ | ||
436 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
437 | dsb(); | ||
438 | isb(); | ||
439 | } | ||
419 | } | 440 | } |
420 | 441 | ||
421 | static inline void local_flush_tlb_kernel_page(unsigned long kaddr) | 442 | static inline void local_flush_tlb_kernel_page(unsigned long kaddr) |
@@ -454,6 +475,12 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr) | |||
454 | dsb(); | 475 | dsb(); |
455 | isb(); | 476 | isb(); |
456 | } | 477 | } |
478 | if (tlb_flag(TLB_V7_IS_BTB)) { | ||
479 | /* flush the branch target cache */ | ||
480 | asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero) : "cc"); | ||
481 | dsb(); | ||
482 | isb(); | ||
483 | } | ||
457 | } | 484 | } |
458 | 485 | ||
459 | /* | 486 | /* |
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S index bcd64f265870..06a90dcfc60a 100644 --- a/arch/arm/mm/cache-v7.S +++ b/arch/arm/mm/cache-v7.S | |||
@@ -167,7 +167,11 @@ ENTRY(v7_coherent_user_range) | |||
167 | cmp r0, r1 | 167 | cmp r0, r1 |
168 | blo 1b | 168 | blo 1b |
169 | mov r0, #0 | 169 | mov r0, #0 |
170 | #ifdef CONFIG_SMP | ||
171 | mcr p15, 0, r0, c7, c1, 6 @ invalidate BTB Inner Shareable | ||
172 | #else | ||
170 | mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB | 173 | mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB |
174 | #endif | ||
171 | dsb | 175 | dsb |
172 | isb | 176 | isb |
173 | mov pc, lr | 177 | mov pc, lr |
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S index 0cb1848bd876..f3f288a9546d 100644 --- a/arch/arm/mm/tlb-v7.S +++ b/arch/arm/mm/tlb-v7.S | |||
@@ -50,7 +50,11 @@ ENTRY(v7wbi_flush_user_tlb_range) | |||
50 | cmp r0, r1 | 50 | cmp r0, r1 |
51 | blo 1b | 51 | blo 1b |
52 | mov ip, #0 | 52 | mov ip, #0 |
53 | #ifdef CONFIG_SMP | ||
54 | mcr p15, 0, ip, c7, c1, 6 @ flush BTAC/BTB Inner Shareable | ||
55 | #else | ||
53 | mcr p15, 0, ip, c7, c5, 6 @ flush BTAC/BTB | 56 | mcr p15, 0, ip, c7, c5, 6 @ flush BTAC/BTB |
57 | #endif | ||
54 | dsb | 58 | dsb |
55 | mov pc, lr | 59 | mov pc, lr |
56 | ENDPROC(v7wbi_flush_user_tlb_range) | 60 | ENDPROC(v7wbi_flush_user_tlb_range) |
@@ -79,7 +83,11 @@ ENTRY(v7wbi_flush_kern_tlb_range) | |||
79 | cmp r0, r1 | 83 | cmp r0, r1 |
80 | blo 1b | 84 | blo 1b |
81 | mov r2, #0 | 85 | mov r2, #0 |
86 | #ifdef CONFIG_SMP | ||
87 | mcr p15, 0, r2, c7, c1, 6 @ flush BTAC/BTB Inner Shareable | ||
88 | #else | ||
82 | mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB | 89 | mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB |
90 | #endif | ||
83 | dsb | 91 | dsb |
84 | isb | 92 | isb |
85 | mov pc, lr | 93 | mov pc, lr |