Lines Matching refs:cci_pmu

115 struct cci_pmu {  struct
129 static struct cci_pmu *pmu; argument
131 #define to_cci_pmu(c) (container_of(c, struct cci_pmu, pmu))
158 #define CCI_PMU_CNTR_LAST(cci_pmu) (CCI_PMU_CYCLE_CNTR_IDX + cci_pmu->num_events - 1) argument
236 static int pmu_is_valid_counter(struct cci_pmu *cci_pmu, int idx) in pmu_is_valid_counter() argument
239 idx <= CCI_PMU_CNTR_LAST(cci_pmu); in pmu_is_valid_counter()
278 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in pmu_get_event_idx() local
290 for (idx = CCI_PMU_CNTR0_IDX; idx <= CCI_PMU_CNTR_LAST(cci_pmu); ++idx) in pmu_get_event_idx()
314 static int pmu_request_irq(struct cci_pmu *cci_pmu, irq_handler_t handler) in pmu_request_irq() argument
317 struct platform_device *pmu_device = cci_pmu->plat_device; in pmu_request_irq()
336 "arm-cci-pmu", cci_pmu); in pmu_request_irq()
349 static void pmu_free_irq(struct cci_pmu *cci_pmu) in pmu_free_irq() argument
357 free_irq(pmu->irqs[i], cci_pmu); in pmu_free_irq()
363 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in pmu_read_counter() local
368 if (unlikely(!pmu_is_valid_counter(cci_pmu, idx))) { in pmu_read_counter()
369 dev_err(&cci_pmu->plat_device->dev, "Invalid CCI PMU counter %d\n", idx); in pmu_read_counter()
379 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in pmu_write_counter() local
383 if (unlikely(!pmu_is_valid_counter(cci_pmu, idx))) in pmu_write_counter()
384 dev_err(&cci_pmu->plat_device->dev, "Invalid CCI PMU counter %d\n", idx); in pmu_write_counter()
429 struct cci_pmu *cci_pmu = dev; in pmu_handle_irq() local
439 for (idx = CCI_PMU_CYCLE_CNTR_IDX; idx <= CCI_PMU_CNTR_LAST(cci_pmu); idx++) { in pmu_handle_irq()
464 static int cci_pmu_get_hw(struct cci_pmu *cci_pmu) in cci_pmu_get_hw() argument
466 int ret = pmu_request_irq(cci_pmu, pmu_handle_irq); in cci_pmu_get_hw()
468 pmu_free_irq(cci_pmu); in cci_pmu_get_hw()
474 static void cci_pmu_put_hw(struct cci_pmu *cci_pmu) in cci_pmu_put_hw() argument
476 pmu_free_irq(cci_pmu); in cci_pmu_put_hw()
481 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in hw_perf_event_destroy() local
482 atomic_t *active_events = &cci_pmu->active_events; in hw_perf_event_destroy()
483 struct mutex *reserve_mutex = &cci_pmu->reserve_mutex; in hw_perf_event_destroy()
486 cci_pmu_put_hw(cci_pmu); in hw_perf_event_destroy()
493 struct cci_pmu *cci_pmu = to_cci_pmu(pmu); in cci_pmu_enable() local
494 struct cci_pmu_hw_events *hw_events = &cci_pmu->hw_events; in cci_pmu_enable()
495 int enabled = bitmap_weight(hw_events->used_mask, cci_pmu->num_events); in cci_pmu_enable()
513 struct cci_pmu *cci_pmu = to_cci_pmu(pmu); in cci_pmu_disable() local
514 struct cci_pmu_hw_events *hw_events = &cci_pmu->hw_events; in cci_pmu_disable()
528 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in cci_pmu_start() local
529 struct cci_pmu_hw_events *hw_events = &cci_pmu->hw_events; in cci_pmu_start()
543 if (unlikely(!pmu_is_valid_counter(cci_pmu, idx))) { in cci_pmu_start()
544 dev_err(&cci_pmu->plat_device->dev, "Invalid CCI PMU counter %d\n", idx); in cci_pmu_start()
562 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in cci_pmu_stop() local
569 if (unlikely(!pmu_is_valid_counter(cci_pmu, idx))) { in cci_pmu_stop()
570 dev_err(&cci_pmu->plat_device->dev, "Invalid CCI PMU counter %d\n", idx); in cci_pmu_stop()
585 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in cci_pmu_add() local
586 struct cci_pmu_hw_events *hw_events = &cci_pmu->hw_events; in cci_pmu_add()
617 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in cci_pmu_del() local
618 struct cci_pmu_hw_events *hw_events = &cci_pmu->hw_events; in cci_pmu_del()
630 validate_event(struct pmu *cci_pmu, in validate_event() argument
642 if (event->pmu != cci_pmu) in validate_event()
728 struct cci_pmu *cci_pmu = to_cci_pmu(event->pmu); in cci_pmu_event_init() local
729 atomic_t *active_events = &cci_pmu->active_events; in cci_pmu_event_init()
758 cpu = cpumask_first(&cci_pmu->cpus); in cci_pmu_event_init()
765 mutex_lock(&cci_pmu->reserve_mutex); in cci_pmu_event_init()
767 err = cci_pmu_get_hw(cci_pmu); in cci_pmu_event_init()
770 mutex_unlock(&cci_pmu->reserve_mutex); in cci_pmu_event_init()
808 static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev) in cci_pmu_init() argument
810 char *name = cci_pmu->model->name; in cci_pmu_init()
811 cci_pmu->pmu = (struct pmu) { in cci_pmu_init()
812 .name = cci_pmu->model->name, in cci_pmu_init()
825 cci_pmu->plat_device = pdev; in cci_pmu_init()
826 cci_pmu->num_events = pmu_get_max_counters(); in cci_pmu_init()
828 return perf_pmu_register(&cci_pmu->pmu, name, -1); in cci_pmu_init()