Lines Matching full:pmc

9 #define pmc_to_pmu(pmc)   (&(pmc)->vcpu->arch.pmu)  argument
30 bool (*pmc_is_enabled)(struct kvm_pmc *pmc);
44 static inline u64 pmc_bitmask(struct kvm_pmc *pmc) in pmc_bitmask() argument
46 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_bitmask()
48 return pmu->counter_bitmask[pmc->type]; in pmc_bitmask()
51 static inline u64 pmc_read_counter(struct kvm_pmc *pmc) in pmc_read_counter() argument
55 counter = pmc->counter; in pmc_read_counter()
56 if (pmc->perf_event) in pmc_read_counter()
57 counter += perf_event_read_value(pmc->perf_event, in pmc_read_counter()
60 return counter & pmc_bitmask(pmc); in pmc_read_counter()
63 static inline void pmc_release_perf_event(struct kvm_pmc *pmc) in pmc_release_perf_event() argument
65 if (pmc->perf_event) { in pmc_release_perf_event()
66 perf_event_release_kernel(pmc->perf_event); in pmc_release_perf_event()
67 pmc->perf_event = NULL; in pmc_release_perf_event()
68 pmc->current_config = 0; in pmc_release_perf_event()
69 pmc_to_pmu(pmc)->event_count--; in pmc_release_perf_event()
73 static inline void pmc_stop_counter(struct kvm_pmc *pmc) in pmc_stop_counter() argument
75 if (pmc->perf_event) { in pmc_stop_counter()
76 pmc->counter = pmc_read_counter(pmc); in pmc_stop_counter()
77 pmc_release_perf_event(pmc); in pmc_stop_counter()
81 static inline bool pmc_is_gp(struct kvm_pmc *pmc) in pmc_is_gp() argument
83 return pmc->type == KVM_PMC_GP; in pmc_is_gp()
86 static inline bool pmc_is_fixed(struct kvm_pmc *pmc) in pmc_is_fixed() argument
88 return pmc->type == KVM_PMC_FIXED; in pmc_is_fixed()
91 static inline bool pmc_is_enabled(struct kvm_pmc *pmc) in pmc_is_enabled() argument
93 return kvm_x86_ops.pmu_ops->pmc_is_enabled(pmc); in pmc_is_enabled()
102 /* returns general purpose PMC with the specified MSR. Note that it can be
119 /* returns fixed PMC with the specified MSR */
134 static inline u64 get_sample_period(struct kvm_pmc *pmc, u64 counter_value) in get_sample_period() argument
136 u64 sample_period = (-counter_value) & pmc_bitmask(pmc); in get_sample_period()
139 sample_period = pmc_bitmask(pmc) + 1; in get_sample_period()
143 void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel);
144 void reprogram_fixed_counter(struct kvm_pmc *pmc, u8 ctrl, int fixed_idx);
149 int kvm_pmu_rdpmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data);