aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorFelipe Cerqueira <felipec@mpi-sws.org>2013-02-11 12:10:50 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-08-07 03:46:40 -0400
commit77c2b05c943abc0dfdb7b55a3d1d4a1a3fc53dcd (patch)
treec057af839cafc5c1be80b565dea70767ed14b5b4 /arch/x86/kernel
parentee6ab6012870a6a3b60dc75560bb5118a37992d0 (diff)
Export x86 cache topology
This patch adds get_shared_cpu_map(), which allows the caller to infer which CPUs share a cache at a given level.
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 7c6f7d548c0f..033939ba4782 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -744,6 +744,23 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
744static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info); 744static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info);
745#define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y])) 745#define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y]))
746 746
747/* returns CPUs that share the index cache with cpu */
748int get_shared_cpu_map(cpumask_var_t mask, unsigned int cpu, int index)
749{
750 int ret = 0;
751 struct _cpuid4_info *this_leaf;
752
753 if (index >= num_cache_leaves) {
754 index = num_cache_leaves - 1;
755 ret = index;
756 }
757
758 this_leaf = CPUID4_INFO_IDX(cpu,index);
759 cpumask_copy(mask, to_cpumask(this_leaf->shared_cpu_map));
760
761 return ret;
762}
763
747#ifdef CONFIG_SMP 764#ifdef CONFIG_SMP
748 765
749static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index) 766static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)