Lines Matching refs:cpu_pmu
31 static struct nds32_pmu *cpu_pmu; variable
34 static void nds32_pmu_start(struct nds32_pmu *cpu_pmu);
35 static void nds32_pmu_stop(struct nds32_pmu *cpu_pmu);
229 struct nds32_pmu *cpu_pmu = (struct nds32_pmu *)dev; in nds32_pmu_handle_irq() local
230 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events(); in nds32_pmu_handle_irq()
249 nds32_pmu_stop(cpu_pmu); in nds32_pmu_handle_irq()
250 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { in nds32_pmu_handle_irq()
272 cpu_pmu->disable(event); in nds32_pmu_handle_irq()
274 nds32_pmu_start(cpu_pmu); in nds32_pmu_handle_irq()
287 static inline int nds32_pfm_counter_valid(struct nds32_pmu *cpu_pmu, int idx) in nds32_pfm_counter_valid() argument
289 return ((idx >= 0) && (idx < cpu_pmu->num_events)); in nds32_pfm_counter_valid()
417 struct nds32_pmu *cpu_pmu = to_nds32_pmu(event->pmu); in nds32_pmu_enable_event() local
418 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); in nds32_pmu_enable_event()
421 if (!nds32_pfm_counter_valid(cpu_pmu, idx)) { in nds32_pmu_enable_event()
440 if ((!cpu_pmu->set_event_filter || in nds32_pmu_enable_event()
441 cpu_pmu->set_event_filter(hwc, &event->attr)) && in nds32_pmu_enable_event()
468 struct nds32_pmu *cpu_pmu = to_nds32_pmu(event->pmu); in nds32_pmu_disable_event() local
469 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); in nds32_pmu_disable_event()
472 if (!nds32_pfm_counter_valid(cpu_pmu, idx)) { in nds32_pmu_disable_event()
497 struct nds32_pmu *cpu_pmu = to_nds32_pmu(event->pmu); in nds32_pmu_read_counter() local
502 if (!nds32_pfm_counter_valid(cpu_pmu, idx)) { in nds32_pmu_read_counter()
526 struct nds32_pmu *cpu_pmu = to_nds32_pmu(event->pmu); in nds32_pmu_write_counter() local
530 if (!nds32_pfm_counter_valid(cpu_pmu, idx)) { in nds32_pmu_write_counter()
595 static void nds32_pmu_start(struct nds32_pmu *cpu_pmu) in nds32_pmu_start() argument
599 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); in nds32_pmu_start()
612 static void nds32_pmu_stop(struct nds32_pmu *cpu_pmu) in nds32_pmu_stop() argument
616 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); in nds32_pmu_stop()
641 static void nds32_pmu_init(struct nds32_pmu *cpu_pmu) in nds32_pmu_init() argument
643 cpu_pmu->handle_irq = nds32_pmu_handle_irq; in nds32_pmu_init()
644 cpu_pmu->enable = nds32_pmu_enable_event; in nds32_pmu_init()
645 cpu_pmu->disable = nds32_pmu_disable_event; in nds32_pmu_init()
646 cpu_pmu->read_counter = nds32_pmu_read_counter; in nds32_pmu_init()
647 cpu_pmu->write_counter = nds32_pmu_write_counter; in nds32_pmu_init()
648 cpu_pmu->get_event_idx = nds32_pmu_get_event_idx; in nds32_pmu_init()
649 cpu_pmu->start = nds32_pmu_start; in nds32_pmu_init()
650 cpu_pmu->stop = nds32_pmu_stop; in nds32_pmu_init()
651 cpu_pmu->reset = nds32_pmu_reset; in nds32_pmu_init()
652 cpu_pmu->max_period = 0xFFFFFFFF; /* Maximum counts */ in nds32_pmu_init()
661 static int device_pmu_init(struct nds32_pmu *cpu_pmu) in device_pmu_init() argument
663 nds32_pmu_init(cpu_pmu); in device_pmu_init()
668 cpu_pmu->name = "nds32v3-pmu"; in device_pmu_init()
669 cpu_pmu->map_event = nds32_spav3_map_event; in device_pmu_init()
670 cpu_pmu->num_events = nds32_read_num_pfm_events(); in device_pmu_init()
671 cpu_pmu->set_event_filter = nds32_pmu_set_event_filter; in device_pmu_init()
1071 static int cpu_pmu_request_irq(struct nds32_pmu *cpu_pmu, irq_handler_t handler) in cpu_pmu_request_irq() argument
1074 struct platform_device *pmu_device = cpu_pmu->plat_device; in cpu_pmu_request_irq()
1087 cpu_pmu); in cpu_pmu_request_irq()
1096 static void cpu_pmu_free_irq(struct nds32_pmu *cpu_pmu) in cpu_pmu_free_irq() argument
1099 struct platform_device *pmu_device = cpu_pmu->plat_device; in cpu_pmu_free_irq()
1103 free_irq(irq, cpu_pmu); in cpu_pmu_free_irq()
1106 static void cpu_pmu_init(struct nds32_pmu *cpu_pmu) in cpu_pmu_init() argument
1113 cpu_pmu->get_hw_events = cpu_pmu_get_cpu_events; in cpu_pmu_init()
1114 cpu_pmu->request_irq = cpu_pmu_request_irq; in cpu_pmu_init()
1115 cpu_pmu->free_irq = cpu_pmu_free_irq; in cpu_pmu_init()
1118 if (cpu_pmu->reset) in cpu_pmu_init()
1119 on_each_cpu(cpu_pmu->reset, cpu_pmu, 1); in cpu_pmu_init()
1136 if (cpu_pmu) { in cpu_pmu_device_probe()
1158 cpu_pmu = pmu; in cpu_pmu_device_probe()
1159 cpu_pmu->plat_device = pdev; in cpu_pmu_device_probe()
1160 cpu_pmu_init(cpu_pmu); in cpu_pmu_device_probe()
1161 ret = nds32_pmu_register(cpu_pmu, PERF_TYPE_RAW); in cpu_pmu_device_probe()