DEFINE_RAW_SPINLOCK(pci2phy_map_lock);
 struct list_head pci2phy_map_head = LIST_HEAD_INIT(pci2phy_map_head);
 struct pci_extra_dev *uncore_extra_pci_dev;
-static int max_dies;
+int __uncore_max_dies;
 
 /* mask of cpus that collect uncore events */
 static cpumask_t uncore_cpu_mask;
         * The unsigned check also catches the '-1' return value for non
         * existent mappings in the topology map.
         */
-       return dieid < max_dies ? pmu->boxes[dieid] : NULL;
+       return dieid < uncore_max_dies() ? pmu->boxes[dieid] : NULL;
 }
 
 u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event)
 {
        int die;
 
-       for (die = 0; die < max_dies; die++)
+       for (die = 0; die < uncore_max_dies(); die++)
                kfree(pmu->boxes[die]);
        kfree(pmu->boxes);
 }
        if (!pmus)
                return -ENOMEM;
 
-       size = max_dies * sizeof(struct intel_uncore_box *);
+       size = uncore_max_dies() * sizeof(struct intel_uncore_box *);
 
        for (i = 0; i < type->num_boxes; i++) {
                pmus[i].func_id = setid ? i : -1;
        size_t size;
        int ret;
 
-       size = max_dies * sizeof(struct pci_extra_dev);
+       size = uncore_max_dies() * sizeof(struct pci_extra_dev);
        uncore_extra_pci_dev = kzalloc(size, GFP_KERNEL);
        if (!uncore_extra_pci_dev) {
                ret = -ENOMEM;
        if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
                return -ENODEV;
 
-       max_dies = topology_max_packages() * topology_max_die_per_package();
+       __uncore_max_dies =
+               topology_max_packages() * topology_max_die_per_package();
 
        uncore_init = (struct intel_uncore_init_fun *)id->driver_data;
        if (uncore_init->pci_init) {
 
 ssize_t uncore_event_show(struct kobject *kobj,
                          struct kobj_attribute *attr, char *buf);
 
+extern int __uncore_max_dies;
+#define uncore_max_dies()      (__uncore_max_dies)
+
 #define INTEL_UNCORE_EVENT_DESC(_name, _config)                        \
 {                                                              \
        .attr   = __ATTR(_name, 0444, uncore_event_show, NULL), \