Lines Matching full:pmc

11 #define pmc_to_pmu(pmc)   (&(pmc)->vcpu->arch.pmu)  argument
92 #define kvm_for_each_pmc(pmu, pmc, i, bitmap) \ argument
94 if (!(pmc = kvm_pmc_idx_to_pmc(pmu, i))) \
98 static inline u64 pmc_bitmask(struct kvm_pmc *pmc) in pmc_bitmask() argument
100 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_bitmask()
102 return pmu->counter_bitmask[pmc->type]; in pmc_bitmask()
105 static inline u64 pmc_read_counter(struct kvm_pmc *pmc) in pmc_read_counter() argument
109 counter = pmc->counter + pmc->emulated_counter; in pmc_read_counter()
111 if (pmc->perf_event && !pmc->is_paused) in pmc_read_counter()
112 counter += perf_event_read_value(pmc->perf_event, in pmc_read_counter()
115 return counter & pmc_bitmask(pmc); in pmc_read_counter()
118 void pmc_write_counter(struct kvm_pmc *pmc, u64 val);
120 static inline bool pmc_is_gp(struct kvm_pmc *pmc) in pmc_is_gp() argument
122 return pmc->type == KVM_PMC_GP; in pmc_is_gp()
125 static inline bool pmc_is_fixed(struct kvm_pmc *pmc) in pmc_is_fixed() argument
127 return pmc->type == KVM_PMC_FIXED; in pmc_is_fixed()
136 /* returns general purpose PMC with the specified MSR. Note that it can be
153 /* returns fixed PMC with the specified MSR */
168 static inline bool pmc_speculative_in_use(struct kvm_pmc *pmc) in pmc_speculative_in_use() argument
170 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_speculative_in_use()
172 if (pmc_is_fixed(pmc)) in pmc_speculative_in_use()
174 pmc->idx - KVM_FIXED_PMC_BASE_IDX) & in pmc_speculative_in_use()
177 return pmc->eventsel & ARCH_PERFMON_EVENTSEL_ENABLE; in pmc_speculative_in_use()
230 static inline void kvm_pmu_request_counter_reprogram(struct kvm_pmc *pmc) in kvm_pmu_request_counter_reprogram() argument
232 set_bit(pmc->idx, pmc_to_pmu(pmc)->reprogram_pmi); in kvm_pmu_request_counter_reprogram()
233 kvm_make_request(KVM_REQ_PMU, pmc->vcpu); in kvm_pmu_request_counter_reprogram()
249 * Check if a PMC is enabled by comparing it against global_ctrl bits.
253 static inline bool pmc_is_globally_enabled(struct kvm_pmc *pmc) in pmc_is_globally_enabled() argument
255 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_is_globally_enabled()
260 return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); in pmc_is_globally_enabled()
265 int kvm_pmu_rdpmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data);