Lines Matching full:pmu

34 	struct kvm_pmu *pmu;  in kvm_pmc_to_vcpu()  local
38 pmu = container_of(pmc, struct kvm_pmu, pmc[0]); in kvm_pmc_to_vcpu()
39 vcpu_arch = container_of(pmu, struct kvm_vcpu_arch, pmu); in kvm_pmc_to_vcpu()
45 * @pmc: The PMU counter pointer
51 return test_bit(pmc->idx >> 1, vcpu->arch.pmu.chained); in kvm_pmu_pmc_is_chained()
65 * @pmc: The PMU counter pointer
100 * kvm_pmu_get_pair_counter_value - get PMU counter value
102 * @pmc: The PMU counter pointer
135 * kvm_pmu_get_counter_value - get PMU counter value
142 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_get_counter_value() local
143 struct kvm_pmc *pmc = &pmu->pmc[select_idx]; in kvm_pmu_get_counter_value()
157 * kvm_pmu_set_counter_value - set PMU counter value
176 * @pmc: The PMU counter pointer
189 * kvm_pmu_stop_counter - stop PMU counter
190 * @pmc: The PMU counter pointer
221 * kvm_pmu_vcpu_init - assign pmu counter idx for cpu
228 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_vcpu_init() local
231 pmu->pmc[i].idx = i; in kvm_pmu_vcpu_init()
235 * kvm_pmu_vcpu_reset - reset pmu state for cpu
242 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_vcpu_reset() local
245 kvm_pmu_stop_counter(vcpu, &pmu->pmc[i]); in kvm_pmu_vcpu_reset()
247 bitmap_zero(vcpu->arch.pmu.chained, ARMV8_PMU_MAX_COUNTER_PAIRS); in kvm_pmu_vcpu_reset()
251 * kvm_pmu_vcpu_destroy - free perf event of PMU for cpu
258 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_vcpu_destroy() local
261 kvm_pmu_release_perf_event(&pmu->pmc[i]); in kvm_pmu_vcpu_destroy()
276 * kvm_pmu_enable_counter_mask - enable selected PMU counters
285 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_enable_counter_mask() local
295 pmc = &pmu->pmc[i]; in kvm_pmu_enable_counter_mask()
317 * kvm_pmu_disable_counter_mask - disable selected PMU counters
326 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_disable_counter_mask() local
336 pmc = &pmu->pmc[i]; in kvm_pmu_disable_counter_mask()
370 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_update_state() local
377 if (pmu->irq_level == overflow) in kvm_pmu_update_state()
380 pmu->irq_level = overflow; in kvm_pmu_update_state()
384 pmu->irq_num, overflow, pmu); in kvm_pmu_update_state()
391 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_should_notify_user() local
398 return pmu->irq_level != run_level; in kvm_pmu_should_notify_user()
402 * Reflect the PMU overflow interrupt output level into the kvm_run structure
410 if (vcpu->arch.pmu.irq_level) in kvm_pmu_update_run()
415 * kvm_pmu_flush_hwstate - flush pmu state to cpu
418 * Check if the PMU has overflowed while we were running in the host, and inject
427 * kvm_pmu_sync_hwstate - sync pmu state from cpu
430 * Check if the PMU has overflowed while we were running in the guest, and
446 struct arm_pmu *cpu_pmu = to_arm_pmu(perf_event->pmu); in kvm_pmu_perf_overflow()
451 cpu_pmu->pmu.stop(perf_event, PERF_EF_UPDATE); in kvm_pmu_perf_overflow()
473 cpu_pmu->pmu.start(perf_event, PERF_EF_RELOAD); in kvm_pmu_perf_overflow()
546 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_create_perf_event() local
557 pmc = kvm_pmu_get_canonical_pmc(&pmu->pmc[select_idx]); in kvm_pmu_create_perf_event()
610 pr_err_once("kvm: pmu event creation failed %ld\n", in kvm_pmu_create_perf_event()
628 struct kvm_pmu *pmu = &vcpu->arch.pmu; in kvm_pmu_update_pmc_chained() local
629 struct kvm_pmc *pmc = &pmu->pmc[select_idx]; in kvm_pmu_update_pmc_chained()
639 set_bit(pmc->idx >> 1, vcpu->arch.pmu.chained); in kvm_pmu_update_pmc_chained()
641 clear_bit(pmc->idx >> 1, vcpu->arch.pmu.chained); in kvm_pmu_update_pmc_chained()
674 * a physical PMU and CONFIG_PERF_EVENT is selected. in kvm_arm_support_pmu_v3()
681 if (!vcpu->arch.pmu.created) in kvm_arm_pmu_v3_enable()
685 * A valid interrupt configuration for the PMU is either to have a in kvm_arm_pmu_v3_enable()
690 int irq = vcpu->arch.pmu.irq_num; in kvm_arm_pmu_v3_enable()
696 * the vgic will be initialized, so we can check the PMU irq in kvm_arm_pmu_v3_enable()
707 vcpu->arch.pmu.ready = true; in kvm_arm_pmu_v3_enable()
720 if (vcpu->arch.pmu.created) in kvm_arm_pmu_v3_init()
727 * If using the PMU with an in-kernel virtual GIC in kvm_arm_pmu_v3_init()
729 * initialized when initializing the PMU. in kvm_arm_pmu_v3_init()
737 ret = kvm_vgic_set_owner(vcpu, vcpu->arch.pmu.irq_num, in kvm_arm_pmu_v3_init()
738 &vcpu->arch.pmu); in kvm_arm_pmu_v3_init()
743 vcpu->arch.pmu.created = true; in kvm_arm_pmu_v3_init()
762 if (vcpu->arch.pmu.irq_num != irq) in pmu_irq_is_valid()
765 if (vcpu->arch.pmu.irq_num == irq) in pmu_irq_is_valid()
789 /* The PMU overflow interrupt can be a PPI or a valid SPI. */ in kvm_arm_pmu_v3_set_attr()
799 kvm_debug("Set kvm ARM PMU irq: %d\n", irq); in kvm_arm_pmu_v3_set_attr()
800 vcpu->arch.pmu.irq_num = irq; in kvm_arm_pmu_v3_set_attr()
826 irq = vcpu->arch.pmu.irq_num; in kvm_arm_pmu_v3_get_attr()