Commit 9a83c84c authored by Shaokun Zhang's avatar Shaokun Zhang Committed by Catalin Marinas

drivers: base: cacheinfo: Add variable to record max cache line size

Add coherency_max_size variable to record the maximum cache line size
for different cache levels. If it is available, we will synchronize
it as cache line size, otherwise we will use CTR_EL0.CWG reporting
in cache_line_size() for arm64.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarShaokun Zhang <zhangshaokun@hisilicon.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 6dcdefcd
...@@ -213,6 +213,8 @@ int __weak cache_setup_acpi(unsigned int cpu) ...@@ -213,6 +213,8 @@ int __weak cache_setup_acpi(unsigned int cpu)
return -ENOTSUPP; return -ENOTSUPP;
} }
unsigned int coherency_max_size;
static int cache_shared_cpu_map_setup(unsigned int cpu) static int cache_shared_cpu_map_setup(unsigned int cpu)
{ {
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
...@@ -251,6 +253,9 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) ...@@ -251,6 +253,9 @@ static int cache_shared_cpu_map_setup(unsigned int cpu)
cpumask_set_cpu(i, &this_leaf->shared_cpu_map); cpumask_set_cpu(i, &this_leaf->shared_cpu_map);
} }
} }
/* record the maximum cache line size */
if (this_leaf->coherency_line_size > coherency_max_size)
coherency_max_size = this_leaf->coherency_line_size;
} }
return 0; return 0;
......
...@@ -17,6 +17,8 @@ enum cache_type { ...@@ -17,6 +17,8 @@ enum cache_type {
CACHE_TYPE_UNIFIED = BIT(2), CACHE_TYPE_UNIFIED = BIT(2),
}; };
extern unsigned int coherency_max_size;
/** /**
* struct cacheinfo - represent a cache leaf node * struct cacheinfo - represent a cache leaf node
* @id: This cache's id. It is unique among caches with the same (type, level). * @id: This cache's id. It is unique among caches with the same (type, level).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment