diff options
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r-- | arch/arm/kernel/setup.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index e514c76043b4..3fe93f75b55a 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
31 | #include <linux/memblock.h> | 31 | #include <linux/memblock.h> |
32 | #include <linux/bug.h> | ||
33 | #include <linux/compiler.h> | ||
32 | 34 | ||
33 | #include <asm/unified.h> | 35 | #include <asm/unified.h> |
34 | #include <asm/cpu.h> | 36 | #include <asm/cpu.h> |
@@ -42,6 +44,7 @@ | |||
42 | #include <asm/cacheflush.h> | 44 | #include <asm/cacheflush.h> |
43 | #include <asm/cachetype.h> | 45 | #include <asm/cachetype.h> |
44 | #include <asm/tlbflush.h> | 46 | #include <asm/tlbflush.h> |
47 | #include <asm/system.h> | ||
45 | 48 | ||
46 | #include <asm/prom.h> | 49 | #include <asm/prom.h> |
47 | #include <asm/mach/arch.h> | 50 | #include <asm/mach/arch.h> |
@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly; | |||
115 | EXPORT_SYMBOL(outer_cache); | 118 | EXPORT_SYMBOL(outer_cache); |
116 | #endif | 119 | #endif |
117 | 120 | ||
121 | /* | ||
122 | * Cached cpu_architecture() result for use by assembler code. | ||
123 | * C code should use the cpu_architecture() function instead of accessing this | ||
124 | * variable directly. | ||
125 | */ | ||
126 | int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN; | ||
127 | |||
118 | struct stack { | 128 | struct stack { |
119 | u32 irq[3]; | 129 | u32 irq[3]; |
120 | u32 abt[3]; | 130 | u32 abt[3]; |
@@ -210,7 +220,7 @@ static const char *proc_arch[] = { | |||
210 | "?(17)", | 220 | "?(17)", |
211 | }; | 221 | }; |
212 | 222 | ||
213 | int cpu_architecture(void) | 223 | static int __get_cpu_architecture(void) |
214 | { | 224 | { |
215 | int cpu_arch; | 225 | int cpu_arch; |
216 | 226 | ||
@@ -243,11 +253,22 @@ int cpu_architecture(void) | |||
243 | return cpu_arch; | 253 | return cpu_arch; |
244 | } | 254 | } |
245 | 255 | ||
256 | int __pure cpu_architecture(void) | ||
257 | { | ||
258 | BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN); | ||
259 | |||
260 | return __cpu_architecture; | ||
261 | } | ||
262 | |||
246 | static int cpu_has_aliasing_icache(unsigned int arch) | 263 | static int cpu_has_aliasing_icache(unsigned int arch) |
247 | { | 264 | { |
248 | int aliasing_icache; | 265 | int aliasing_icache; |
249 | unsigned int id_reg, num_sets, line_size; | 266 | unsigned int id_reg, num_sets, line_size; |
250 | 267 | ||
268 | /* PIPT caches never alias. */ | ||
269 | if (icache_is_pipt()) | ||
270 | return 0; | ||
271 | |||
251 | /* arch specifies the register format */ | 272 | /* arch specifies the register format */ |
252 | switch (arch) { | 273 | switch (arch) { |
253 | case CPU_ARCH_ARMv7: | 274 | case CPU_ARCH_ARMv7: |
@@ -282,8 +303,14 @@ static void __init cacheid_init(void) | |||
282 | /* ARMv7 register format */ | 303 | /* ARMv7 register format */ |
283 | arch = CPU_ARCH_ARMv7; | 304 | arch = CPU_ARCH_ARMv7; |
284 | cacheid = CACHEID_VIPT_NONALIASING; | 305 | cacheid = CACHEID_VIPT_NONALIASING; |
285 | if ((cachetype & (3 << 14)) == 1 << 14) | 306 | switch (cachetype & (3 << 14)) { |
307 | case (1 << 14): | ||
286 | cacheid |= CACHEID_ASID_TAGGED; | 308 | cacheid |= CACHEID_ASID_TAGGED; |
309 | break; | ||
310 | case (3 << 14): | ||
311 | cacheid |= CACHEID_PIPT; | ||
312 | break; | ||
313 | } | ||
287 | } else { | 314 | } else { |
288 | arch = CPU_ARCH_ARMv6; | 315 | arch = CPU_ARCH_ARMv6; |
289 | if (cachetype & (1 << 23)) | 316 | if (cachetype & (1 << 23)) |
@@ -300,10 +327,11 @@ static void __init cacheid_init(void) | |||
300 | printk("CPU: %s data cache, %s instruction cache\n", | 327 | printk("CPU: %s data cache, %s instruction cache\n", |
301 | cache_is_vivt() ? "VIVT" : | 328 | cache_is_vivt() ? "VIVT" : |
302 | cache_is_vipt_aliasing() ? "VIPT aliasing" : | 329 | cache_is_vipt_aliasing() ? "VIPT aliasing" : |
303 | cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown", | 330 | cache_is_vipt_nonaliasing() ? "PIPT / VIPT nonaliasing" : "unknown", |
304 | cache_is_vivt() ? "VIVT" : | 331 | cache_is_vivt() ? "VIVT" : |
305 | icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" : | 332 | icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" : |
306 | icache_is_vipt_aliasing() ? "VIPT aliasing" : | 333 | icache_is_vipt_aliasing() ? "VIPT aliasing" : |
334 | icache_is_pipt() ? "PIPT" : | ||
307 | cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown"); | 335 | cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown"); |
308 | } | 336 | } |
309 | 337 | ||
@@ -414,6 +442,7 @@ static void __init setup_processor(void) | |||
414 | } | 442 | } |
415 | 443 | ||
416 | cpu_name = list->cpu_name; | 444 | cpu_name = list->cpu_name; |
445 | __cpu_architecture = __get_cpu_architecture(); | ||
417 | 446 | ||
418 | #ifdef MULTI_CPU | 447 | #ifdef MULTI_CPU |
419 | processor = *list->proc; | 448 | processor = *list->proc; |
@@ -861,7 +890,7 @@ static struct machine_desc * __init setup_machine_tags(unsigned int nr) | |||
861 | } | 890 | } |
862 | 891 | ||
863 | if (mdesc->fixup) | 892 | if (mdesc->fixup) |
864 | mdesc->fixup(mdesc, tags, &from, &meminfo); | 893 | mdesc->fixup(tags, &from, &meminfo); |
865 | 894 | ||
866 | if (tags->hdr.tag == ATAG_CORE) { | 895 | if (tags->hdr.tag == ATAG_CORE) { |
867 | if (meminfo.nr_banks != 0) | 896 | if (meminfo.nr_banks != 0) |