diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-05-30 09:00:14 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-05-30 09:00:14 -0400 |
commit | faa7bc51c11d5bbe440ac04710fd7a3208782000 (patch) | |
tree | 8aaa4e8e2fbb14b421988762fa90a3dbe6fa76e7 /arch/arm/include | |
parent | da055eb52ec067d51dc08c7e86baf92dd5c01599 (diff) |
Check whether the TLB operations need broadcasting on SMP systems
ARMv7 SMP hardware can handle the TLB maintenance operations
broadcasting in hardware so that the software can avoid the costly IPIs.
This patch adds the necessary checks (the MMFR3 CPUID register) to avoid
the broadcasting if already supported by the hardware.
(this patch is based on the work done by Tony Thompson @ ARM)
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/cputype.h | 25 | ||||
-rw-r--r-- | arch/arm/include/asm/tlbflush.h | 26 |
2 files changed, 49 insertions, 2 deletions
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index 7b9d27e749b8..b3e656c6fb78 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h | |||
@@ -8,6 +8,21 @@ | |||
8 | #define CPUID_TCM 2 | 8 | #define CPUID_TCM 2 |
9 | #define CPUID_TLBTYPE 3 | 9 | #define CPUID_TLBTYPE 3 |
10 | 10 | ||
11 | #define CPUID_EXT_PFR0 "c1, 0" | ||
12 | #define CPUID_EXT_PFR1 "c1, 1" | ||
13 | #define CPUID_EXT_DFR0 "c1, 2" | ||
14 | #define CPUID_EXT_AFR0 "c1, 3" | ||
15 | #define CPUID_EXT_MMFR0 "c1, 4" | ||
16 | #define CPUID_EXT_MMFR1 "c1, 5" | ||
17 | #define CPUID_EXT_MMFR2 "c1, 6" | ||
18 | #define CPUID_EXT_MMFR3 "c1, 7" | ||
19 | #define CPUID_EXT_ISAR0 "c2, 0" | ||
20 | #define CPUID_EXT_ISAR1 "c2, 1" | ||
21 | #define CPUID_EXT_ISAR2 "c2, 2" | ||
22 | #define CPUID_EXT_ISAR3 "c2, 3" | ||
23 | #define CPUID_EXT_ISAR4 "c2, 4" | ||
24 | #define CPUID_EXT_ISAR5 "c2, 5" | ||
25 | |||
11 | #ifdef CONFIG_CPU_CP15 | 26 | #ifdef CONFIG_CPU_CP15 |
12 | #define read_cpuid(reg) \ | 27 | #define read_cpuid(reg) \ |
13 | ({ \ | 28 | ({ \ |
@@ -18,9 +33,19 @@ | |||
18 | : "cc"); \ | 33 | : "cc"); \ |
19 | __val; \ | 34 | __val; \ |
20 | }) | 35 | }) |
36 | #define read_cpuid_ext(ext_reg) \ | ||
37 | ({ \ | ||
38 | unsigned int __val; \ | ||
39 | asm("mrc p15, 0, %0, c0, " ext_reg \ | ||
40 | : "=r" (__val) \ | ||
41 | : \ | ||
42 | : "cc"); \ | ||
43 | __val; \ | ||
44 | }) | ||
21 | #else | 45 | #else |
22 | extern unsigned int processor_id; | 46 | extern unsigned int processor_id; |
23 | #define read_cpuid(reg) (processor_id) | 47 | #define read_cpuid(reg) (processor_id) |
48 | #define read_cpuid_ext(reg) 0 | ||
24 | #endif | 49 | #endif |
25 | 50 | ||
26 | /* | 51 | /* |
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index a62218013c78..c964f3fc3bc5 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h | |||
@@ -40,6 +40,12 @@ | |||
40 | #define TLB_V6_I_ASID (1 << 18) | 40 | #define TLB_V6_I_ASID (1 << 18) |
41 | 41 | ||
42 | #define TLB_BTB (1 << 28) | 42 | #define TLB_BTB (1 << 28) |
43 | |||
44 | /* Unified Inner Shareable TLB operations (ARMv7 MP extensions) */ | ||
45 | #define TLB_V7_UIS_PAGE (1 << 19) | ||
46 | #define TLB_V7_UIS_FULL (1 << 20) | ||
47 | #define TLB_V7_UIS_ASID (1 << 21) | ||
48 | |||
43 | #define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */ | 49 | #define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */ |
44 | #define TLB_DCLEAN (1 << 30) | 50 | #define TLB_DCLEAN (1 << 30) |
45 | #define TLB_WB (1 << 31) | 51 | #define TLB_WB (1 << 31) |
@@ -176,9 +182,17 @@ | |||
176 | # define v6wbi_always_flags (-1UL) | 182 | # define v6wbi_always_flags (-1UL) |
177 | #endif | 183 | #endif |
178 | 184 | ||
185 | #ifdef CONFIG_SMP | ||
186 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ | ||
187 | TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID) | ||
188 | #else | ||
189 | #define v7wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BTB | \ | ||
190 | TLB_V6_U_FULL | TLB_V6_U_PAGE | TLB_V6_U_ASID) | ||
191 | #endif | ||
192 | |||
179 | #ifdef CONFIG_CPU_TLB_V7 | 193 | #ifdef CONFIG_CPU_TLB_V7 |
180 | # define v7wbi_possible_flags v6wbi_tlb_flags | 194 | # define v7wbi_possible_flags v7wbi_tlb_flags |
181 | # define v7wbi_always_flags v6wbi_tlb_flags | 195 | # define v7wbi_always_flags v7wbi_tlb_flags |
182 | # ifdef _TLB | 196 | # ifdef _TLB |
183 | # define MULTI_TLB 1 | 197 | # define MULTI_TLB 1 |
184 | # else | 198 | # else |
@@ -316,6 +330,8 @@ static inline void local_flush_tlb_all(void) | |||
316 | asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc"); | 330 | asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc"); |
317 | if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL)) | 331 | if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL)) |
318 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); | 332 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); |
333 | if (tlb_flag(TLB_V7_UIS_FULL)) | ||
334 | asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc"); | ||
319 | 335 | ||
320 | if (tlb_flag(TLB_BTB)) { | 336 | if (tlb_flag(TLB_BTB)) { |
321 | /* flush the branch target cache */ | 337 | /* flush the branch target cache */ |
@@ -351,6 +367,8 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm) | |||
351 | asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc"); | 367 | asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc"); |
352 | if (tlb_flag(TLB_V6_I_ASID)) | 368 | if (tlb_flag(TLB_V6_I_ASID)) |
353 | asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc"); | 369 | asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc"); |
370 | if (tlb_flag(TLB_V7_UIS_ASID)) | ||
371 | asm("mcr p15, 0, %0, c8, c3, 2" : : "r" (asid) : "cc"); | ||
354 | 372 | ||
355 | if (tlb_flag(TLB_BTB)) { | 373 | if (tlb_flag(TLB_BTB)) { |
356 | /* flush the branch target cache */ | 374 | /* flush the branch target cache */ |
@@ -389,6 +407,8 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | |||
389 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc"); | 407 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc"); |
390 | if (tlb_flag(TLB_V6_I_PAGE)) | 408 | if (tlb_flag(TLB_V6_I_PAGE)) |
391 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc"); | 409 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc"); |
410 | if (tlb_flag(TLB_V7_UIS_PAGE)) | ||
411 | asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (uaddr) : "cc"); | ||
392 | 412 | ||
393 | if (tlb_flag(TLB_BTB)) { | 413 | if (tlb_flag(TLB_BTB)) { |
394 | /* flush the branch target cache */ | 414 | /* flush the branch target cache */ |
@@ -424,6 +444,8 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr) | |||
424 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc"); | 444 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc"); |
425 | if (tlb_flag(TLB_V6_I_PAGE)) | 445 | if (tlb_flag(TLB_V6_I_PAGE)) |
426 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc"); | 446 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc"); |
447 | if (tlb_flag(TLB_V7_UIS_PAGE)) | ||
448 | asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (kaddr) : "cc"); | ||
427 | 449 | ||
428 | if (tlb_flag(TLB_BTB)) { | 450 | if (tlb_flag(TLB_BTB)) { |
429 | /* flush the branch target cache */ | 451 | /* flush the branch target cache */ |