@@ -16,7 +16,7 @@ struct pci_driver *uncore_pci_driver;
16
16
DEFINE_RAW_SPINLOCK (pci2phy_map_lock );
17
17
struct list_head pci2phy_map_head = LIST_HEAD_INIT (pci2phy_map_head );
18
18
struct pci_extra_dev * uncore_extra_pci_dev ;
19
- static int max_dies ;
19
+ int __uncore_max_dies ;
20
20
21
21
/* mask of cpus that collect uncore events */
22
22
static cpumask_t uncore_cpu_mask ;
@@ -108,7 +108,7 @@ struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu
108
108
* The unsigned check also catches the '-1' return value for non
109
109
* existent mappings in the topology map.
110
110
*/
111
- return dieid < max_dies ? pmu -> boxes [dieid ] : NULL ;
111
+ return dieid < uncore_max_dies () ? pmu -> boxes [dieid ] : NULL ;
112
112
}
113
113
114
114
u64 uncore_msr_read_counter (struct intel_uncore_box * box , struct perf_event * event )
@@ -882,7 +882,7 @@ static void uncore_free_boxes(struct intel_uncore_pmu *pmu)
882
882
{
883
883
int die ;
884
884
885
- for (die = 0 ; die < max_dies ; die ++ )
885
+ for (die = 0 ; die < uncore_max_dies () ; die ++ )
886
886
kfree (pmu -> boxes [die ]);
887
887
kfree (pmu -> boxes );
888
888
}
@@ -923,7 +923,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
923
923
if (!pmus )
924
924
return - ENOMEM ;
925
925
926
- size = max_dies * sizeof (struct intel_uncore_box * );
926
+ size = uncore_max_dies () * sizeof (struct intel_uncore_box * );
927
927
928
928
for (i = 0 ; i < type -> num_boxes ; i ++ ) {
929
929
pmus [i ].func_id = setid ? i : -1 ;
@@ -1123,7 +1123,7 @@ static int __init uncore_pci_init(void)
1123
1123
size_t size ;
1124
1124
int ret ;
1125
1125
1126
- size = max_dies * sizeof (struct pci_extra_dev );
1126
+ size = uncore_max_dies () * sizeof (struct pci_extra_dev );
1127
1127
uncore_extra_pci_dev = kzalloc (size , GFP_KERNEL );
1128
1128
if (!uncore_extra_pci_dev ) {
1129
1129
ret = - ENOMEM ;
@@ -1552,7 +1552,8 @@ static int __init intel_uncore_init(void)
1552
1552
if (boot_cpu_has (X86_FEATURE_HYPERVISOR ))
1553
1553
return - ENODEV ;
1554
1554
1555
- max_dies = topology_max_packages () * topology_max_die_per_package ();
1555
+ __uncore_max_dies =
1556
+ topology_max_packages () * topology_max_die_per_package ();
1556
1557
1557
1558
uncore_init = (struct intel_uncore_init_fun * )id -> driver_data ;
1558
1559
if (uncore_init -> pci_init ) {
0 commit comments