Lines Matching full:pmc
9 #define pmc_to_pmu(pmc) (&(pmc)->vcpu->arch.pmu) argument
28 bool (*pmc_is_enabled)(struct kvm_pmc *pmc);
41 static inline u64 pmc_bitmask(struct kvm_pmc *pmc) in pmc_bitmask() argument
43 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_bitmask()
45 return pmu->counter_bitmask[pmc->type]; in pmc_bitmask()
48 static inline u64 pmc_read_counter(struct kvm_pmc *pmc) in pmc_read_counter() argument
52 counter = pmc->counter; in pmc_read_counter()
53 if (pmc->perf_event) in pmc_read_counter()
54 counter += perf_event_read_value(pmc->perf_event, in pmc_read_counter()
57 return counter & pmc_bitmask(pmc); in pmc_read_counter()
60 static inline void pmc_stop_counter(struct kvm_pmc *pmc) in pmc_stop_counter() argument
62 if (pmc->perf_event) { in pmc_stop_counter()
63 pmc->counter = pmc_read_counter(pmc); in pmc_stop_counter()
64 perf_event_release_kernel(pmc->perf_event); in pmc_stop_counter()
65 pmc->perf_event = NULL; in pmc_stop_counter()
69 static inline bool pmc_is_gp(struct kvm_pmc *pmc) in pmc_is_gp() argument
71 return pmc->type == KVM_PMC_GP; in pmc_is_gp()
74 static inline bool pmc_is_fixed(struct kvm_pmc *pmc) in pmc_is_fixed() argument
76 return pmc->type == KVM_PMC_FIXED; in pmc_is_fixed()
79 static inline bool pmc_is_enabled(struct kvm_pmc *pmc) in pmc_is_enabled() argument
81 return kvm_x86_ops->pmu_ops->pmc_is_enabled(pmc); in pmc_is_enabled()
84 /* returns general purpose PMC with the specified MSR. Note that it can be
101 /* returns fixed PMC with the specified MSR */
116 void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel);
117 void reprogram_fixed_counter(struct kvm_pmc *pmc, u8 ctrl, int fixed_idx);
122 int kvm_pmu_rdpmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data);