@@ -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);
@@ -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)
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@linuxfoundation.org> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Signed-off-by: Rob Herring <robh@kernel.org> --- drivers/base/cacheinfo.c | 1 + include/linux/cacheinfo.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)