diff options
Diffstat (limited to 'arch/x86/kernel/cpu/intel_cacheinfo.c')
| -rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 8dc72dda66fe..1414c90feaba 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
| @@ -37,7 +37,7 @@ struct _cache_table { | |||
| 37 | /* All the cache descriptor types we care about (no TLB or | 37 | /* All the cache descriptor types we care about (no TLB or |
| 38 | trace cache entries) */ | 38 | trace cache entries) */ |
| 39 | 39 | ||
| 40 | static const struct _cache_table __cpuinitconst cache_table[] = | 40 | static const struct _cache_table cache_table[] = |
| 41 | { | 41 | { |
| 42 | { 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */ | 42 | { 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */ |
| 43 | { 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */ | 43 | { 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */ |
| @@ -203,7 +203,7 @@ union l3_cache { | |||
| 203 | unsigned val; | 203 | unsigned val; |
| 204 | }; | 204 | }; |
| 205 | 205 | ||
| 206 | static const unsigned short __cpuinitconst assocs[] = { | 206 | static const unsigned short assocs[] = { |
| 207 | [1] = 1, | 207 | [1] = 1, |
| 208 | [2] = 2, | 208 | [2] = 2, |
| 209 | [4] = 4, | 209 | [4] = 4, |
| @@ -217,10 +217,10 @@ static const unsigned short __cpuinitconst assocs[] = { | |||
| 217 | [0xf] = 0xffff /* fully associative - no way to show this currently */ | 217 | [0xf] = 0xffff /* fully associative - no way to show this currently */ |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| 220 | static const unsigned char __cpuinitconst levels[] = { 1, 1, 2, 3 }; | 220 | static const unsigned char levels[] = { 1, 1, 2, 3 }; |
| 221 | static const unsigned char __cpuinitconst types[] = { 1, 2, 3, 3 }; | 221 | static const unsigned char types[] = { 1, 2, 3, 3 }; |
| 222 | 222 | ||
| 223 | static void __cpuinit | 223 | static void |
| 224 | amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, | 224 | amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, |
| 225 | union _cpuid4_leaf_ebx *ebx, | 225 | union _cpuid4_leaf_ebx *ebx, |
| 226 | union _cpuid4_leaf_ecx *ecx) | 226 | union _cpuid4_leaf_ecx *ecx) |
| @@ -302,7 +302,7 @@ struct _cache_attr { | |||
| 302 | /* | 302 | /* |
| 303 | * L3 cache descriptors | 303 | * L3 cache descriptors |
| 304 | */ | 304 | */ |
| 305 | static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb) | 305 | static void amd_calc_l3_indices(struct amd_northbridge *nb) |
| 306 | { | 306 | { |
| 307 | struct amd_l3_cache *l3 = &nb->l3_cache; | 307 | struct amd_l3_cache *l3 = &nb->l3_cache; |
| 308 | unsigned int sc0, sc1, sc2, sc3; | 308 | unsigned int sc0, sc1, sc2, sc3; |
| @@ -325,7 +325,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb) | |||
| 325 | l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1; | 325 | l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1; |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index) | 328 | static void amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index) |
| 329 | { | 329 | { |
| 330 | int node; | 330 | int node; |
| 331 | 331 | ||
| @@ -528,8 +528,7 @@ static struct _cache_attr subcaches = | |||
| 528 | #endif /* CONFIG_AMD_NB && CONFIG_SYSFS */ | 528 | #endif /* CONFIG_AMD_NB && CONFIG_SYSFS */ |
| 529 | 529 | ||
| 530 | static int | 530 | static int |
| 531 | __cpuinit cpuid4_cache_lookup_regs(int index, | 531 | cpuid4_cache_lookup_regs(int index, struct _cpuid4_info_regs *this_leaf) |
| 532 | struct _cpuid4_info_regs *this_leaf) | ||
| 533 | { | 532 | { |
| 534 | union _cpuid4_leaf_eax eax; | 533 | union _cpuid4_leaf_eax eax; |
| 535 | union _cpuid4_leaf_ebx ebx; | 534 | union _cpuid4_leaf_ebx ebx; |
| @@ -560,7 +559,7 @@ __cpuinit cpuid4_cache_lookup_regs(int index, | |||
| 560 | return 0; | 559 | return 0; |
| 561 | } | 560 | } |
| 562 | 561 | ||
| 563 | static int __cpuinit find_num_cache_leaves(struct cpuinfo_x86 *c) | 562 | static int find_num_cache_leaves(struct cpuinfo_x86 *c) |
| 564 | { | 563 | { |
| 565 | unsigned int eax, ebx, ecx, edx, op; | 564 | unsigned int eax, ebx, ecx, edx, op; |
| 566 | union _cpuid4_leaf_eax cache_eax; | 565 | union _cpuid4_leaf_eax cache_eax; |
| @@ -580,7 +579,7 @@ static int __cpuinit find_num_cache_leaves(struct cpuinfo_x86 *c) | |||
| 580 | return i; | 579 | return i; |
| 581 | } | 580 | } |
| 582 | 581 | ||
| 583 | void __cpuinit init_amd_cacheinfo(struct cpuinfo_x86 *c) | 582 | void init_amd_cacheinfo(struct cpuinfo_x86 *c) |
| 584 | { | 583 | { |
| 585 | 584 | ||
| 586 | if (cpu_has_topoext) { | 585 | if (cpu_has_topoext) { |
| @@ -593,7 +592,7 @@ void __cpuinit init_amd_cacheinfo(struct cpuinfo_x86 *c) | |||
| 593 | } | 592 | } |
| 594 | } | 593 | } |
| 595 | 594 | ||
| 596 | unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | 595 | unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c) |
| 597 | { | 596 | { |
| 598 | /* Cache sizes */ | 597 | /* Cache sizes */ |
| 599 | unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; | 598 | unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; |
| @@ -744,7 +743,7 @@ static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info); | |||
| 744 | 743 | ||
| 745 | #ifdef CONFIG_SMP | 744 | #ifdef CONFIG_SMP |
| 746 | 745 | ||
| 747 | static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index) | 746 | static int cache_shared_amd_cpu_map_setup(unsigned int cpu, int index) |
| 748 | { | 747 | { |
| 749 | struct _cpuid4_info *this_leaf; | 748 | struct _cpuid4_info *this_leaf; |
| 750 | int i, sibling; | 749 | int i, sibling; |
| @@ -793,7 +792,7 @@ static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index) | |||
| 793 | return 1; | 792 | return 1; |
| 794 | } | 793 | } |
| 795 | 794 | ||
| 796 | static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | 795 | static void cache_shared_cpu_map_setup(unsigned int cpu, int index) |
| 797 | { | 796 | { |
| 798 | struct _cpuid4_info *this_leaf, *sibling_leaf; | 797 | struct _cpuid4_info *this_leaf, *sibling_leaf; |
| 799 | unsigned long num_threads_sharing; | 798 | unsigned long num_threads_sharing; |
| @@ -828,7 +827,7 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | |||
| 828 | } | 827 | } |
| 829 | } | 828 | } |
| 830 | } | 829 | } |
| 831 | static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) | 830 | static void cache_remove_shared_cpu_map(unsigned int cpu, int index) |
| 832 | { | 831 | { |
| 833 | struct _cpuid4_info *this_leaf, *sibling_leaf; | 832 | struct _cpuid4_info *this_leaf, *sibling_leaf; |
| 834 | int sibling; | 833 | int sibling; |
| @@ -841,16 +840,16 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) | |||
| 841 | } | 840 | } |
| 842 | } | 841 | } |
| 843 | #else | 842 | #else |
| 844 | static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | 843 | static void cache_shared_cpu_map_setup(unsigned int cpu, int index) |
| 845 | { | 844 | { |
| 846 | } | 845 | } |
| 847 | 846 | ||
| 848 | static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) | 847 | static void cache_remove_shared_cpu_map(unsigned int cpu, int index) |
| 849 | { | 848 | { |
| 850 | } | 849 | } |
| 851 | #endif | 850 | #endif |
| 852 | 851 | ||
| 853 | static void __cpuinit free_cache_attributes(unsigned int cpu) | 852 | static void free_cache_attributes(unsigned int cpu) |
| 854 | { | 853 | { |
| 855 | int i; | 854 | int i; |
| 856 | 855 | ||
| @@ -861,7 +860,7 @@ static void __cpuinit free_cache_attributes(unsigned int cpu) | |||
| 861 | per_cpu(ici_cpuid4_info, cpu) = NULL; | 860 | per_cpu(ici_cpuid4_info, cpu) = NULL; |
| 862 | } | 861 | } |
| 863 | 862 | ||
| 864 | static void __cpuinit get_cpu_leaves(void *_retval) | 863 | static void get_cpu_leaves(void *_retval) |
| 865 | { | 864 | { |
| 866 | int j, *retval = _retval, cpu = smp_processor_id(); | 865 | int j, *retval = _retval, cpu = smp_processor_id(); |
| 867 | 866 | ||
| @@ -881,7 +880,7 @@ static void __cpuinit get_cpu_leaves(void *_retval) | |||
| 881 | } | 880 | } |
| 882 | } | 881 | } |
| 883 | 882 | ||
| 884 | static int __cpuinit detect_cache_attributes(unsigned int cpu) | 883 | static int detect_cache_attributes(unsigned int cpu) |
| 885 | { | 884 | { |
| 886 | int retval; | 885 | int retval; |
| 887 | 886 | ||
| @@ -1015,7 +1014,7 @@ static struct attribute *default_attrs[] = { | |||
| 1015 | }; | 1014 | }; |
| 1016 | 1015 | ||
| 1017 | #ifdef CONFIG_AMD_NB | 1016 | #ifdef CONFIG_AMD_NB |
| 1018 | static struct attribute ** __cpuinit amd_l3_attrs(void) | 1017 | static struct attribute **amd_l3_attrs(void) |
| 1019 | { | 1018 | { |
| 1020 | static struct attribute **attrs; | 1019 | static struct attribute **attrs; |
| 1021 | int n; | 1020 | int n; |
| @@ -1091,7 +1090,7 @@ static struct kobj_type ktype_percpu_entry = { | |||
| 1091 | .sysfs_ops = &sysfs_ops, | 1090 | .sysfs_ops = &sysfs_ops, |
| 1092 | }; | 1091 | }; |
| 1093 | 1092 | ||
| 1094 | static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu) | 1093 | static void cpuid4_cache_sysfs_exit(unsigned int cpu) |
| 1095 | { | 1094 | { |
| 1096 | kfree(per_cpu(ici_cache_kobject, cpu)); | 1095 | kfree(per_cpu(ici_cache_kobject, cpu)); |
| 1097 | kfree(per_cpu(ici_index_kobject, cpu)); | 1096 | kfree(per_cpu(ici_index_kobject, cpu)); |
| @@ -1100,7 +1099,7 @@ static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu) | |||
| 1100 | free_cache_attributes(cpu); | 1099 | free_cache_attributes(cpu); |
| 1101 | } | 1100 | } |
| 1102 | 1101 | ||
| 1103 | static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu) | 1102 | static int cpuid4_cache_sysfs_init(unsigned int cpu) |
| 1104 | { | 1103 | { |
| 1105 | int err; | 1104 | int err; |
| 1106 | 1105 | ||
| @@ -1132,7 +1131,7 @@ err_out: | |||
| 1132 | static DECLARE_BITMAP(cache_dev_map, NR_CPUS); | 1131 | static DECLARE_BITMAP(cache_dev_map, NR_CPUS); |
| 1133 | 1132 | ||
| 1134 | /* Add/Remove cache interface for CPU device */ | 1133 | /* Add/Remove cache interface for CPU device */ |
| 1135 | static int __cpuinit cache_add_dev(struct device *dev) | 1134 | static int cache_add_dev(struct device *dev) |
| 1136 | { | 1135 | { |
| 1137 | unsigned int cpu = dev->id; | 1136 | unsigned int cpu = dev->id; |
| 1138 | unsigned long i, j; | 1137 | unsigned long i, j; |
| @@ -1183,7 +1182,7 @@ static int __cpuinit cache_add_dev(struct device *dev) | |||
| 1183 | return 0; | 1182 | return 0; |
| 1184 | } | 1183 | } |
| 1185 | 1184 | ||
| 1186 | static void __cpuinit cache_remove_dev(struct device *dev) | 1185 | static void cache_remove_dev(struct device *dev) |
| 1187 | { | 1186 | { |
| 1188 | unsigned int cpu = dev->id; | 1187 | unsigned int cpu = dev->id; |
| 1189 | unsigned long i; | 1188 | unsigned long i; |
| @@ -1200,8 +1199,8 @@ static void __cpuinit cache_remove_dev(struct device *dev) | |||
| 1200 | cpuid4_cache_sysfs_exit(cpu); | 1199 | cpuid4_cache_sysfs_exit(cpu); |
| 1201 | } | 1200 | } |
| 1202 | 1201 | ||
| 1203 | static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb, | 1202 | static int cacheinfo_cpu_callback(struct notifier_block *nfb, |
| 1204 | unsigned long action, void *hcpu) | 1203 | unsigned long action, void *hcpu) |
| 1205 | { | 1204 | { |
| 1206 | unsigned int cpu = (unsigned long)hcpu; | 1205 | unsigned int cpu = (unsigned long)hcpu; |
| 1207 | struct device *dev; | 1206 | struct device *dev; |
| @@ -1220,7 +1219,7 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb, | |||
| 1220 | return NOTIFY_OK; | 1219 | return NOTIFY_OK; |
| 1221 | } | 1220 | } |
| 1222 | 1221 | ||
| 1223 | static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier = { | 1222 | static struct notifier_block cacheinfo_cpu_notifier = { |
| 1224 | .notifier_call = cacheinfo_cpu_callback, | 1223 | .notifier_call = cacheinfo_cpu_callback, |
| 1225 | }; | 1224 | }; |
| 1226 | 1225 | ||
