perf/x86: Hybrid PMU support for intel_ctrl
[linux-2.6-microblaze.git] / arch / x86 / events / core.c
index 7fc2001..7d3c19e 100644 (file)
@@ -231,7 +231,7 @@ static void release_pmc_hardware(void) {}
 
 #endif
 
-static bool check_hw_exists(void)
+bool check_hw_exists(struct pmu *pmu, int num_counters, int num_counters_fixed)
 {
        u64 val, val_fail = -1, val_new= ~0;
        int i, reg, reg_fail = -1, ret = 0;
@@ -242,7 +242,7 @@ static bool check_hw_exists(void)
         * Check to see if the BIOS enabled any of the counters, if so
         * complain and bail.
         */
-       for (i = 0; i < x86_pmu.num_counters; i++) {
+       for (i = 0; i < num_counters; i++) {
                reg = x86_pmu_config_addr(i);
                ret = rdmsrl_safe(reg, &val);
                if (ret)
@@ -256,13 +256,13 @@ static bool check_hw_exists(void)
                }
        }
 
-       if (x86_pmu.num_counters_fixed) {
+       if (num_counters_fixed) {
                reg = MSR_ARCH_PERFMON_FIXED_CTR_CTRL;
                ret = rdmsrl_safe(reg, &val);
                if (ret)
                        goto msr_fail;
-               for (i = 0; i < x86_pmu.num_counters_fixed; i++) {
-                       if (fixed_counter_disabled(i))
+               for (i = 0; i < num_counters_fixed; i++) {
+                       if (fixed_counter_disabled(i, pmu))
                                continue;
                        if (val & (0x03 << i*4)) {
                                bios_fail = 1;
@@ -1547,7 +1547,7 @@ void perf_event_print_debug(void)
                        cpu, idx, prev_left);
        }
        for (idx = 0; idx < x86_pmu.num_counters_fixed; idx++) {
-               if (fixed_counter_disabled(idx))
+               if (fixed_counter_disabled(idx, cpuc->pmu))
                        continue;
                rdmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + idx, pmc_count);
 
@@ -1992,7 +1992,7 @@ static int __init init_hw_perf_events(void)
        pmu_check_apic();
 
        /* sanity check that the hardware exists or is emulated */
-       if (!check_hw_exists())
+       if (!check_hw_exists(&pmu, x86_pmu.num_counters, x86_pmu.num_counters_fixed))
                return 0;
 
        pr_cont("%s PMU driver.\n", x86_pmu.name);