Lines Matching refs:event
276 * sysfs event attributes
890 static int xgene_perf_event_init(struct perf_event *event)
892 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
893 struct hw_perf_event *hw = &event->hw;
896 /* Test the event attr type check for PMU enumeration */
897 if (event->attr.type != event->pmu->type)
903 * Also, it does not support event sampling mode.
905 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
908 if (event->cpu < 0)
915 * event could be theoretically assigned to a different CPU. To
919 event->cpu = cpumask_first(&pmu_dev->parent->cpu);
921 hw->config = event->attr.config;
924 * request of the event come. The event is counted only if it's caused
926 * By default, the event is counted for all agents.
928 hw->config_base = event->attr.config1;
934 if (event->group_leader->pmu != event->pmu &&
935 !is_software_event(event->group_leader))
938 for_each_sibling_event(sibling, event->group_leader) {
939 if (sibling->pmu != event->pmu &&
947 static void xgene_perf_enable_event(struct perf_event *event)
949 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
952 xgene_pmu->ops->write_evttype(pmu_dev, GET_CNTR(event),
953 GET_EVENTID(event));
954 xgene_pmu->ops->write_agentmsk(pmu_dev, ~((u32)GET_AGENTID(event)));
957 ~((u32)GET_AGENT1ID(event)));
959 xgene_pmu->ops->enable_counter(pmu_dev, GET_CNTR(event));
960 xgene_pmu->ops->enable_counter_int(pmu_dev, GET_CNTR(event));
963 static void xgene_perf_disable_event(struct perf_event *event)
965 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
968 xgene_pmu->ops->disable_counter(pmu_dev, GET_CNTR(event));
969 xgene_pmu->ops->disable_counter_int(pmu_dev, GET_CNTR(event));
972 static void xgene_perf_event_set_period(struct perf_event *event)
974 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
976 struct hw_perf_event *hw = &event->hw;
990 static void xgene_perf_event_update(struct perf_event *event)
992 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
994 struct hw_perf_event *hw = &event->hw;
999 new_raw_count = xgene_pmu->ops->read_counter(pmu_dev, GET_CNTR(event));
1007 local64_add(delta, &event->count);
1010 static void xgene_perf_read(struct perf_event *event)
1012 xgene_perf_event_update(event);
1015 static void xgene_perf_start(struct perf_event *event, int flags)
1017 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
1019 struct hw_perf_event *hw = &event->hw;
1027 xgene_perf_event_set_period(event);
1032 xgene_pmu->ops->write_counter(pmu_dev, GET_CNTR(event),
1036 xgene_perf_enable_event(event);
1037 perf_event_update_userpage(event);
1040 static void xgene_perf_stop(struct perf_event *event, int flags)
1042 struct hw_perf_event *hw = &event->hw;
1047 xgene_perf_disable_event(event);
1054 xgene_perf_read(event);
1058 static int xgene_perf_add(struct perf_event *event, int flags)
1060 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
1061 struct hw_perf_event *hw = &event->hw;
1065 /* Allocate an event counter */
1070 /* Update counter event pointer for Interrupt handler */
1071 pmu_dev->pmu_counter_event[hw->idx] = event;
1074 xgene_perf_start(event, PERF_EF_RELOAD);
1079 static void xgene_perf_del(struct perf_event *event, int flags)
1081 struct xgene_pmu_dev *pmu_dev = to_pmu_dev(event->pmu);
1082 struct hw_perf_event *hw = &event->hw;
1084 xgene_perf_stop(event, PERF_EF_UPDATE);
1087 clear_avail_cntr(pmu_dev, GET_CNTR(event));
1089 perf_event_update_userpage(event);
1101 /* First version PMU supports only single event counter */
1218 struct perf_event *event = pmu_dev->pmu_counter_event[idx];
1221 /* Ignore if we don't have an event. */
1222 if (!event || !overflowed)
1224 xgene_perf_event_update(event);
1225 xgene_perf_event_set_period(event);