Skip to content

Commit 418e5ca

Browse files
Andrew MurrayMarc Zyngier
authored andcommitted
KVM: arm/arm64: Rename kvm_pmu_{enable/disable}_counter functions
The kvm_pmu_{enable/disable}_counter functions can enable/disable multiple counters at once as they operate on a bitmask. Let's make this clearer by renaming the function. Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Andrew Murray <andrew.murray@arm.com> Reviewed-by: Julien Thierry <julien.thierry@arm.com> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 11b4162 commit 418e5ca

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎arch/arm64/kvm/sys_regs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,12 @@ static bool access_pmcnten(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
865865
if (r->Op2 & 0x1) {
866866
/* accessing PMCNTENSET_EL0 */
867867
__vcpu_sys_reg(vcpu, PMCNTENSET_EL0) |= val;
868-
kvm_pmu_enable_counter(vcpu, val);
868+
kvm_pmu_enable_counter_mask(vcpu, val);
869869
kvm_vcpu_pmu_restore_guest(vcpu);
870870
} else {
871871
/* accessing PMCNTENCLR_EL0 */
872872
__vcpu_sys_reg(vcpu, PMCNTENSET_EL0) &= ~val;
873-
kvm_pmu_disable_counter(vcpu, val);
873+
kvm_pmu_disable_counter_mask(vcpu, val);
874874
}
875875
} else {
876876
p->regval = __vcpu_sys_reg(vcpu, PMCNTENSET_EL0) & mask;

‎include/kvm/arm_pmu.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ void kvm_pmu_set_counter_value(struct kvm_vcpu *vcpu, u64 select_idx, u64 val);
3535
u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu);
3636
void kvm_pmu_vcpu_reset(struct kvm_vcpu *vcpu);
3737
void kvm_pmu_vcpu_destroy(struct kvm_vcpu *vcpu);
38-
void kvm_pmu_disable_counter(struct kvm_vcpu *vcpu, u64 val);
39-
void kvm_pmu_enable_counter(struct kvm_vcpu *vcpu, u64 val);
38+
void kvm_pmu_disable_counter_mask(struct kvm_vcpu *vcpu, u64 val);
39+
void kvm_pmu_enable_counter_mask(struct kvm_vcpu *vcpu, u64 val);
4040
void kvm_pmu_flush_hwstate(struct kvm_vcpu *vcpu);
4141
void kvm_pmu_sync_hwstate(struct kvm_vcpu *vcpu);
4242
bool kvm_pmu_should_notify_user(struct kvm_vcpu *vcpu);
@@ -72,8 +72,8 @@ static inline u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu)
7272
}
7373
static inline void kvm_pmu_vcpu_reset(struct kvm_vcpu *vcpu) {}
7474
static inline void kvm_pmu_vcpu_destroy(struct kvm_vcpu *vcpu) {}
75-
static inline void kvm_pmu_disable_counter(struct kvm_vcpu *vcpu, u64 val) {}
76-
static inline void kvm_pmu_enable_counter(struct kvm_vcpu *vcpu, u64 val) {}
75+
static inline void kvm_pmu_disable_counter_mask(struct kvm_vcpu *vcpu, u64 val) {}
76+
static inline void kvm_pmu_enable_counter_mask(struct kvm_vcpu *vcpu, u64 val) {}
7777
static inline void kvm_pmu_flush_hwstate(struct kvm_vcpu *vcpu) {}
7878
static inline void kvm_pmu_sync_hwstate(struct kvm_vcpu *vcpu) {}
7979
static inline bool kvm_pmu_should_notify_user(struct kvm_vcpu *vcpu)

‎virt/kvm/arm/pmu.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ u64 kvm_pmu_valid_counter_mask(struct kvm_vcpu *vcpu)
124124
}
125125

126126
/**
127-
* kvm_pmu_enable_counter - enable selected PMU counter
127+
* kvm_pmu_enable_counter_mask - enable selected PMU counters
128128
* @vcpu: The vcpu pointer
129129
* @val: the value guest writes to PMCNTENSET register
130130
*
131131
* Call perf_event_enable to start counting the perf event
132132
*/
133-
void kvm_pmu_enable_counter(struct kvm_vcpu *vcpu, u64 val)
133+
void kvm_pmu_enable_counter_mask(struct kvm_vcpu *vcpu, u64 val)
134134
{
135135
int i;
136136
struct kvm_pmu *pmu = &vcpu->arch.pmu;
@@ -153,13 +153,13 @@ void kvm_pmu_enable_counter(struct kvm_vcpu *vcpu, u64 val)
153153
}
154154

155155
/**
156-
* kvm_pmu_disable_counter - disable selected PMU counter
156+
* kvm_pmu_disable_counter_mask - disable selected PMU counters
157157
* @vcpu: The vcpu pointer
158158
* @val: the value guest writes to PMCNTENCLR register
159159
*
160160
* Call perf_event_disable to stop counting the perf event
161161
*/
162-
void kvm_pmu_disable_counter(struct kvm_vcpu *vcpu, u64 val)
162+
void kvm_pmu_disable_counter_mask(struct kvm_vcpu *vcpu, u64 val)
163163
{
164164
int i;
165165
struct kvm_pmu *pmu = &vcpu->arch.pmu;
@@ -336,10 +336,10 @@ void kvm_pmu_handle_pmcr(struct kvm_vcpu *vcpu, u64 val)
336336

337337
mask = kvm_pmu_valid_counter_mask(vcpu);
338338
if (val & ARMV8_PMU_PMCR_E) {
339-
kvm_pmu_enable_counter(vcpu,
339+
kvm_pmu_enable_counter_mask(vcpu,
340340
__vcpu_sys_reg(vcpu, PMCNTENSET_EL0) & mask);
341341
} else {
342-
kvm_pmu_disable_counter(vcpu, mask);
342+
kvm_pmu_disable_counter_mask(vcpu, mask);
343343
}
344344

345345
if (val & ARMV8_PMU_PMCR_C)

0 commit comments

Comments
 (0)