diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-09-21 05:05:20 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2007-09-21 05:05:20 -0400 |
commit | 7ec9d6f8c0e6932d380da1964021fbebf2311f04 (patch) | |
tree | 9c2711e32669db4278eb063818c41355a58049c6 /arch | |
parent | 2d4a73d5b91528322631830784f4eb7897fb5e41 (diff) |
sh: Avoid smp_processor_id() in cache desc paths.
current_cpu_data uses smp_processor_id() in order to find the
corresponding cpu_data. As the cache descs are all currently
identical, just have this look at probed results from the boot
CPU.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/mm/cache-sh4.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index 86486326ef1d..bbc226469aa1 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -54,21 +54,21 @@ static void __init emit_cache_params(void) | |||
54 | ctrl_inl(CCN_CVR), | 54 | ctrl_inl(CCN_CVR), |
55 | ctrl_inl(CCN_PRR)); | 55 | ctrl_inl(CCN_PRR)); |
56 | printk("I-cache : n_ways=%d n_sets=%d way_incr=%d\n", | 56 | printk("I-cache : n_ways=%d n_sets=%d way_incr=%d\n", |
57 | current_cpu_data.icache.ways, | 57 | boot_cpu_data.icache.ways, |
58 | current_cpu_data.icache.sets, | 58 | boot_cpu_data.icache.sets, |
59 | current_cpu_data.icache.way_incr); | 59 | boot_cpu_data.icache.way_incr); |
60 | printk("I-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n", | 60 | printk("I-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n", |
61 | current_cpu_data.icache.entry_mask, | 61 | boot_cpu_data.icache.entry_mask, |
62 | current_cpu_data.icache.alias_mask, | 62 | boot_cpu_data.icache.alias_mask, |
63 | current_cpu_data.icache.n_aliases); | 63 | boot_cpu_data.icache.n_aliases); |
64 | printk("D-cache : n_ways=%d n_sets=%d way_incr=%d\n", | 64 | printk("D-cache : n_ways=%d n_sets=%d way_incr=%d\n", |
65 | current_cpu_data.dcache.ways, | 65 | boot_cpu_data.dcache.ways, |
66 | current_cpu_data.dcache.sets, | 66 | boot_cpu_data.dcache.sets, |
67 | current_cpu_data.dcache.way_incr); | 67 | boot_cpu_data.dcache.way_incr); |
68 | printk("D-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n", | 68 | printk("D-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n", |
69 | current_cpu_data.dcache.entry_mask, | 69 | boot_cpu_data.dcache.entry_mask, |
70 | current_cpu_data.dcache.alias_mask, | 70 | boot_cpu_data.dcache.alias_mask, |
71 | current_cpu_data.dcache.n_aliases); | 71 | boot_cpu_data.dcache.n_aliases); |
72 | 72 | ||
73 | if (!__flush_dcache_segment_fn) | 73 | if (!__flush_dcache_segment_fn) |
74 | panic("unknown number of cache ways\n"); | 74 | panic("unknown number of cache ways\n"); |
@@ -79,10 +79,10 @@ static void __init emit_cache_params(void) | |||
79 | */ | 79 | */ |
80 | void __init p3_cache_init(void) | 80 | void __init p3_cache_init(void) |
81 | { | 81 | { |
82 | compute_alias(¤t_cpu_data.icache); | 82 | compute_alias(&boot_cpu_data.icache); |
83 | compute_alias(¤t_cpu_data.dcache); | 83 | compute_alias(&boot_cpu_data.dcache); |
84 | 84 | ||
85 | switch (current_cpu_data.dcache.ways) { | 85 | switch (boot_cpu_data.dcache.ways) { |
86 | case 1: | 86 | case 1: |
87 | __flush_dcache_segment_fn = __flush_dcache_segment_1way; | 87 | __flush_dcache_segment_fn = __flush_dcache_segment_1way; |
88 | break; | 88 | break; |
@@ -187,13 +187,13 @@ void flush_cache_sigtramp(unsigned long addr) | |||
187 | : "m" (__m(v))); | 187 | : "m" (__m(v))); |
188 | 188 | ||
189 | index = CACHE_IC_ADDRESS_ARRAY | | 189 | index = CACHE_IC_ADDRESS_ARRAY | |
190 | (v & current_cpu_data.icache.entry_mask); | 190 | (v & boot_cpu_data.icache.entry_mask); |
191 | 191 | ||
192 | local_irq_save(flags); | 192 | local_irq_save(flags); |
193 | jump_to_P2(); | 193 | jump_to_P2(); |
194 | 194 | ||
195 | for (i = 0; i < current_cpu_data.icache.ways; | 195 | for (i = 0; i < boot_cpu_data.icache.ways; |
196 | i++, index += current_cpu_data.icache.way_incr) | 196 | i++, index += boot_cpu_data.icache.way_incr) |
197 | ctrl_outl(0, index); /* Clear out Valid-bit */ | 197 | ctrl_outl(0, index); /* Clear out Valid-bit */ |
198 | 198 | ||
199 | back_to_P1(); | 199 | back_to_P1(); |
@@ -210,7 +210,7 @@ static inline void flush_cache_4096(unsigned long start, | |||
210 | * All types of SH-4 require PC to be in P2 to operate on the I-cache. | 210 | * All types of SH-4 require PC to be in P2 to operate on the I-cache. |
211 | * Some types of SH-4 require PC to be in P2 to operate on the D-cache. | 211 | * Some types of SH-4 require PC to be in P2 to operate on the D-cache. |
212 | */ | 212 | */ |
213 | if ((current_cpu_data.flags & CPU_HAS_P2_FLUSH_BUG) || | 213 | if ((boot_cpu_data.flags & CPU_HAS_P2_FLUSH_BUG) || |
214 | (start < CACHE_OC_ADDRESS_ARRAY)) | 214 | (start < CACHE_OC_ADDRESS_ARRAY)) |
215 | exec_offset = 0x20000000; | 215 | exec_offset = 0x20000000; |
216 | 216 | ||
@@ -232,7 +232,7 @@ void flush_dcache_page(struct page *page) | |||
232 | int i, n; | 232 | int i, n; |
233 | 233 | ||
234 | /* Loop all the D-cache */ | 234 | /* Loop all the D-cache */ |
235 | n = current_cpu_data.dcache.n_aliases; | 235 | n = boot_cpu_data.dcache.n_aliases; |
236 | for (i = 0; i < n; i++, addr += 4096) | 236 | for (i = 0; i < n; i++, addr += 4096) |
237 | flush_cache_4096(addr, phys); | 237 | flush_cache_4096(addr, phys); |
238 | } | 238 | } |
@@ -264,7 +264,7 @@ static inline void flush_icache_all(void) | |||
264 | 264 | ||
265 | void flush_dcache_all(void) | 265 | void flush_dcache_all(void) |
266 | { | 266 | { |
267 | (*__flush_dcache_segment_fn)(0UL, current_cpu_data.dcache.way_size); | 267 | (*__flush_dcache_segment_fn)(0UL, boot_cpu_data.dcache.way_size); |
268 | wmb(); | 268 | wmb(); |
269 | } | 269 | } |
270 | 270 | ||
@@ -278,8 +278,8 @@ static void __flush_cache_mm(struct mm_struct *mm, unsigned long start, | |||
278 | unsigned long end) | 278 | unsigned long end) |
279 | { | 279 | { |
280 | unsigned long d = 0, p = start & PAGE_MASK; | 280 | unsigned long d = 0, p = start & PAGE_MASK; |
281 | unsigned long alias_mask = current_cpu_data.dcache.alias_mask; | 281 | unsigned long alias_mask = boot_cpu_data.dcache.alias_mask; |
282 | unsigned long n_aliases = current_cpu_data.dcache.n_aliases; | 282 | unsigned long n_aliases = boot_cpu_data.dcache.n_aliases; |
283 | unsigned long select_bit; | 283 | unsigned long select_bit; |
284 | unsigned long all_aliases_mask; | 284 | unsigned long all_aliases_mask; |
285 | unsigned long addr_offset; | 285 | unsigned long addr_offset; |
@@ -366,7 +366,7 @@ void flush_cache_mm(struct mm_struct *mm) | |||
366 | * If cache is only 4k-per-way, there are never any 'aliases'. Since | 366 | * If cache is only 4k-per-way, there are never any 'aliases'. Since |
367 | * the cache is physically tagged, the data can just be left in there. | 367 | * the cache is physically tagged, the data can just be left in there. |
368 | */ | 368 | */ |
369 | if (current_cpu_data.dcache.n_aliases == 0) | 369 | if (boot_cpu_data.dcache.n_aliases == 0) |
370 | return; | 370 | return; |
371 | 371 | ||
372 | /* | 372 | /* |
@@ -403,7 +403,7 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long address, | |||
403 | unsigned long phys = pfn << PAGE_SHIFT; | 403 | unsigned long phys = pfn << PAGE_SHIFT; |
404 | unsigned int alias_mask; | 404 | unsigned int alias_mask; |
405 | 405 | ||
406 | alias_mask = current_cpu_data.dcache.alias_mask; | 406 | alias_mask = boot_cpu_data.dcache.alias_mask; |
407 | 407 | ||
408 | /* We only need to flush D-cache when we have alias */ | 408 | /* We only need to flush D-cache when we have alias */ |
409 | if ((address^phys) & alias_mask) { | 409 | if ((address^phys) & alias_mask) { |
@@ -417,7 +417,7 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long address, | |||
417 | phys); | 417 | phys); |
418 | } | 418 | } |
419 | 419 | ||
420 | alias_mask = current_cpu_data.icache.alias_mask; | 420 | alias_mask = boot_cpu_data.icache.alias_mask; |
421 | if (vma->vm_flags & VM_EXEC) { | 421 | if (vma->vm_flags & VM_EXEC) { |
422 | /* | 422 | /* |
423 | * Evict entries from the portion of the cache from which code | 423 | * Evict entries from the portion of the cache from which code |
@@ -449,7 +449,7 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | |||
449 | * If cache is only 4k-per-way, there are never any 'aliases'. Since | 449 | * If cache is only 4k-per-way, there are never any 'aliases'. Since |
450 | * the cache is physically tagged, the data can just be left in there. | 450 | * the cache is physically tagged, the data can just be left in there. |
451 | */ | 451 | */ |
452 | if (current_cpu_data.dcache.n_aliases == 0) | 452 | if (boot_cpu_data.dcache.n_aliases == 0) |
453 | return; | 453 | return; |
454 | 454 | ||
455 | /* | 455 | /* |
@@ -510,7 +510,7 @@ static void __flush_cache_4096(unsigned long addr, unsigned long phys, | |||
510 | unsigned long a, ea, p; | 510 | unsigned long a, ea, p; |
511 | unsigned long temp_pc; | 511 | unsigned long temp_pc; |
512 | 512 | ||
513 | dcache = ¤t_cpu_data.dcache; | 513 | dcache = &boot_cpu_data.dcache; |
514 | /* Write this way for better assembly. */ | 514 | /* Write this way for better assembly. */ |
515 | way_count = dcache->ways; | 515 | way_count = dcache->ways; |
516 | way_incr = dcache->way_incr; | 516 | way_incr = dcache->way_incr; |
@@ -585,7 +585,7 @@ static void __flush_dcache_segment_1way(unsigned long start, | |||
585 | base_addr = ((base_addr >> 16) << 16); | 585 | base_addr = ((base_addr >> 16) << 16); |
586 | base_addr |= start; | 586 | base_addr |= start; |
587 | 587 | ||
588 | dcache = ¤t_cpu_data.dcache; | 588 | dcache = &boot_cpu_data.dcache; |
589 | linesz = dcache->linesz; | 589 | linesz = dcache->linesz; |
590 | way_incr = dcache->way_incr; | 590 | way_incr = dcache->way_incr; |
591 | way_size = dcache->way_size; | 591 | way_size = dcache->way_size; |
@@ -627,7 +627,7 @@ static void __flush_dcache_segment_2way(unsigned long start, | |||
627 | base_addr = ((base_addr >> 16) << 16); | 627 | base_addr = ((base_addr >> 16) << 16); |
628 | base_addr |= start; | 628 | base_addr |= start; |
629 | 629 | ||
630 | dcache = ¤t_cpu_data.dcache; | 630 | dcache = &boot_cpu_data.dcache; |
631 | linesz = dcache->linesz; | 631 | linesz = dcache->linesz; |
632 | way_incr = dcache->way_incr; | 632 | way_incr = dcache->way_incr; |
633 | way_size = dcache->way_size; | 633 | way_size = dcache->way_size; |
@@ -686,7 +686,7 @@ static void __flush_dcache_segment_4way(unsigned long start, | |||
686 | base_addr = ((base_addr >> 16) << 16); | 686 | base_addr = ((base_addr >> 16) << 16); |
687 | base_addr |= start; | 687 | base_addr |= start; |
688 | 688 | ||
689 | dcache = ¤t_cpu_data.dcache; | 689 | dcache = &boot_cpu_data.dcache; |
690 | linesz = dcache->linesz; | 690 | linesz = dcache->linesz; |
691 | way_incr = dcache->way_incr; | 691 | way_incr = dcache->way_incr; |
692 | way_size = dcache->way_size; | 692 | way_size = dcache->way_size; |