summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/cpuinfo.c
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2017-03-10 20:32:20 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2017-03-20 16:16:51 +0000
commit3689c75af2a3bc944826e6da663deee50c97d910 (patch)
tree7832e0c0ba8bb513fde7d59cc3e461d0ea2841a8 /arch/arm64/kernel/cpuinfo.c
parent97da3854c526d3a6ee05c849c96e48d21527606c (diff)
downloadlinux-stable-3689c75af2a3bc944826e6da663deee50c97d910.tar.gz
linux-stable-3689c75af2a3bc944826e6da663deee50c97d910.tar.bz2
linux-stable-3689c75af2a3bc944826e6da663deee50c97d910.zip
arm64: cpuinfo: remove I-cache VIPT aliasing detection
The CCSIDR_EL1.{NumSets,Associativity,LineSize} fields are only for use in conjunction with set/way cache maintenance and are not guaranteed to represent the actual microarchitectural features of a design. The architecture explicitly states: | You cannot make any inference about the actual sizes of caches based | on these parameters. We currently use these fields to determine whether or the I-cache is aliasing, which is bogus and known to break on some platforms. Instead, assume the I-cache is always aliasing if it advertises a VIPT policy. Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/cpuinfo.c')
-rw-r--r--arch/arm64/kernel/cpuinfo.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 5b22c687f02a..155ddd8ad56a 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -289,20 +289,17 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
unsigned int cpu = smp_processor_id();
u32 l1ip = CTR_L1IP(info->reg_ctr);
- if (l1ip != ICACHE_POLICY_PIPT) {
- /*
- * VIPT caches are non-aliasing if the VA always equals the PA
- * in all bit positions that are covered by the index. This is
- * the case if the size of a way (# of sets * line size) does
- * not exceed PAGE_SIZE.
- */
- u32 waysize = icache_get_numsets() * icache_get_linesize();
-
- if (l1ip != ICACHE_POLICY_VIPT || waysize > PAGE_SIZE)
- set_bit(ICACHEF_ALIASING, &__icache_flags);
- }
- if (l1ip == ICACHE_POLICY_AIVIVT)
+ switch (l1ip) {
+ case ICACHE_POLICY_PIPT:
+ break;
+ default:
+ case ICACHE_POLICY_AIVIVT:
set_bit(ICACHEF_AIVIVT, &__icache_flags);
+ /* Fallthrough */
+ case ICACHE_POLICY_VIPT:
+ /* Assume aliasing */
+ set_bit(ICACHEF_ALIASING, &__icache_flags);
+ }
pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu);
}