aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hao <haokexin@gmail.com>2013-08-06 06:23:30 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-14 00:56:06 -0400
commitabb29c3bb13c7b747fae18b9c63b660529ccc612 (patch)
tree7db47abfcb4fd1ed18fc8942aeffed6ce176e0e5
parentf13c13a005127b5dc5daaca190277a062d946e63 (diff)
powerpc: Move the testing of CPU_FTR_COHERENT_ICACHE into __flush_icache_range
In function flush_icache_range(), we use cpu_has_feature() to test the feature bit of CPU_FTR_COHERENT_ICACHE. But this seems not optimal for two reasons: a) For ppc32, the function __flush_icache_range() already do this check with the macro END_FTR_SECTION_IFSET. b) Compare with the cpu_has_feature(), the method of using macro END_FTR_SECTION_IFSET will not introduce any runtime overhead. [And while at it, add the missing required isync] -- BenH Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/cacheflush.h3
-rw-r--r--arch/powerpc/kernel/misc_32.S1
-rw-r--r--arch/powerpc/kernel/misc_64.S4
3 files changed, 5 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
index b843e35122e8..60b620d64ac9 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -35,8 +35,7 @@ extern void __flush_disable_L1(void);
35extern void __flush_icache_range(unsigned long, unsigned long); 35extern void __flush_icache_range(unsigned long, unsigned long);
36static inline void flush_icache_range(unsigned long start, unsigned long stop) 36static inline void flush_icache_range(unsigned long start, unsigned long stop)
37{ 37{
38 if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) 38 __flush_icache_range(start, stop);
39 __flush_icache_range(start, stop);
40} 39}
41 40
42extern void flush_icache_user_range(struct vm_area_struct *vma, 41extern void flush_icache_user_range(struct vm_area_struct *vma,
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index e469f30e6eeb..1722a2be66ca 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -329,6 +329,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE)
329 */ 329 */
330_KPROBE(__flush_icache_range) 330_KPROBE(__flush_icache_range)
331BEGIN_FTR_SECTION 331BEGIN_FTR_SECTION
332 isync
332 blr /* for 601, do nothing */ 333 blr /* for 601, do nothing */
333END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) 334END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
334 li r5,L1_CACHE_BYTES-1 335 li r5,L1_CACHE_BYTES-1
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 6820e45f557b..74d87f117566 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -68,7 +68,9 @@ PPC64_CACHES:
68 */ 68 */
69 69
70_KPROBE(__flush_icache_range) 70_KPROBE(__flush_icache_range)
71 71BEGIN_FTR_SECTION
72 blr
73END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
72/* 74/*
73 * Flush the data cache to memory 75 * Flush the data cache to memory
74 * 76 *