static int __init init_power9_pmu(void) { int rc = 0; /* Comes from cpu_specs[] */ if (!cur_cpu_spec->oprofile_cpu_type || strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power9")) return -ENODEV; if (cpu_has_feature(CPU_FTR_POWER9_DD1)) { /* * Since PM_INST_CMPL may not provide right counts in all * sampling scenarios in power9 DD1, instead use PM_INST_DISP. */ EVENT_VAR(PM_INST_CMPL, _g).id = PM_INST_DISP; /* * Power9 DD1 should use PM_BR_CMPL_ALT event code for * "branches" to provide correct counter value. */ EVENT_VAR(PM_BRU_CMPL, _g).id = PM_BR_CMPL_ALT; EVENT_VAR(PM_BRU_CMPL, _c).id = PM_BR_CMPL_ALT; rc = register_power_pmu(&power9_isa207_pmu); } else { rc = register_power_pmu(&power9_pmu); } if (rc) return rc; /* Tell userspace that EBB is supported */ cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_EBB; return 0; }
static int __init init_power9_pmu(void) { int rc = 0; unsigned int pvr = mfspr(SPRN_PVR); /* Comes from cpu_specs[] */ if (!cur_cpu_spec->oprofile_cpu_type || strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power9")) return -ENODEV; /* Blacklist events */ if (!(pvr & PVR_POWER9_CUMULUS)) { if ((PVR_CFG(pvr) == 2) && (PVR_MIN(pvr) == 1)) { power9_pmu.blacklist_ev = p9_dd21_bl_ev; power9_pmu.n_blacklist_ev = ARRAY_SIZE(p9_dd21_bl_ev); } else if ((PVR_CFG(pvr) == 2) && (PVR_MIN(pvr) == 2)) { power9_pmu.blacklist_ev = p9_dd22_bl_ev; power9_pmu.n_blacklist_ev = ARRAY_SIZE(p9_dd22_bl_ev); } } rc = register_power_pmu(&power9_pmu); if (rc) return rc; /* Tell userspace that EBB is supported */ cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_EBB; return 0; }
int init_generic_compat_pmu(void) { int rc = 0; rc = register_power_pmu(&generic_compat_pmu); if (rc) return rc; /* Tell userspace that EBB is supported */ cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_EBB; return 0; }