summaryrefslogtreecommitdiffstats
path: root/drivers/base/cacheinfo.c
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2017-11-17 06:56:41 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-15 14:07:49 -0500
commitf57ab9a01a36ef3454333251cc57e3a9948b17bf (patch)
tree10fd0436002e5e6f384e2a8d808a25641a248392 /drivers/base/cacheinfo.c
parent50c4c4e268a2d7a3e58ebb698ac74da0de40ae36 (diff)
drivers: base: cacheinfo: fix cache type for non-architected system cache
Commit dfea747d2aba ("drivers: base: cacheinfo: support DT overrides for cache properties") doesn't initialise the cache type if it's present only in DT and the architecture is not aware of it. They are unified system level cache which are generally transparent. This patch check if the cache type is set to NOCACHE but the DT node indicates that it's unified cache and sets the cache type accordingly. Fixes: dfea747d2aba ("drivers: base: cacheinfo: support DT overrides for cache properties") Reported-and-tested-by: Tan Xiaojun <tanxiaojun@huawei.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/cacheinfo.c')
-rw-r--r--drivers/base/cacheinfo.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index eb3af2739537..07532d83be0b 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -186,6 +186,11 @@ static void cache_associativity(struct cacheinfo *this_leaf)
186 this_leaf->ways_of_associativity = (size / nr_sets) / line_size; 186 this_leaf->ways_of_associativity = (size / nr_sets) / line_size;
187} 187}
188 188
189static bool cache_node_is_unified(struct cacheinfo *this_leaf)
190{
191 return of_property_read_bool(this_leaf->of_node, "cache-unified");
192}
193
189static void cache_of_override_properties(unsigned int cpu) 194static void cache_of_override_properties(unsigned int cpu)
190{ 195{
191 int index; 196 int index;
@@ -194,6 +199,14 @@ static void cache_of_override_properties(unsigned int cpu)
194 199
195 for (index = 0; index < cache_leaves(cpu); index++) { 200 for (index = 0; index < cache_leaves(cpu); index++) {
196 this_leaf = this_cpu_ci->info_list + index; 201 this_leaf = this_cpu_ci->info_list + index;
202 /*
203 * init_cache_level must setup the cache level correctly
204 * overriding the architecturally specified levels, so
205 * if type is NONE at this stage, it should be unified
206 */
207 if (this_leaf->type == CACHE_TYPE_NOCACHE &&
208 cache_node_is_unified(this_leaf))
209 this_leaf->type = CACHE_TYPE_UNIFIED;
197 cache_size(this_leaf); 210 cache_size(this_leaf);
198 cache_get_line_size(this_leaf); 211 cache_get_line_size(this_leaf);
199 cache_nr_sets(this_leaf); 212 cache_nr_sets(this_leaf);