diff options
Diffstat (limited to 'arch/x86/kvm/pmu.c')
-rw-r--r-- | arch/x86/kvm/pmu.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index cbecaa90399c..3dd6accb64ec 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c | |||
@@ -428,6 +428,15 @@ int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
428 | return 1; | 428 | return 1; |
429 | } | 429 | } |
430 | 430 | ||
431 | int kvm_pmu_check_pmc(struct kvm_vcpu *vcpu, unsigned pmc) | ||
432 | { | ||
433 | struct kvm_pmu *pmu = &vcpu->arch.pmu; | ||
434 | bool fixed = pmc & (1u << 30); | ||
435 | pmc &= ~(3u << 30); | ||
436 | return (!fixed && pmc >= pmu->nr_arch_gp_counters) || | ||
437 | (fixed && pmc >= pmu->nr_arch_fixed_counters); | ||
438 | } | ||
439 | |||
431 | int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data) | 440 | int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data) |
432 | { | 441 | { |
433 | struct kvm_pmu *pmu = &vcpu->arch.pmu; | 442 | struct kvm_pmu *pmu = &vcpu->arch.pmu; |