File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,11 +109,6 @@ KVM_NVHE_ALIAS(vgic_v3_cpuif_trap);
109109KVM_NVHE_ALIAS (__start___kvm_ex_table );
110110KVM_NVHE_ALIAS (__stop___kvm_ex_table );
111111
112- /* PMU available static key */
113- #ifdef CONFIG_HW_PERF_EVENTS
114- KVM_NVHE_ALIAS (kvm_arm_pmu_available );
115- #endif
116-
117112/* Position-independent library routines */
118113KVM_NVHE_ALIAS_HYP (clear_page , __pi_clear_page );
119114KVM_NVHE_ALIAS_HYP (copy_page , __pi_copy_page );
Original file line number Diff line number Diff line change @@ -392,7 +392,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
392392 r = get_num_wrps ();
393393 break ;
394394 case KVM_CAP_ARM_PMU_V3 :
395- r = kvm_arm_support_pmu_v3 ();
395+ r = kvm_supports_guest_pmuv3 ();
396396 break ;
397397 case KVM_CAP_ARM_INJECT_SERROR_ESR :
398398 r = cpus_have_final_cap (ARM64_HAS_RAS_EXTN );
@@ -1417,7 +1417,7 @@ static unsigned long system_supported_vcpu_features(void)
14171417 if (!cpus_have_final_cap (ARM64_HAS_32BIT_EL1 ))
14181418 clear_bit (KVM_ARM_VCPU_EL1_32BIT , & features );
14191419
1420- if (!kvm_arm_support_pmu_v3 ())
1420+ if (!kvm_supports_guest_pmuv3 ())
14211421 clear_bit (KVM_ARM_VCPU_PMU_V3 , & features );
14221422
14231423 if (!system_supports_sve ())
Original file line number Diff line number Diff line change 1717
1818#define PERF_ATTR_CFG1_COUNTER_64BIT BIT(0)
1919
20- DEFINE_STATIC_KEY_FALSE (kvm_arm_pmu_available );
21-
2220static LIST_HEAD (arm_pmus );
2321static DEFINE_MUTEX (arm_pmus_lock );
2422
2523static void kvm_pmu_create_perf_event (struct kvm_pmc * pmc );
2624static void kvm_pmu_release_perf_event (struct kvm_pmc * pmc );
2725
26+ bool kvm_supports_guest_pmuv3 (void )
27+ {
28+ guard (mutex )(& arm_pmus_lock );
29+ return !list_empty (& arm_pmus );
30+ }
31+
2832static struct kvm_vcpu * kvm_pmc_to_vcpu (const struct kvm_pmc * pmc )
2933{
3034 return container_of (pmc , struct kvm_vcpu , arch .pmu .pmc [pmc -> idx ]);
@@ -722,9 +726,6 @@ void kvm_host_pmu_init(struct arm_pmu *pmu)
722726 entry -> arm_pmu = pmu ;
723727 list_add_tail (& entry -> entry , & arm_pmus );
724728
725- if (list_is_singular (& arm_pmus ))
726- static_branch_enable (& kvm_arm_pmu_available );
727-
728729out_unlock :
729730 mutex_unlock (& arm_pmus_lock );
730731}
Original file line number Diff line number Diff line change @@ -37,13 +37,7 @@ struct arm_pmu_entry {
3737 struct arm_pmu * arm_pmu ;
3838};
3939
40- DECLARE_STATIC_KEY_FALSE (kvm_arm_pmu_available );
41-
42- static __always_inline bool kvm_arm_support_pmu_v3 (void )
43- {
44- return static_branch_likely (& kvm_arm_pmu_available );
45- }
46-
40+ bool kvm_supports_guest_pmuv3 (void );
4741#define kvm_arm_pmu_irq_initialized (v ) ((v)->arch.pmu.irq_num >= VGIC_NR_SGIS)
4842u64 kvm_pmu_get_counter_value (struct kvm_vcpu * vcpu , u64 select_idx );
4943void kvm_pmu_set_counter_value (struct kvm_vcpu * vcpu , u64 select_idx , u64 val );
@@ -100,11 +94,6 @@ u64 kvm_vcpu_read_pmcr(struct kvm_vcpu *vcpu);
10094struct kvm_pmu {
10195};
10296
103- static inline bool kvm_arm_support_pmu_v3 (void )
104- {
105- return false;
106- }
107-
10897#define kvm_arm_pmu_irq_initialized (v ) (false)
10998static inline u64 kvm_pmu_get_counter_value (struct kvm_vcpu * vcpu ,
11099 u64 select_idx )
You can’t perform that action at this time.
0 commit comments