File tree Expand file tree Collapse file tree 4 files changed +10
-20
lines changed Expand file tree Collapse file tree 4 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -112,11 +112,6 @@ KVM_NVHE_ALIAS(broken_cntvoff_key);
112
112
KVM_NVHE_ALIAS (__start___kvm_ex_table );
113
113
KVM_NVHE_ALIAS (__stop___kvm_ex_table );
114
114
115
- /* PMU available static key */
116
- #ifdef CONFIG_HW_PERF_EVENTS
117
- KVM_NVHE_ALIAS (kvm_arm_pmu_available );
118
- #endif
119
-
120
115
/* Position-independent library routines */
121
116
KVM_NVHE_ALIAS_HYP (clear_page , __pi_clear_page );
122
117
KVM_NVHE_ALIAS_HYP (copy_page , __pi_copy_page );
Original file line number Diff line number Diff line change @@ -366,7 +366,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
366
366
r = get_num_wrps ();
367
367
break ;
368
368
case KVM_CAP_ARM_PMU_V3 :
369
- r = kvm_arm_support_pmu_v3 ();
369
+ r = kvm_supports_guest_pmuv3 ();
370
370
break ;
371
371
case KVM_CAP_ARM_INJECT_SERROR_ESR :
372
372
r = cpus_have_final_cap (ARM64_HAS_RAS_EXTN );
@@ -1388,7 +1388,7 @@ static unsigned long system_supported_vcpu_features(void)
1388
1388
if (!cpus_have_final_cap (ARM64_HAS_32BIT_EL1 ))
1389
1389
clear_bit (KVM_ARM_VCPU_EL1_32BIT , & features );
1390
1390
1391
- if (!kvm_arm_support_pmu_v3 ())
1391
+ if (!kvm_supports_guest_pmuv3 ())
1392
1392
clear_bit (KVM_ARM_VCPU_PMU_V3 , & features );
1393
1393
1394
1394
if (!system_supports_sve ())
Original file line number Diff line number Diff line change 17
17
18
18
#define PERF_ATTR_CFG1_COUNTER_64BIT BIT(0)
19
19
20
- DEFINE_STATIC_KEY_FALSE (kvm_arm_pmu_available );
21
-
22
20
static LIST_HEAD (arm_pmus );
23
21
static DEFINE_MUTEX (arm_pmus_lock );
24
22
25
23
static void kvm_pmu_create_perf_event (struct kvm_pmc * pmc );
26
24
static void kvm_pmu_release_perf_event (struct kvm_pmc * pmc );
27
25
static bool kvm_pmu_counter_is_enabled (struct kvm_pmc * pmc );
28
26
27
+ bool kvm_supports_guest_pmuv3 (void )
28
+ {
29
+ guard (mutex )(& arm_pmus_lock );
30
+ return !list_empty (& arm_pmus );
31
+ }
32
+
29
33
static struct kvm_vcpu * kvm_pmc_to_vcpu (const struct kvm_pmc * pmc )
30
34
{
31
35
return container_of (pmc , struct kvm_vcpu , arch .pmu .pmc [pmc -> idx ]);
@@ -795,9 +799,6 @@ void kvm_host_pmu_init(struct arm_pmu *pmu)
795
799
entry -> arm_pmu = pmu ;
796
800
list_add_tail (& entry -> entry , & arm_pmus );
797
801
798
- if (list_is_singular (& arm_pmus ))
799
- static_branch_enable (& kvm_arm_pmu_available );
800
-
801
802
out_unlock :
802
803
mutex_unlock (& arm_pmus_lock );
803
804
}
Original file line number Diff line number Diff line change @@ -37,13 +37,7 @@ struct arm_pmu_entry {
37
37
struct arm_pmu * arm_pmu ;
38
38
};
39
39
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 );
47
41
#define kvm_arm_pmu_irq_initialized (v ) ((v)->arch.pmu.irq_num >= VGIC_NR_SGIS)
48
42
u64 kvm_pmu_get_counter_value (struct kvm_vcpu * vcpu , u64 select_idx );
49
43
void kvm_pmu_set_counter_value (struct kvm_vcpu * vcpu , u64 select_idx , u64 val );
@@ -102,7 +96,7 @@ void kvm_pmu_nested_transition(struct kvm_vcpu *vcpu);
102
96
struct kvm_pmu {
103
97
};
104
98
105
- static inline bool kvm_arm_support_pmu_v3 (void )
99
+ static inline bool kvm_supports_guest_pmuv3 (void )
106
100
{
107
101
return false;
108
102
}
You can’t perform that action at this time.
0 commit comments