Lines Matching refs:event
49 /* L3C event IDs */
60 /* DMC event IDs */
111 void (*init_cntr_base)(struct perf_event *event,
113 void (*stop_event)(struct perf_event *event);
114 void (*start_event)(struct perf_event *event, int flags);
137 TX2_PMU_FORMAT_ATTR(event, event, "config:0-4");
138 TX2_PMU_FORMAT_ATTR(event_ccpi2, event, "config:0-9");
171 * sysfs event attributes
179 return sysfs_emit(buf, "event=0x%lx\n", (unsigned long) eattr->var);
322 static void init_cntr_base_l3c(struct perf_event *event,
325 struct hw_perf_event *hwc = &event->hw;
328 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
333 + L3C_COUNTER_CTL + (8 * GET_COUNTERID(event, cmask));
335 + L3C_COUNTER_DATA + (8 * GET_COUNTERID(event, cmask));
338 static void init_cntr_base_dmc(struct perf_event *event,
341 struct hw_perf_event *hwc = &event->hw;
344 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
351 + DMC_COUNTER_DATA + (0xc * GET_COUNTERID(event, cmask));
354 static void init_cntr_base_ccpi2(struct perf_event *event,
357 struct hw_perf_event *hwc = &event->hw;
363 + CCPI2_COUNTER_CTL + (4 * GET_COUNTERID(event, cmask));
367 static void uncore_start_event_l3c(struct perf_event *event, int flags)
370 struct hw_perf_event *hwc = &event->hw;
373 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
376 /* event id encoded in bits [07:03] */
377 val = GET_EVENTID(event, emask) << 3;
383 static inline void uncore_stop_event_l3c(struct perf_event *event)
385 reg_writel(0, event->hw.config_base);
388 static void uncore_start_event_dmc(struct perf_event *event, int flags)
391 struct hw_perf_event *hwc = &event->hw;
395 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
399 idx = GET_COUNTERID(event, cmask);
400 event_id = GET_EVENTID(event, emask);
403 * 8 bits for each counter, bits[05:01] of a counter to set event type.
413 static void uncore_stop_event_dmc(struct perf_event *event)
416 struct hw_perf_event *hwc = &event->hw;
420 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
422 idx = GET_COUNTERID(event, cmask);
424 /* clear event type(bits[05:01]) to stop counter */
430 static void uncore_start_event_ccpi2(struct perf_event *event, int flags)
433 struct hw_perf_event *hwc = &event->hw;
436 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
439 /* Bit [09:00] to set event id.
445 GET_EVENTID(event, emask)), hwc->config_base);
452 local64_set(&event->hw.prev_count, 0ULL);
455 static void uncore_stop_event_ccpi2(struct perf_event *event)
457 struct hw_perf_event *hwc = &event->hw;
463 static void tx2_uncore_event_update(struct perf_event *event)
466 struct hw_perf_event *hwc = &event->hw;
472 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
479 GET_COUNTERID(event, cmask),
493 /* DMC event data_transfers granularity is 16 Bytes, convert it to 64 */
495 GET_EVENTID(event, emask) == DMC_EVENT_DATA_TRANSFERS)
502 local64_add(delta * prorate_factor, &event->count);
528 struct perf_event *event, int *counters)
530 if (is_software_event(event))
533 if (event->pmu != pmu)
544 static bool tx2_uncore_validate_event_group(struct perf_event *event,
547 struct perf_event *sibling, *leader = event->group_leader;
550 if (event->group_leader == event)
553 if (!tx2_uncore_validate_event(event->pmu, leader, &counters))
557 if (!tx2_uncore_validate_event(event->pmu, sibling, &counters))
561 if (!tx2_uncore_validate_event(event->pmu, event, &counters))
572 static int tx2_uncore_event_init(struct perf_event *event)
574 struct hw_perf_event *hwc = &event->hw;
577 /* Test the event attr type check for PMU enumeration */
578 if (event->attr.type != event->pmu->type)
584 * Also, it does not support event sampling mode.
586 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
589 if (event->cpu < 0)
592 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
595 event->cpu = tx2_pmu->cpu;
597 if (event->attr.config >= tx2_pmu->max_events)
600 /* store event id */
601 hwc->config = event->attr.config;
604 if (!tx2_uncore_validate_event_group(event, tx2_pmu->max_counters))
610 static void tx2_uncore_event_start(struct perf_event *event, int flags)
612 struct hw_perf_event *hwc = &event->hw;
616 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
618 tx2_pmu->start_event(event, flags);
619 perf_event_update_userpage(event);
625 /* Start timer for first event */
634 static void tx2_uncore_event_stop(struct perf_event *event, int flags)
636 struct hw_perf_event *hwc = &event->hw;
642 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
643 tx2_pmu->stop_event(event);
647 tx2_uncore_event_update(event);
652 static int tx2_uncore_event_add(struct perf_event *event, int flags)
654 struct hw_perf_event *hwc = &event->hw;
657 tx2_pmu = pmu_to_tx2_pmu(event->pmu);
664 tx2_pmu->events[hwc->idx] = event;
666 tx2_pmu->init_cntr_base(event, tx2_pmu);
670 tx2_uncore_event_start(event, flags);
675 static void tx2_uncore_event_del(struct perf_event *event, int flags)
677 struct tx2_uncore_pmu *tx2_pmu = pmu_to_tx2_pmu(event->pmu);
678 struct hw_perf_event *hwc = &event->hw;
682 tx2_uncore_event_stop(event, PERF_EF_UPDATE);
685 free_counter(tx2_pmu, GET_COUNTERID(event, cmask));
687 perf_event_update_userpage(event);
698 static void tx2_uncore_event_read(struct perf_event *event)
700 tx2_uncore_event_update(event);
715 struct perf_event *event = tx2_pmu->events[idx];
717 tx2_uncore_event_update(event);
729 /* Perf event registration */