Lines Matching refs:pmu

9 #define vcpu_to_pmu(vcpu) (&(vcpu)->arch.pmu)
10 #define pmu_to_vcpu(pmu) (container_of((pmu), struct kvm_vcpu, arch.pmu)) argument
11 #define pmc_to_pmu(pmc) (&(pmc)->vcpu->arch.pmu)
52 static inline bool kvm_pmu_has_perf_global_ctrl(struct kvm_pmu *pmu) in kvm_pmu_has_perf_global_ctrl() argument
63 return pmu->version > 1; in kvm_pmu_has_perf_global_ctrl()
80 static inline struct kvm_pmc *kvm_pmc_idx_to_pmc(struct kvm_pmu *pmu, int idx) in kvm_pmc_idx_to_pmc() argument
82 if (idx < pmu->nr_arch_gp_counters) in kvm_pmc_idx_to_pmc()
83 return &pmu->gp_counters[idx]; in kvm_pmc_idx_to_pmc()
86 if (idx >= 0 && idx < pmu->nr_arch_fixed_counters) in kvm_pmc_idx_to_pmc()
87 return &pmu->fixed_counters[idx]; in kvm_pmc_idx_to_pmc()
92 #define kvm_for_each_pmc(pmu, pmc, i, bitmap) \ argument
94 if (!(pmc = kvm_pmc_idx_to_pmc(pmu, i))) \
100 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_bitmask() local
102 return pmu->counter_bitmask[pmc->type]; in pmc_bitmask()
130 static inline bool kvm_valid_perf_global_ctrl(struct kvm_pmu *pmu, in kvm_valid_perf_global_ctrl() argument
133 return !(pmu->global_ctrl_rsvd & data); in kvm_valid_perf_global_ctrl()
140 static inline struct kvm_pmc *get_gp_pmc(struct kvm_pmu *pmu, u32 msr, in get_gp_pmc() argument
143 if (msr >= base && msr < base + pmu->nr_arch_gp_counters) { in get_gp_pmc()
145 pmu->nr_arch_gp_counters); in get_gp_pmc()
147 return &pmu->gp_counters[index]; in get_gp_pmc()
154 static inline struct kvm_pmc *get_fixed_pmc(struct kvm_pmu *pmu, u32 msr) in get_fixed_pmc() argument
158 if (msr >= base && msr < base + pmu->nr_arch_fixed_counters) { in get_fixed_pmc()
160 pmu->nr_arch_fixed_counters); in get_fixed_pmc()
162 return &pmu->fixed_counters[index]; in get_fixed_pmc()
170 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_speculative_in_use() local
173 return fixed_ctrl_field(pmu->fixed_ctr_ctrl, in pmc_speculative_in_use()
236 static inline void reprogram_counters(struct kvm_pmu *pmu, u64 diff) in reprogram_counters() argument
244 set_bit(bit, pmu->reprogram_pmi); in reprogram_counters()
245 kvm_make_request(KVM_REQ_PMU, pmu_to_vcpu(pmu)); in reprogram_counters()
255 struct kvm_pmu *pmu = pmc_to_pmu(pmc); in pmc_is_globally_enabled() local
257 if (!kvm_pmu_has_perf_global_ctrl(pmu)) in pmc_is_globally_enabled()
260 return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); in pmc_is_globally_enabled()