Skip to contentSkip to conversation

Patch "drivers: base: cacheinfo: fix cache type for non-architected system cache" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Jan 1, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drivers: base: cacheinfo: fix cache type for non-architected system cache

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drivers-base-cacheinfo-fix-cache-type-for-non-architected-system-cache.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From f57ab9a01a36ef3454333251cc57e3a9948b17bf Mon Sep 17 00:00:00 2001

From: Sudeep Holla <[email protected]>
Date: Fri, 17 Nov 2017 11:56:41 +0000
Subject: drivers: base: cacheinfo: fix cache type for non-architected system cache

From: Sudeep Holla <[email protected]>

commit f57ab9a01a36ef3454333251cc57e3a9948b17bf upstream.

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 <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/base/cacheinfo.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/base/cacheinfo.c +13 -0
@@ -186,6 +186,11 @@ static void cache_associativity(struct c
 		this_leaf->ways_of_associativity = (size / nr_sets) / line_size;
 }
 
+static bool cache_node_is_unified(struct cacheinfo *this_leaf)
+{
+	return of_property_read_bool(this_leaf->of_node, "cache-unified");
+}
+
 static void cache_of_override_properties(unsigned int cpu)
 {
 	int index;
@@ -194,6 +199,14 @@ static void cache_of_override_properties
 
 	for (index = 0; index < cache_leaves(cpu); index++) {
 		this_leaf = this_cpu_ci->info_list + index;
+		/*
+		 * init_cache_level must setup the cache level correctly
+		 * overriding the architecturally specified levels, so
+		 * if type is NONE at this stage, it should be unified
+		 */
+		if (this_leaf->type == CACHE_TYPE_NOCACHE &&
+		    cache_node_is_unified(this_leaf))
+			this_leaf->type = CACHE_TYPE_UNIFIED;
 		cache_size(this_leaf);
 		cache_get_line_size(this_leaf);
 		cache_nr_sets(this_leaf);

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/drivers-base-cacheinfo-fix-cache-type-for-non-architected-system-cache.patch