@@ -132,7 +132,16 @@ struct _cpuid4_info {
132132 union _cpuid4_leaf_ecx ecx ;
133133 unsigned long size ;
134134 unsigned long can_disable ;
135- cpumask_t shared_cpu_map ; /* future?: only cpus/node is needed */
135+ DECLARE_BITMAP (shared_cpu_map , NR_CPUS );
136+ };
137+
138+ /* subset of above _cpuid4_info w/o shared_cpu_map */
139+ struct _cpuid4_info_regs {
140+ union _cpuid4_leaf_eax eax ;
141+ union _cpuid4_leaf_ebx ebx ;
142+ union _cpuid4_leaf_ecx ecx ;
143+ unsigned long size ;
144+ unsigned long can_disable ;
136145};
137146
138147#ifdef CONFIG_PCI
@@ -263,15 +272,16 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
263272}
264273
265274static void __cpuinit
266- amd_check_l3_disable (int index , struct _cpuid4_info * this_leaf )
275+ amd_check_l3_disable (int index , struct _cpuid4_info_regs * this_leaf )
267276{
268277 if (index < 3 )
269278 return ;
270279 this_leaf -> can_disable = 1 ;
271280}
272281
273282static int
274- __cpuinit cpuid4_cache_lookup (int index , struct _cpuid4_info * this_leaf )
283+ __cpuinit cpuid4_cache_lookup_regs (int index ,
284+ struct _cpuid4_info_regs * this_leaf )
275285{
276286 union _cpuid4_leaf_eax eax ;
277287 union _cpuid4_leaf_ebx ebx ;
@@ -299,6 +309,15 @@ __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
299309 return 0 ;
300310}
301311
312+ static int
313+ __cpuinit cpuid4_cache_lookup (int index , struct _cpuid4_info * this_leaf )
314+ {
315+ struct _cpuid4_info_regs * leaf_regs =
316+ (struct _cpuid4_info_regs * )this_leaf ;
317+
318+ return cpuid4_cache_lookup_regs (index , leaf_regs );
319+ }
320+
302321static int __cpuinit find_num_cache_leaves (void )
303322{
304323 unsigned int eax , ebx , ecx , edx ;
@@ -338,11 +357,10 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
338357 * parameters cpuid leaf to find the cache details
339358 */
340359 for (i = 0 ; i < num_cache_leaves ; i ++ ) {
341- struct _cpuid4_info this_leaf ;
342-
360+ struct _cpuid4_info_regs this_leaf ;
343361 int retval ;
344362
345- retval = cpuid4_cache_lookup (i , & this_leaf );
363+ retval = cpuid4_cache_lookup_regs (i , & this_leaf );
346364 if (retval >= 0 ) {
347365 switch (this_leaf .eax .split .level ) {
348366 case 1 :
@@ -491,17 +509,20 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
491509 num_threads_sharing = 1 + this_leaf -> eax .split .num_threads_sharing ;
492510
493511 if (num_threads_sharing == 1 )
494- cpu_set (cpu , this_leaf -> shared_cpu_map );
512+ cpumask_set_cpu (cpu , to_cpumask ( this_leaf -> shared_cpu_map ) );
495513 else {
496514 index_msb = get_count_order (num_threads_sharing );
497515
498516 for_each_online_cpu (i ) {
499517 if (cpu_data (i ).apicid >> index_msb ==
500518 c -> apicid >> index_msb ) {
501- cpu_set (i , this_leaf -> shared_cpu_map );
519+ cpumask_set_cpu (i ,
520+ to_cpumask (this_leaf -> shared_cpu_map ));
502521 if (i != cpu && per_cpu (cpuid4_info , i )) {
503- sibling_leaf = CPUID4_INFO_IDX (i , index );
504- cpu_set (cpu , sibling_leaf -> shared_cpu_map );
522+ sibling_leaf =
523+ CPUID4_INFO_IDX (i , index );
524+ cpumask_set_cpu (cpu , to_cpumask (
525+ sibling_leaf -> shared_cpu_map ));
505526 }
506527 }
507528 }
@@ -513,9 +534,10 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index)
513534 int sibling ;
514535
515536 this_leaf = CPUID4_INFO_IDX (cpu , index );
516- for_each_cpu_mask_nr (sibling , this_leaf -> shared_cpu_map ) {
537+ for_each_cpu (sibling , to_cpumask ( this_leaf -> shared_cpu_map ) ) {
517538 sibling_leaf = CPUID4_INFO_IDX (sibling , index );
518- cpu_clear (cpu , sibling_leaf -> shared_cpu_map );
539+ cpumask_clear_cpu (cpu ,
540+ to_cpumask (sibling_leaf -> shared_cpu_map ));
519541 }
520542}
521543#else
@@ -620,8 +642,9 @@ static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
620642 int n = 0 ;
621643
622644 if (len > 1 ) {
623- cpumask_t * mask = & this_leaf -> shared_cpu_map ;
645+ const struct cpumask * mask ;
624646
647+ mask = to_cpumask (this_leaf -> shared_cpu_map );
625648 n = type ?
626649 cpulist_scnprintf (buf , len - 2 , mask ) :
627650 cpumask_scnprintf (buf , len - 2 , mask );
@@ -684,7 +707,8 @@ static struct pci_dev *get_k8_northbridge(int node)
684707
685708static ssize_t show_cache_disable (struct _cpuid4_info * this_leaf , char * buf )
686709{
687- int node = cpu_to_node (first_cpu (this_leaf -> shared_cpu_map ));
710+ const struct cpumask * mask = to_cpumask (this_leaf -> shared_cpu_map );
711+ int node = cpu_to_node (cpumask_first (mask ));
688712 struct pci_dev * dev = NULL ;
689713 ssize_t ret = 0 ;
690714 int i ;
@@ -718,7 +742,8 @@ static ssize_t
718742store_cache_disable (struct _cpuid4_info * this_leaf , const char * buf ,
719743 size_t count )
720744{
721- int node = cpu_to_node (first_cpu (this_leaf -> shared_cpu_map ));
745+ const struct cpumask * mask = to_cpumask (this_leaf -> shared_cpu_map );
746+ int node = cpu_to_node (cpumask_first (mask ));
722747 struct pci_dev * dev = NULL ;
723748 unsigned int ret , index , val ;
724749
@@ -863,7 +888,7 @@ static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu)
863888 return - ENOMEM ;
864889}
865890
866- static cpumask_t cache_dev_map = CPU_MASK_NONE ;
891+ static DECLARE_BITMAP ( cache_dev_map , NR_CPUS ) ;
867892
868893/* Add/Remove cache interface for CPU device */
869894static int __cpuinit cache_add_dev (struct sys_device * sys_dev )
@@ -903,7 +928,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
903928 }
904929 kobject_uevent (& (this_object -> kobj ), KOBJ_ADD );
905930 }
906- cpu_set (cpu , cache_dev_map );
931+ cpumask_set_cpu (cpu , to_cpumask ( cache_dev_map ) );
907932
908933 kobject_uevent (per_cpu (cache_kobject , cpu ), KOBJ_ADD );
909934 return 0 ;
@@ -916,9 +941,9 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
916941
917942 if (per_cpu (cpuid4_info , cpu ) == NULL )
918943 return ;
919- if (!cpu_isset (cpu , cache_dev_map ))
944+ if (!cpumask_test_cpu (cpu , to_cpumask ( cache_dev_map ) ))
920945 return ;
921- cpu_clear (cpu , cache_dev_map );
946+ cpumask_clear_cpu (cpu , to_cpumask ( cache_dev_map ) );
922947
923948 for (i = 0 ; i < num_cache_leaves ; i ++ )
924949 kobject_put (& (INDEX_KOBJECT_PTR (cpu ,i )-> kobj ));
0 commit comments