Unified · Split
| @@ -50,13 +50,7 @@ static struct perf_guest_info_callbacks kvm_guest_cbs = { · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | int kvm_perf_init(void) |
| 52 | 52 | { |
| 53 | − /* | |
| 54 | − * Check if HW_PERF_EVENTS are supported by checking the number of | |
| 55 | − * hardware performance counters. This could ensure the presence of | |
| 56 | − * a physical PMU and CONFIG_PERF_EVENT is selected. | |
| 57 | − */ | |
| 58 | − if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0 | |
| 59 | − && !is_protected_kvm_enabled()) | |
| 53 | + if (kvm_pmu_probe_pmuver() != 0xf && !is_protected_kvm_enabled()) | |
| 60 | 54 | static_branch_enable(&kvm_arm_pmu_available); |
| 61 | 55 | |
| 62 | 56 | return perf_register_guest_info_callbacks(&kvm_guest_cbs); |
| @@ -739,7 +739,7 @@ void kvm_pmu_set_counter_event_type(struct kvm_vcpu *vcpu, u64 data, · 738 unmodified lines | ||
| 739 | 739 | kvm_pmu_create_perf_event(vcpu, select_idx); |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | −static int kvm_pmu_probe_pmuver(void) | |
| 742 | +int kvm_pmu_probe_pmuver(void) | |
| 743 | 743 | { |
| 744 | 744 | struct perf_event_attr attr = { }; |
| 745 | 745 | struct perf_event *event; |
| @@ -23,27 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <asm/sysinfo.h> |
| 24 | 24 | #include <asm/unwind.h> |
| 25 | 25 | |
| 26 | −const char *perf_pmu_name(void) | |
| 27 | −{ | |
| 28 | − if (cpum_cf_avail() || cpum_sf_avail()) | |
| 29 | − return "CPU-Measurement Facilities (CPU-MF)"; | |
| 30 | − return "pmu"; | |
| 31 | −} | |
| 32 | −EXPORT_SYMBOL(perf_pmu_name); | |
| 33 | − | |
| 34 | −int perf_num_counters(void) | |
| 35 | −{ | |
| 36 | − int num = 0; | |
| 37 | − | |
| 38 | − if (cpum_cf_avail()) | |
| 39 | − num += PERF_CPUM_CF_MAX_CTR; | |
| 40 | − if (cpum_sf_avail()) | |
| 41 | − num += PERF_CPUM_SF_MAX_CTR; | |
| 42 | − | |
| 43 | − return num; | |
| 44 | −} | |
| 45 | −EXPORT_SYMBOL(perf_num_counters); | |
| 46 | − | |
| 47 | 26 | static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs) |
| 48 | 27 | { |
| 49 | 28 | struct stack_frame *stack = (struct stack_frame *) regs->gprs[15]; |
| @@ -57,24 +57,6 @@ static inline int sh_pmu_initialized(void) · 56 unmodified lines | ||
| 57 | 57 | return !!sh_pmu; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | −const char *perf_pmu_name(void) | |
| 61 | −{ | |
| 62 | − if (!sh_pmu) | |
| 63 | − return NULL; | |
| 64 | − | |
| 65 | − return sh_pmu->name; | |
| 66 | −} | |
| 67 | −EXPORT_SYMBOL_GPL(perf_pmu_name); | |
| 68 | − | |
| 69 | −int perf_num_counters(void) | |
| 70 | −{ | |
| 71 | − if (!sh_pmu) | |
| 72 | − return 0; | |
| 73 | − | |
| 74 | − return sh_pmu->num_events; | |
| 75 | −} | |
| 76 | −EXPORT_SYMBOL_GPL(perf_num_counters); | |
| 77 | − | |
| 78 | 60 | /* |
| 79 | 61 | * Release the PMU if this is the last perf_event. |
| 80 | 62 | */ |
| @@ -581,33 +581,6 @@ static const struct attribute_group armpmu_common_attr_group = { · 580 unmodified lines | ||
| 581 | 581 | .attrs = armpmu_common_attrs, |
| 582 | 582 | }; |
| 583 | 583 | |
| 584 | −/* Set at runtime when we know what CPU type we are. */ | |
| 585 | −static struct arm_pmu *__oprofile_cpu_pmu; | |
| 586 | − | |
| 587 | −/* | |
| 588 | − * Despite the names, these two functions are CPU-specific and are used | |
| 589 | − * by the OProfile/perf code. | |
| 590 | − */ | |
| 591 | −const char *perf_pmu_name(void) | |
| 592 | −{ | |
| 593 | − if (!__oprofile_cpu_pmu) | |
| 594 | − return NULL; | |
| 595 | − | |
| 596 | − return __oprofile_cpu_pmu->name; | |
| 597 | −} | |
| 598 | −EXPORT_SYMBOL_GPL(perf_pmu_name); | |
| 599 | − | |
| 600 | −int perf_num_counters(void) | |
| 601 | −{ | |
| 602 | − int max_events = 0; | |
| 603 | − | |
| 604 | − if (__oprofile_cpu_pmu != NULL) | |
| 605 | − max_events = __oprofile_cpu_pmu->num_events; | |
| 606 | − | |
| 607 | − return max_events; | |
| 608 | −} | |
| 609 | −EXPORT_SYMBOL_GPL(perf_num_counters); | |
| 610 | − | |
| 611 | 584 | static int armpmu_count_irq_users(const int irq) |
| 612 | 585 | { |
| 613 | 586 | int cpu, count = 0; |
| @@ -979,9 +952,6 @@ int armpmu_register(struct arm_pmu *pmu) · 365 unmodified lines | ||
| 979 | 952 | if (ret) |
| 980 | 953 | goto out_destroy; |
| 981 | 954 | |
| 982 | − if (!__oprofile_cpu_pmu) | |
| 983 | − __oprofile_cpu_pmu = pmu; | |
| 984 | − | |
| 985 | 955 | pr_info("enabled with %s PMU driver, %d counters available%s\n", |
| 986 | 956 | pmu->name, pmu->num_events, |
| 987 | 957 | has_nmi ? ", using NMIs" : ""); |
| @@ -61,6 +61,7 @@ int kvm_arm_pmu_v3_get_attr(struct kvm_vcpu *vcpu, · 60 unmodified lines | ||
| 61 | 61 | int kvm_arm_pmu_v3_has_attr(struct kvm_vcpu *vcpu, |
| 62 | 62 | struct kvm_device_attr *attr); |
| 63 | 63 | int kvm_arm_pmu_v3_enable(struct kvm_vcpu *vcpu); |
| 64 | +int kvm_pmu_probe_pmuver(void); | |
| 64 | 65 | #else |
| 65 | 66 | struct kvm_pmu { |
| 66 | 67 | }; |
| @@ -116,6 +117,9 @@ static inline u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1) · 49 unmodified lines | ||
| 116 | 117 | { |
| 117 | 118 | return 0; |
| 118 | 119 | } |
| 120 | + | |
| 121 | +static inline int kvm_pmu_probe_pmuver(void) { return 0xf; } | |
| 122 | + | |
| 119 | 123 | #endif |
| 120 | 124 | |
| 121 | 125 | #endif |
| @@ -951,8 +951,6 @@ extern void perf_event_itrace_started(struct perf_event *event); · 950 unmodified lines | ||
| 951 | 951 | extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); |
| 952 | 952 | extern void perf_pmu_unregister(struct pmu *pmu); |
| 953 | 953 | |
| 954 | −extern int perf_num_counters(void); | |
| 955 | −extern const char *perf_pmu_name(void); | |
| 956 | 954 | extern void __perf_event_task_sched_in(struct task_struct *prev, |
| 957 | 955 | struct task_struct *task); |
| 958 | 956 | extern void __perf_event_task_sched_out(struct task_struct *prev, |
| @@ -580,11 +580,6 @@ static u64 perf_event_time(struct perf_event *event); · 579 unmodified lines | ||
| 580 | 580 | |
| 581 | 581 | void __weak perf_event_print_debug(void) { } |
| 582 | 582 | |
| 583 | −extern __weak const char *perf_pmu_name(void) | |
| 584 | −{ | |
| 585 | − return "pmu"; | |
| 586 | −} | |
| 587 | − | |
| 588 | 583 | static inline u64 perf_clock(void) |
| 589 | 584 | { |
| 590 | 585 | return local_clock(); |