]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled
authorSudeep Holla <sudeep.holla@arm.com>
Fri, 28 Oct 2016 08:45:28 +0000 (09:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2016 16:30:53 +0000 (17:30 +0100)
With CONFIG_OF enabled on x86, we get the following error on boot:
"
Failed to find cpu0 device node
  Unable to detect cache hierarchy from DT for CPU 0
"
and the cacheinfo fails to get populated in the corresponding sysfs
entries. This is because cache_setup_of_node looks for of_node for
setting up the shared cpu_map without checking that it's already
populated in the architecture specific callback.

In order to indicate that the shared cpu_map is already populated, this
patch introduces a boolean `cpu_map_populated` in struct cpu_cacheinfo
that can be used by the generic code to skip cache_shared_cpu_map_setup.

This patch also sets that boolean for x86.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/intel_cacheinfo.c
drivers/base/cacheinfo.c
include/linux/cacheinfo.h

index de6626c18e427b771ea902451ae77ab52e233915..be633715650212059e8a67eb7a4974b188d5e076 100644 (file)
@@ -934,6 +934,8 @@ static int __populate_cache_leaves(unsigned int cpu)
                ci_leaf_init(this_leaf++, &id4_regs);
                __cache_cpumap_setup(cpu, idx, &id4_regs);
        }
+       this_cpu_ci->cpu_map_populated = true;
+
        return 0;
 }
 
index e9fd32e91668992e478f31423c1e56be0724e1d2..ecde8957835ad1816223acb2f37479ca87469992 100644 (file)
@@ -106,6 +106,9 @@ static int cache_shared_cpu_map_setup(unsigned int cpu)
        unsigned int index;
        int ret;
 
+       if (this_cpu_ci->cpu_map_populated)
+               return 0;
+
        ret = cache_setup_of_node(cpu);
        if (ret)
                return ret;
index 2189935075b48e3d5b06012f9279f6eea4973fa7..a951fd10aaaad07cf7ab897615a4e3d84caf6a42 100644 (file)
@@ -71,6 +71,7 @@ struct cpu_cacheinfo {
        struct cacheinfo *info_list;
        unsigned int num_levels;
        unsigned int num_leaves;
+       bool cpu_map_populated;
 };
 
 /*