Lines Matching refs:hwc

111 perf_event_set_period(struct hw_perf_event *hwc, u64 min, u64 max, u64 *hw_period)  in perf_event_set_period()  argument
113 s64 left = local64_read(&hwc->period_left); in perf_event_set_period()
114 s64 period = hwc->sample_period; in perf_event_set_period()
122 local64_set(&hwc->period_left, left); in perf_event_set_period()
123 hwc->last_period = period; in perf_event_set_period()
129 local64_set(&hwc->period_left, left); in perf_event_set_period()
130 hwc->last_period = period; in perf_event_set_period()
156 struct hw_perf_event *hwc = &event->hw; in perf_event_try_update() local
168 prev_raw_count = local64_read(&hwc->prev_count); in perf_event_try_update()
169 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, in perf_event_try_update()
185 local64_sub(delta, &hwc->period_left); in perf_event_try_update()
258 struct hw_perf_event *hwc = &event->hw; in perf_ibs_init() local
279 if (hwc->sample_period) { in perf_ibs_init()
283 if (!event->attr.sample_freq && hwc->sample_period & 0x0f) in perf_ibs_init()
290 hwc->sample_period &= ~0x0FULL; in perf_ibs_init()
291 if (!hwc->sample_period) in perf_ibs_init()
292 hwc->sample_period = 0x10; in perf_ibs_init()
297 hwc->sample_period = event->attr.sample_period; in perf_ibs_init()
300 if (!hwc->sample_period) in perf_ibs_init()
307 hwc->last_period = hwc->sample_period; in perf_ibs_init()
308 local64_set(&hwc->period_left, hwc->sample_period); in perf_ibs_init()
310 hwc->config_base = perf_ibs->msr; in perf_ibs_init()
311 hwc->config = config; in perf_ibs_init()
317 struct hw_perf_event *hwc, u64 *period) in perf_ibs_set_period() argument
322 overflow = perf_event_set_period(hwc, 1<<4, perf_ibs->max_period, period); in perf_ibs_set_period()
323 local64_set(&hwc->prev_count, 0); in perf_ibs_set_period()
364 struct hw_perf_event *hwc, u64 config) in perf_ibs_enable_event() argument
366 wrmsrl(hwc->config_base, hwc->config | config | perf_ibs->enable_mask); in perf_ibs_enable_event()
377 struct hw_perf_event *hwc, u64 config) in perf_ibs_disable_event() argument
381 wrmsrl(hwc->config_base, config); in perf_ibs_disable_event()
383 wrmsrl(hwc->config_base, config); in perf_ibs_disable_event()
394 struct hw_perf_event *hwc = &event->hw; in perf_ibs_start() local
399 if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED))) in perf_ibs_start()
402 WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE)); in perf_ibs_start()
403 hwc->state = 0; in perf_ibs_start()
405 perf_ibs_set_period(perf_ibs, hwc, &period); in perf_ibs_start()
412 perf_ibs_enable_event(perf_ibs, hwc, period >> 4); in perf_ibs_start()
419 struct hw_perf_event *hwc = &event->hw; in perf_ibs_stop() local
430 if (!stopping && (hwc->state & PERF_HES_UPTODATE)) in perf_ibs_stop()
433 rdmsrl(hwc->config_base, config); in perf_ibs_stop()
443 perf_ibs_disable_event(perf_ibs, hwc, config); in perf_ibs_stop()
454 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); in perf_ibs_stop()
455 hwc->state |= PERF_HES_STOPPED; in perf_ibs_stop()
458 if (hwc->state & PERF_HES_UPTODATE) in perf_ibs_stop()
468 hwc->state |= PERF_HES_UPTODATE; in perf_ibs_stop()
573 struct hw_perf_event *hwc; in perf_ibs_handle_irq() local
599 hwc = &event->hw; in perf_ibs_handle_irq()
600 msr = hwc->config_base; in perf_ibs_handle_irq()
608 perf_sample_data_init(&data, 0, hwc->last_period); in perf_ibs_handle_irq()
609 if (!perf_ibs_set_period(perf_ibs, hwc, &period)) in perf_ibs_handle_irq()
675 perf_ibs_enable_event(perf_ibs, hwc, period); in perf_ibs_handle_irq()