Lines Matching refs:hwc
105 perf_event_set_period(struct hw_perf_event *hwc, u64 min, u64 max, u64 *hw_period) in perf_event_set_period() argument
107 s64 left = local64_read(&hwc->period_left); in perf_event_set_period()
108 s64 period = hwc->sample_period; in perf_event_set_period()
116 local64_set(&hwc->period_left, left); in perf_event_set_period()
117 hwc->last_period = period; in perf_event_set_period()
123 local64_set(&hwc->period_left, left); in perf_event_set_period()
124 hwc->last_period = period; in perf_event_set_period()
150 struct hw_perf_event *hwc = &event->hw; in perf_event_try_update() local
162 prev_raw_count = local64_read(&hwc->prev_count); in perf_event_try_update()
163 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, in perf_event_try_update()
179 local64_sub(delta, &hwc->period_left); in perf_event_try_update()
256 struct hw_perf_event *hwc = &event->hw; in perf_ibs_init() local
272 if (hwc->sample_period) { in perf_ibs_init()
276 if (!event->attr.sample_freq && hwc->sample_period & 0x0f) in perf_ibs_init()
283 hwc->sample_period &= ~0x0FULL; in perf_ibs_init()
284 if (!hwc->sample_period) in perf_ibs_init()
285 hwc->sample_period = 0x10; in perf_ibs_init()
290 hwc->sample_period = event->attr.sample_period; in perf_ibs_init()
293 if (!hwc->sample_period) in perf_ibs_init()
300 hwc->last_period = hwc->sample_period; in perf_ibs_init()
301 local64_set(&hwc->period_left, hwc->sample_period); in perf_ibs_init()
303 hwc->config_base = perf_ibs->msr; in perf_ibs_init()
304 hwc->config = config; in perf_ibs_init()
320 struct hw_perf_event *hwc, u64 *period) in perf_ibs_set_period() argument
325 overflow = perf_event_set_period(hwc, 1<<4, perf_ibs->max_period, period); in perf_ibs_set_period()
326 local64_set(&hwc->prev_count, 0); in perf_ibs_set_period()
377 struct hw_perf_event *hwc, u64 config) in perf_ibs_enable_event() argument
379 u64 tmp = hwc->config | config; in perf_ibs_enable_event()
382 wrmsrl(hwc->config_base, tmp & ~perf_ibs->enable_mask); in perf_ibs_enable_event()
384 wrmsrl(hwc->config_base, tmp | perf_ibs->enable_mask); in perf_ibs_enable_event()
395 struct hw_perf_event *hwc, u64 config) in perf_ibs_disable_event() argument
399 wrmsrl(hwc->config_base, config); in perf_ibs_disable_event()
401 wrmsrl(hwc->config_base, config); in perf_ibs_disable_event()
412 struct hw_perf_event *hwc = &event->hw; in perf_ibs_start() local
417 if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED))) in perf_ibs_start()
420 WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE)); in perf_ibs_start()
421 hwc->state = 0; in perf_ibs_start()
423 perf_ibs_set_period(perf_ibs, hwc, &period); in perf_ibs_start()
436 perf_ibs_enable_event(perf_ibs, hwc, config); in perf_ibs_start()
443 struct hw_perf_event *hwc = &event->hw; in perf_ibs_stop() local
454 if (!stopping && (hwc->state & PERF_HES_UPTODATE)) in perf_ibs_stop()
457 rdmsrl(hwc->config_base, config); in perf_ibs_stop()
467 perf_ibs_disable_event(perf_ibs, hwc, config); in perf_ibs_stop()
478 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); in perf_ibs_stop()
479 hwc->state |= PERF_HES_STOPPED; in perf_ibs_stop()
482 if (hwc->state & PERF_HES_UPTODATE) in perf_ibs_stop()
492 hwc->state |= PERF_HES_UPTODATE; in perf_ibs_stop()
598 struct hw_perf_event *hwc; in perf_ibs_handle_irq() local
624 hwc = &event->hw; in perf_ibs_handle_irq()
625 msr = hwc->config_base; in perf_ibs_handle_irq()
633 perf_sample_data_init(&data, 0, hwc->last_period); in perf_ibs_handle_irq()
634 if (!perf_ibs_set_period(perf_ibs, hwc, &period)) in perf_ibs_handle_irq()
722 perf_ibs_enable_event(perf_ibs, hwc, new_config); in perf_ibs_handle_irq()