···50505151int kvm_perf_init(void)5252{5353- /*5454- * Check if HW_PERF_EVENTS are supported by checking the number of5555- * hardware performance counters. This could ensure the presence of5656- * a physical PMU and CONFIG_PERF_EVENT is selected.5757- */5858- if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 05959- && !is_protected_kvm_enabled())5353+ if (kvm_pmu_probe_pmuver() != 0xf && !is_protected_kvm_enabled())6054 static_branch_enable(&kvm_arm_pmu_available);61556256 return perf_register_guest_info_callbacks(&kvm_guest_cbs);
···2323#include <asm/sysinfo.h>2424#include <asm/unwind.h>25252626-const char *perf_pmu_name(void)2727-{2828- if (cpum_cf_avail() || cpum_sf_avail())2929- return "CPU-Measurement Facilities (CPU-MF)";3030- return "pmu";3131-}3232-EXPORT_SYMBOL(perf_pmu_name);3333-3434-int perf_num_counters(void)3535-{3636- int num = 0;3737-3838- if (cpum_cf_avail())3939- num += PERF_CPUM_CF_MAX_CTR;4040- if (cpum_sf_avail())4141- num += PERF_CPUM_SF_MAX_CTR;4242-4343- return num;4444-}4545-EXPORT_SYMBOL(perf_num_counters);4646-4726static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs)4827{4928 struct stack_frame *stack = (struct stack_frame *) regs->gprs[15];
-18
arch/sh/kernel/perf_event.c
···5757 return !!sh_pmu;5858}59596060-const char *perf_pmu_name(void)6161-{6262- if (!sh_pmu)6363- return NULL;6464-6565- return sh_pmu->name;6666-}6767-EXPORT_SYMBOL_GPL(perf_pmu_name);6868-6969-int perf_num_counters(void)7070-{7171- if (!sh_pmu)7272- return 0;7373-7474- return sh_pmu->num_events;7575-}7676-EXPORT_SYMBOL_GPL(perf_num_counters);7777-7860/*7961 * Release the PMU if this is the last perf_event.8062 */
-30
drivers/perf/arm_pmu.c
···581581 .attrs = armpmu_common_attrs,582582};583583584584-/* Set at runtime when we know what CPU type we are. */585585-static struct arm_pmu *__oprofile_cpu_pmu;586586-587587-/*588588- * Despite the names, these two functions are CPU-specific and are used589589- * by the OProfile/perf code.590590- */591591-const char *perf_pmu_name(void)592592-{593593- if (!__oprofile_cpu_pmu)594594- return NULL;595595-596596- return __oprofile_cpu_pmu->name;597597-}598598-EXPORT_SYMBOL_GPL(perf_pmu_name);599599-600600-int perf_num_counters(void)601601-{602602- int max_events = 0;603603-604604- if (__oprofile_cpu_pmu != NULL)605605- max_events = __oprofile_cpu_pmu->num_events;606606-607607- return max_events;608608-}609609-EXPORT_SYMBOL_GPL(perf_num_counters);610610-611584static int armpmu_count_irq_users(const int irq)612585{613586 int cpu, count = 0;···951978 ret = perf_pmu_register(&pmu->pmu, pmu->name, -1);952979 if (ret)953980 goto out_destroy;954954-955955- if (!__oprofile_cpu_pmu)956956- __oprofile_cpu_pmu = pmu;957981958982 pr_info("enabled with %s PMU driver, %d counters available%s\n",959983 pmu->name, pmu->num_events,