Lines Matching refs:event

108 static inline u64 arm_pmu_event_max_period(struct perf_event *event)  in arm_pmu_event_max_period()  argument
110 if (event->hw.flags & ARMPMU_EVT_64BIT) in arm_pmu_event_max_period()
112 else if (event->hw.flags & ARMPMU_EVT_63BIT) in arm_pmu_event_max_period()
114 else if (event->hw.flags & ARMPMU_EVT_47BIT) in arm_pmu_event_max_period()
174 armpmu_map_event(struct perf_event *event, in armpmu_map_event() argument
182 u64 config = event->attr.config; in armpmu_map_event()
183 int type = event->attr.type; in armpmu_map_event()
185 if (type == event->pmu->type) in armpmu_map_event()
200 int armpmu_event_set_period(struct perf_event *event) in armpmu_event_set_period() argument
202 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in armpmu_event_set_period()
203 struct hw_perf_event *hwc = &event->hw; in armpmu_event_set_period()
209 max_period = arm_pmu_event_max_period(event); in armpmu_event_set_period()
235 armpmu->write_counter(event, (u64)(-left) & max_period); in armpmu_event_set_period()
237 perf_event_update_userpage(event); in armpmu_event_set_period()
242 u64 armpmu_event_update(struct perf_event *event) in armpmu_event_update() argument
244 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in armpmu_event_update()
245 struct hw_perf_event *hwc = &event->hw; in armpmu_event_update()
247 u64 max_period = arm_pmu_event_max_period(event); in armpmu_event_update()
251 new_raw_count = armpmu->read_counter(event); in armpmu_event_update()
259 local64_add(delta, &event->count); in armpmu_event_update()
266 armpmu_read(struct perf_event *event) in armpmu_read() argument
268 armpmu_event_update(event); in armpmu_read()
272 armpmu_stop(struct perf_event *event, int flags) in armpmu_stop() argument
274 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in armpmu_stop()
275 struct hw_perf_event *hwc = &event->hw; in armpmu_stop()
282 armpmu->disable(event); in armpmu_stop()
283 armpmu_event_update(event); in armpmu_stop()
288 static void armpmu_start(struct perf_event *event, int flags) in armpmu_start() argument
290 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in armpmu_start()
291 struct hw_perf_event *hwc = &event->hw; in armpmu_start()
308 armpmu_event_set_period(event); in armpmu_start()
309 armpmu->enable(event); in armpmu_start()
313 armpmu_del(struct perf_event *event, int flags) in armpmu_del() argument
315 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in armpmu_del()
317 struct hw_perf_event *hwc = &event->hw; in armpmu_del()
320 armpmu_stop(event, PERF_EF_UPDATE); in armpmu_del()
322 armpmu->clear_event_idx(hw_events, event); in armpmu_del()
323 perf_event_update_userpage(event); in armpmu_del()
329 armpmu_add(struct perf_event *event, int flags) in armpmu_add() argument
331 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in armpmu_add()
333 struct hw_perf_event *hwc = &event->hw; in armpmu_add()
341 idx = armpmu->get_event_idx(hw_events, event); in armpmu_add()
349 event->hw.idx = idx; in armpmu_add()
350 armpmu->disable(event); in armpmu_add()
351 hw_events->events[idx] = event; in armpmu_add()
355 armpmu_start(event, PERF_EF_RELOAD); in armpmu_add()
358 perf_event_update_userpage(event); in armpmu_add()
365 struct perf_event *event) in validate_event() argument
369 if (is_software_event(event)) in validate_event()
377 if (event->pmu != pmu) in validate_event()
380 if (event->state < PERF_EVENT_STATE_OFF) in validate_event()
383 if (event->state == PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec) in validate_event()
386 armpmu = to_arm_pmu(event->pmu); in validate_event()
387 return armpmu->get_event_idx(hw_events, event) >= 0; in validate_event()
391 validate_group(struct perf_event *event) in validate_group() argument
393 struct perf_event *sibling, *leader = event->group_leader; in validate_group()
402 if (!validate_event(event->pmu, &fake_pmu, leader)) in validate_group()
405 if (event == leader) in validate_group()
409 if (!validate_event(event->pmu, &fake_pmu, sibling)) in validate_group()
413 if (!validate_event(event->pmu, &fake_pmu, event)) in validate_group()
444 __hw_perf_event_init(struct perf_event *event) in __hw_perf_event_init() argument
446 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in __hw_perf_event_init()
447 struct hw_perf_event *hwc = &event->hw; in __hw_perf_event_init()
451 mapping = armpmu->map_event(event); in __hw_perf_event_init()
454 pr_debug("event %x:%llx not supported\n", event->attr.type, in __hw_perf_event_init()
455 event->attr.config); in __hw_perf_event_init()
474 ret = armpmu->set_event_filter(hwc, &event->attr); in __hw_perf_event_init()
484 if (!is_sampling_event(event)) { in __hw_perf_event_init()
491 hwc->sample_period = arm_pmu_event_max_period(event) >> 1; in __hw_perf_event_init()
496 return validate_group(event); in __hw_perf_event_init()
499 static int armpmu_event_init(struct perf_event *event) in armpmu_event_init() argument
501 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); in armpmu_event_init()
510 if (event->cpu != -1 && in armpmu_event_init()
511 !cpumask_test_cpu(event->cpu, &armpmu->supported_cpus)) in armpmu_event_init()
515 if (has_branch_stack(event)) in armpmu_event_init()
518 return __hw_perf_event_init(event); in armpmu_event_init()
742 struct perf_event *event; in cpu_pm_pmu_setup() local
746 event = hw_events->events[idx]; in cpu_pm_pmu_setup()
747 if (!event) in cpu_pm_pmu_setup()
755 armpmu_stop(event, PERF_EF_UPDATE); in cpu_pm_pmu_setup()
762 armpmu_start(event, PERF_EF_RELOAD); in cpu_pm_pmu_setup()