diff options
author | Sudeep Holla <sudeep.holla@arm.com> | 2016-10-28 04:45:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-10 11:30:53 -0500 |
commit | fac51482577d5e05bbb0efa8d602a3c2111098bf (patch) | |
tree | 0cd98898970e87486aab524e09a080231aa2bf7a | |
parent | 79543cf2b18ea4a35f8864849d7ad8882ea8a23d (diff) |
drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled
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>
-rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 2 | ||||
-rw-r--r-- | drivers/base/cacheinfo.c | 3 | ||||
-rw-r--r-- | include/linux/cacheinfo.h | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index de6626c18e42..be6337156502 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -934,6 +934,8 @@ static int __populate_cache_leaves(unsigned int cpu) | |||
934 | ci_leaf_init(this_leaf++, &id4_regs); | 934 | ci_leaf_init(this_leaf++, &id4_regs); |
935 | __cache_cpumap_setup(cpu, idx, &id4_regs); | 935 | __cache_cpumap_setup(cpu, idx, &id4_regs); |
936 | } | 936 | } |
937 | this_cpu_ci->cpu_map_populated = true; | ||
938 | |||
937 | return 0; | 939 | return 0; |
938 | } | 940 | } |
939 | 941 | ||
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index e9fd32e91668..ecde8957835a 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c | |||
@@ -106,6 +106,9 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) | |||
106 | unsigned int index; | 106 | unsigned int index; |
107 | int ret; | 107 | int ret; |
108 | 108 | ||
109 | if (this_cpu_ci->cpu_map_populated) | ||
110 | return 0; | ||
111 | |||
109 | ret = cache_setup_of_node(cpu); | 112 | ret = cache_setup_of_node(cpu); |
110 | if (ret) | 113 | if (ret) |
111 | return ret; | 114 | return ret; |
diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 2189935075b4..a951fd10aaaa 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h | |||
@@ -71,6 +71,7 @@ struct cpu_cacheinfo { | |||
71 | struct cacheinfo *info_list; | 71 | struct cacheinfo *info_list; |
72 | unsigned int num_levels; | 72 | unsigned int num_levels; |
73 | unsigned int num_leaves; | 73 | unsigned int num_leaves; |
74 | bool cpu_map_populated; | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | /* | 77 | /* |