[ARM] fix VIPT/VIVT macro optimisations, add comments

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>

authored by Russell King and committed by Russell King daf93dd5 6cab4860

+13 -4
+13 -4
include/asm-arm/cacheflush.h
··· 459 459 #define __cacheid_vivt_asid_tagged_instr(val) (__cacheid_type_v7(val) ? ((val & (3 << 14)) == (1 << 14)) : 0) 460 460 461 461 #if defined(CONFIG_CPU_CACHE_VIVT) && !defined(CONFIG_CPU_CACHE_VIPT) 462 - 462 + /* 463 + * VIVT caches only 464 + */ 463 465 #define cache_is_vivt() 1 464 466 #define cache_is_vipt() 0 465 467 #define cache_is_vipt_nonaliasing() 0 466 468 #define cache_is_vipt_aliasing() 0 467 469 #define icache_is_vivt_asid_tagged() 0 468 470 469 - #elif defined(CONFIG_CPU_CACHE_VIPT) 470 - 471 + #elif !defined(CONFIG_CPU_CACHE_VIVT) && defined(CONFIG_CPU_CACHE_VIPT) 472 + /* 473 + * VIPT caches only 474 + */ 471 475 #define cache_is_vivt() 0 472 476 #define cache_is_vipt() 1 473 477 #define cache_is_vipt_nonaliasing() \ ··· 493 489 }) 494 490 495 491 #else 496 - 492 + /* 493 + * VIVT or VIPT caches. Note that this is unreliable since ARM926 494 + * and V6 CPUs satisfy the "(val & (15 << 25)) == (14 << 25)" test. 495 + * There's no way to tell from the CacheType register what type (!) 496 + * the cache is. 497 + */ 497 498 #define cache_is_vivt() \ 498 499 ({ \ 499 500 unsigned int __val = read_cpuid(CPUID_CACHETYPE); \