[PATCH 3/6] cacheinfo: Add cpu_affinity_map to store affinity for all CPUs
Rob Herring
robh at kernel.org
Thu Dec 16 15:31:22 PST 2021
Currently, getting the cache CPU affinity for all possible CPUs requires
walking the DT or ACPI tables. As that is already done once (for each
CPU online event), let's save the affinity for possible CPUs so it can be
retrieved later.
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael at kernel.org>
Signed-off-by: Rob Herring <robh at kernel.org>
---
drivers/base/cacheinfo.c | 1 +
include/linux/cacheinfo.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index 21accddf8f5f..c9e5b48fac42 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -149,6 +149,7 @@ static void cache_of_set_id(struct cacheinfo *this_leaf, struct device_node *np)
id = of_get_cpu_hwid(cpu_node, 0);
while ((cache_node = of_find_next_cache_node(cache_node))) {
if (cache_node == np) {
+ cpumask_set_cpu(cpu, &this_leaf->cpu_affinity_map);
if (id < min_id) {
min_id = id;
of_node_put(cache_node);
diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h
index b2e7f3e40204..37652cfdd8dc 100644
--- a/include/linux/cacheinfo.h
+++ b/include/linux/cacheinfo.h
@@ -56,7 +56,8 @@ struct cacheinfo {
unsigned int ways_of_associativity;
unsigned int physical_line_partition;
unsigned int size;
- cpumask_t shared_cpu_map;
+ cpumask_t cpu_affinity_map; /* possible CPUs */
+ cpumask_t shared_cpu_map; /* online CPUs */
unsigned int attributes;
#define CACHE_WRITE_THROUGH BIT(0)
#define CACHE_WRITE_BACK BIT(1)
--
2.32.0
More information about the linux-arm-kernel
mailing list