mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	KVM: arm64: Divorce the perf code from oprofile helpers
KVM/arm64 is the sole user of perf_num_counters(), and really could do without it. Stop using the obsolete API by relying on the existing probing code. Signed-off-by: Marc Zyngier <maz@kernel.org> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20210414134409.1266357-2-maz@kernel.org
This commit is contained in:
		
							parent
							
								
									1e28eed176
								
							
						
					
					
						commit
						5421db1be3
					
				
					 3 changed files with 6 additions and 7 deletions
				
			
		| 
						 | 
					@ -50,12 +50,7 @@ static struct perf_guest_info_callbacks kvm_guest_cbs = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int kvm_perf_init(void)
 | 
					int kvm_perf_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/*
 | 
						if (kvm_pmu_probe_pmuver() != 0xf)
 | 
				
			||||||
	 * Check if HW_PERF_EVENTS are supported by checking the number of
 | 
					 | 
				
			||||||
	 * hardware performance counters. This could ensure the presence of
 | 
					 | 
				
			||||||
	 * a physical PMU and CONFIG_PERF_EVENT is selected.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
 | 
					 | 
				
			||||||
		static_branch_enable(&kvm_arm_pmu_available);
 | 
							static_branch_enable(&kvm_arm_pmu_available);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return perf_register_guest_info_callbacks(&kvm_guest_cbs);
 | 
						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,
 | 
				
			||||||
	kvm_pmu_create_perf_event(vcpu, select_idx);
 | 
						kvm_pmu_create_perf_event(vcpu, select_idx);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvm_pmu_probe_pmuver(void)
 | 
					int kvm_pmu_probe_pmuver(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct perf_event_attr attr = { };
 | 
						struct perf_event_attr attr = { };
 | 
				
			||||||
	struct perf_event *event;
 | 
						struct perf_event *event;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,6 +61,7 @@ int kvm_arm_pmu_v3_get_attr(struct kvm_vcpu *vcpu,
 | 
				
			||||||
int kvm_arm_pmu_v3_has_attr(struct kvm_vcpu *vcpu,
 | 
					int kvm_arm_pmu_v3_has_attr(struct kvm_vcpu *vcpu,
 | 
				
			||||||
			    struct kvm_device_attr *attr);
 | 
								    struct kvm_device_attr *attr);
 | 
				
			||||||
int kvm_arm_pmu_v3_enable(struct kvm_vcpu *vcpu);
 | 
					int kvm_arm_pmu_v3_enable(struct kvm_vcpu *vcpu);
 | 
				
			||||||
 | 
					int kvm_pmu_probe_pmuver(void);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
struct kvm_pmu {
 | 
					struct kvm_pmu {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -116,6 +117,9 @@ static inline u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline int kvm_pmu_probe_pmuver(void) { return 0xf; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue