Lines Matching refs:event

21 static bool riscv_perf_user_access(struct perf_event *event)  in riscv_perf_user_access()  argument
23 return ((event->attr.type == PERF_TYPE_HARDWARE) || in riscv_perf_user_access()
24 (event->attr.type == PERF_TYPE_HW_CACHE) || in riscv_perf_user_access()
25 (event->attr.type == PERF_TYPE_RAW)) && in riscv_perf_user_access()
26 !!(event->hw.flags & PERF_EVENT_FLAG_USER_READ_CNT) && in riscv_perf_user_access()
27 (event->hw.idx != -1); in riscv_perf_user_access()
30 void arch_perf_update_userpage(struct perf_event *event, in arch_perf_update_userpage() argument
40 userpg->cap_user_rdpmc = riscv_perf_user_access(event); in arch_perf_update_userpage()
48 userpg->pmc_width = to_riscv_pmu(event->pmu)->ctr_get_width(event->hw.idx) + 1; in arch_perf_update_userpage()
145 u64 riscv_pmu_ctr_get_width_mask(struct perf_event *event) in riscv_pmu_ctr_get_width_mask() argument
148 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_ctr_get_width_mask()
149 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_ctr_get_width_mask()
160 u64 riscv_pmu_event_update(struct perf_event *event) in riscv_pmu_event_update() argument
162 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_event_update()
163 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_event_update()
171 cmask = riscv_pmu_ctr_get_width_mask(event); in riscv_pmu_event_update()
175 new_raw_count = rvpmu->ctr_read(event); in riscv_pmu_event_update()
181 local64_add(delta, &event->count); in riscv_pmu_event_update()
187 void riscv_pmu_stop(struct perf_event *event, int flags) in riscv_pmu_stop() argument
189 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_stop()
190 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_stop()
194 rvpmu->ctr_stop(event, 0); in riscv_pmu_stop()
197 riscv_pmu_event_update(event); in riscv_pmu_stop()
202 int riscv_pmu_event_set_period(struct perf_event *event) in riscv_pmu_event_set_period() argument
204 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_event_set_period()
208 uint64_t max_period = riscv_pmu_ctr_get_width_mask(event); in riscv_pmu_event_set_period()
235 perf_event_update_userpage(event); in riscv_pmu_event_set_period()
240 void riscv_pmu_start(struct perf_event *event, int flags) in riscv_pmu_start() argument
242 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_start()
243 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_start()
244 uint64_t max_period = riscv_pmu_ctr_get_width_mask(event); in riscv_pmu_start()
248 WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE)); in riscv_pmu_start()
251 riscv_pmu_event_set_period(event); in riscv_pmu_start()
253 rvpmu->ctr_start(event, init_val); in riscv_pmu_start()
254 perf_event_update_userpage(event); in riscv_pmu_start()
257 static int riscv_pmu_add(struct perf_event *event, int flags) in riscv_pmu_add() argument
259 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_add()
261 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_add()
264 idx = rvpmu->ctr_get_idx(event); in riscv_pmu_add()
269 cpuc->events[idx] = event; in riscv_pmu_add()
273 riscv_pmu_start(event, PERF_EF_RELOAD); in riscv_pmu_add()
276 perf_event_update_userpage(event); in riscv_pmu_add()
281 static void riscv_pmu_del(struct perf_event *event, int flags) in riscv_pmu_del() argument
283 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_del()
285 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_del()
287 riscv_pmu_stop(event, PERF_EF_UPDATE); in riscv_pmu_del()
291 rvpmu->ctr_stop(event, RISCV_PMU_STOP_FLAG_RESET); in riscv_pmu_del()
294 rvpmu->ctr_clear_idx(event); in riscv_pmu_del()
295 perf_event_update_userpage(event); in riscv_pmu_del()
299 static void riscv_pmu_read(struct perf_event *event) in riscv_pmu_read() argument
301 riscv_pmu_event_update(event); in riscv_pmu_read()
304 static int riscv_pmu_event_init(struct perf_event *event) in riscv_pmu_event_init() argument
306 struct hw_perf_event *hwc = &event->hw; in riscv_pmu_event_init()
307 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_event_init()
313 if (has_branch_stack(event)) in riscv_pmu_event_init()
317 mapped_event = rvpmu->event_map(event, &event_config); in riscv_pmu_event_init()
319 pr_debug("event %x:%llx not supported\n", event->attr.type, in riscv_pmu_event_init()
320 event->attr.config); in riscv_pmu_event_init()
335 rvpmu->event_init(event); in riscv_pmu_event_init()
337 if (!is_sampling_event(event)) { in riscv_pmu_event_init()
344 cmask = riscv_pmu_ctr_get_width_mask(event); in riscv_pmu_event_init()
353 static int riscv_pmu_event_idx(struct perf_event *event) in riscv_pmu_event_idx() argument
355 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_event_idx()
357 if (!(event->hw.flags & PERF_EVENT_FLAG_USER_READ_CNT)) in riscv_pmu_event_idx()
361 return rvpmu->csr_index(event) + 1; in riscv_pmu_event_idx()
366 static void riscv_pmu_event_mapped(struct perf_event *event, struct mm_struct *mm) in riscv_pmu_event_mapped() argument
368 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_event_mapped()
371 rvpmu->event_mapped(event, mm); in riscv_pmu_event_mapped()
372 perf_event_update_userpage(event); in riscv_pmu_event_mapped()
376 static void riscv_pmu_event_unmapped(struct perf_event *event, struct mm_struct *mm) in riscv_pmu_event_unmapped() argument
378 struct riscv_pmu *rvpmu = to_riscv_pmu(event->pmu); in riscv_pmu_event_unmapped()
381 rvpmu->event_unmapped(event, mm); in riscv_pmu_event_unmapped()
382 perf_event_update_userpage(event); in riscv_pmu_event_unmapped()