Lines Matching refs:event
136 static inline u32 get_event_type(struct perf_event *event) in get_event_type() argument
138 return (event->attr.config) & L3_EVTYPE_MASK; in get_event_type()
141 static inline bool event_uses_long_counter(struct perf_event *event) in event_uses_long_counter() argument
143 return !!(event->attr.config & BIT_ULL(L3_EVENT_LC_BIT)); in event_uses_long_counter()
146 static inline int event_num_counters(struct perf_event *event) in event_num_counters() argument
148 return event_uses_long_counter(event) ? 2 : 1; in event_num_counters()
175 void (*start)(struct perf_event *event);
177 void (*stop)(struct perf_event *event, int flags);
179 void (*update)(struct perf_event *event);
193 static void qcom_l3_cache__64bit_counter_start(struct perf_event *event) in qcom_l3_cache__64bit_counter_start() argument
195 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__64bit_counter_start()
196 int idx = event->hw.idx; in qcom_l3_cache__64bit_counter_start()
197 u32 evsel = get_event_type(event); in qcom_l3_cache__64bit_counter_start()
206 local64_set(&event->hw.prev_count, 0); in qcom_l3_cache__64bit_counter_start()
224 static void qcom_l3_cache__64bit_counter_stop(struct perf_event *event, in qcom_l3_cache__64bit_counter_stop() argument
227 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__64bit_counter_stop()
228 int idx = event->hw.idx; in qcom_l3_cache__64bit_counter_stop()
239 static void qcom_l3_cache__64bit_counter_update(struct perf_event *event) in qcom_l3_cache__64bit_counter_update() argument
241 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__64bit_counter_update()
242 int idx = event->hw.idx; in qcom_l3_cache__64bit_counter_update()
247 prev = local64_read(&event->hw.prev_count); in qcom_l3_cache__64bit_counter_update()
253 } while (local64_cmpxchg(&event->hw.prev_count, prev, new) != prev); in qcom_l3_cache__64bit_counter_update()
255 local64_add(new - prev, &event->count); in qcom_l3_cache__64bit_counter_update()
274 static void qcom_l3_cache__32bit_counter_start(struct perf_event *event) in qcom_l3_cache__32bit_counter_start() argument
276 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__32bit_counter_start()
277 int idx = event->hw.idx; in qcom_l3_cache__32bit_counter_start()
278 u32 evsel = get_event_type(event); in qcom_l3_cache__32bit_counter_start()
285 local64_set(&event->hw.prev_count, 0); in qcom_l3_cache__32bit_counter_start()
299 static void qcom_l3_cache__32bit_counter_stop(struct perf_event *event, in qcom_l3_cache__32bit_counter_stop() argument
302 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__32bit_counter_stop()
303 int idx = event->hw.idx; in qcom_l3_cache__32bit_counter_stop()
316 static void qcom_l3_cache__32bit_counter_update(struct perf_event *event) in qcom_l3_cache__32bit_counter_update() argument
318 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__32bit_counter_update()
319 int idx = event->hw.idx; in qcom_l3_cache__32bit_counter_update()
323 prev = local64_read(&event->hw.prev_count); in qcom_l3_cache__32bit_counter_update()
325 } while (local64_cmpxchg(&event->hw.prev_count, prev, new) != prev); in qcom_l3_cache__32bit_counter_update()
327 local64_add(new - prev, &event->count); in qcom_l3_cache__32bit_counter_update()
338 const struct l3cache_event_ops *l3cache_event_get_ops(struct perf_event *event) in l3cache_event_get_ops() argument
340 if (event_uses_long_counter(event)) in l3cache_event_get_ops()
402 struct perf_event *event; in qcom_l3_cache__handle_irq() local
405 event = l3pmu->events[idx]; in qcom_l3_cache__handle_irq()
406 if (!event) in qcom_l3_cache__handle_irq()
415 ops = l3cache_event_get_ops(event); in qcom_l3_cache__handle_irq()
416 ops->update(event); in qcom_l3_cache__handle_irq()
451 static bool qcom_l3_cache__validate_event_group(struct perf_event *event) in qcom_l3_cache__validate_event_group() argument
453 struct perf_event *leader = event->group_leader; in qcom_l3_cache__validate_event_group()
457 if (leader->pmu != event->pmu && !is_software_event(leader)) in qcom_l3_cache__validate_event_group()
460 counters = event_num_counters(event); in qcom_l3_cache__validate_event_group()
466 if (sibling->pmu != event->pmu) in qcom_l3_cache__validate_event_group()
478 static int qcom_l3_cache__event_init(struct perf_event *event) in qcom_l3_cache__event_init() argument
480 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__event_init()
481 struct hw_perf_event *hwc = &event->hw; in qcom_l3_cache__event_init()
486 if (event->attr.type != event->pmu->type) in qcom_l3_cache__event_init()
499 if (event->cpu < 0) in qcom_l3_cache__event_init()
503 if (!qcom_l3_cache__validate_event_group(event)) in qcom_l3_cache__event_init()
519 event->cpu = cpumask_first(&l3pmu->cpumask); in qcom_l3_cache__event_init()
524 static void qcom_l3_cache__event_start(struct perf_event *event, int flags) in qcom_l3_cache__event_start() argument
526 struct hw_perf_event *hwc = &event->hw; in qcom_l3_cache__event_start()
527 const struct l3cache_event_ops *ops = l3cache_event_get_ops(event); in qcom_l3_cache__event_start()
530 ops->start(event); in qcom_l3_cache__event_start()
533 static void qcom_l3_cache__event_stop(struct perf_event *event, int flags) in qcom_l3_cache__event_stop() argument
535 struct hw_perf_event *hwc = &event->hw; in qcom_l3_cache__event_stop()
536 const struct l3cache_event_ops *ops = l3cache_event_get_ops(event); in qcom_l3_cache__event_stop()
541 ops->stop(event, flags); in qcom_l3_cache__event_stop()
543 ops->update(event); in qcom_l3_cache__event_stop()
547 static int qcom_l3_cache__event_add(struct perf_event *event, int flags) in qcom_l3_cache__event_add() argument
549 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__event_add()
550 struct hw_perf_event *hwc = &event->hw; in qcom_l3_cache__event_add()
551 int order = event_uses_long_counter(event) ? 1 : 0; in qcom_l3_cache__event_add()
564 l3pmu->events[idx] = event; in qcom_l3_cache__event_add()
567 qcom_l3_cache__event_start(event, 0); in qcom_l3_cache__event_add()
570 perf_event_update_userpage(event); in qcom_l3_cache__event_add()
575 static void qcom_l3_cache__event_del(struct perf_event *event, int flags) in qcom_l3_cache__event_del() argument
577 struct l3cache_pmu *l3pmu = to_l3cache_pmu(event->pmu); in qcom_l3_cache__event_del()
578 struct hw_perf_event *hwc = &event->hw; in qcom_l3_cache__event_del()
579 int order = event_uses_long_counter(event) ? 1 : 0; in qcom_l3_cache__event_del()
582 qcom_l3_cache__event_stop(event, flags | PERF_EF_UPDATE); in qcom_l3_cache__event_del()
587 perf_event_update_userpage(event); in qcom_l3_cache__event_del()
590 static void qcom_l3_cache__event_read(struct perf_event *event) in qcom_l3_cache__event_read() argument
592 const struct l3cache_event_ops *ops = l3cache_event_get_ops(event); in qcom_l3_cache__event_read()
594 ops->update(event); in qcom_l3_cache__event_read()
628 L3CACHE_PMU_FORMAT_ATTR(event, "config:0-7"),