]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] fix VIPT/VIVT macro optimisations, add comments
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Sun, 27 Jul 2008 09:10:58 +0000 (10:10 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 27 Jul 2008 09:10:58 +0000 (10:10 +0100)
cacheflush.h was doing:

... VIVT only stuff
... VIPT only stuff
... VIVT or VIPT stuff

which is clearly bogus - we would only ever use the "VIVT or VIPT" case
when both VIVT and VIPT are not selected.  Fix this.

Add comments to each case, including noting the impossibility of
correctly detecting the cache type of ARM926 and ARMv6 cores from
the cache type register in the "VIVT or VIPT" case.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
include/asm-arm/cacheflush.h

index 03cf1ee977b7e2a39bb32c9bcd296d0c1c95cb25..e68a1cbcc85209d99fa3a927bb40cb6727690e02 100644 (file)
@@ -459,15 +459,19 @@ static inline void flush_ioremap_region(unsigned long phys, void __iomem *virt,
 #define __cacheid_vivt_asid_tagged_instr(val)  (__cacheid_type_v7(val) ? ((val & (3 << 14)) == (1 << 14)) : 0)
 
 #if defined(CONFIG_CPU_CACHE_VIVT) && !defined(CONFIG_CPU_CACHE_VIPT)
-
+/*
+ * VIVT caches only
+ */
 #define cache_is_vivt()                        1
 #define cache_is_vipt()                        0
 #define cache_is_vipt_nonaliasing()    0
 #define cache_is_vipt_aliasing()       0
 #define icache_is_vivt_asid_tagged()   0
 
-#elif defined(CONFIG_CPU_CACHE_VIPT)
-
+#elif !defined(CONFIG_CPU_CACHE_VIVT) && defined(CONFIG_CPU_CACHE_VIPT)
+/*
+ * VIPT caches only
+ */
 #define cache_is_vivt()                        0
 #define cache_is_vipt()                        1
 #define cache_is_vipt_nonaliasing()                                    \
@@ -489,7 +493,12 @@ static inline void flush_ioremap_region(unsigned long phys, void __iomem *virt,
        })
 
 #else
-
+/*
+ * VIVT or VIPT caches.  Note that this is unreliable since ARM926
+ * and V6 CPUs satisfy the "(val & (15 << 25)) == (14 << 25)" test.
+ * There's no way to tell from the CacheType register what type (!)
+ * the cache is.
+ */
 #define cache_is_vivt()                                                        \
        ({                                                              \
                unsigned int __val = read_cpuid(CPUID_CACHETYPE);       \