Lines Matching refs:hwc

103 perf_event_set_period(struct hw_perf_event *hwc, u64 min, u64 max, u64 *hw_period)  in perf_event_set_period()  argument
105 s64 left = local64_read(&hwc->period_left); in perf_event_set_period()
106 s64 period = hwc->sample_period; in perf_event_set_period()
114 local64_set(&hwc->period_left, left); in perf_event_set_period()
115 hwc->last_period = period; in perf_event_set_period()
121 local64_set(&hwc->period_left, left); in perf_event_set_period()
122 hwc->last_period = period; in perf_event_set_period()
148 struct hw_perf_event *hwc = &event->hw; in perf_event_try_update() local
160 prev_raw_count = local64_read(&hwc->prev_count); in perf_event_try_update()
161 if (!local64_try_cmpxchg(&hwc->prev_count, in perf_event_try_update()
177 local64_sub(delta, &hwc->period_left); in perf_event_try_update()
275 struct hw_perf_event *hwc = &event->hw; in perf_ibs_init() local
309 if (hwc->sample_period) { in perf_ibs_init()
313 if (!event->attr.sample_freq && hwc->sample_period & 0x0f) in perf_ibs_init()
320 hwc->sample_period &= ~0x0FULL; in perf_ibs_init()
321 if (!hwc->sample_period) in perf_ibs_init()
322 hwc->sample_period = 0x10; in perf_ibs_init()
327 hwc->sample_period = event->attr.sample_period; in perf_ibs_init()
330 if (!hwc->sample_period) in perf_ibs_init()
337 hwc->last_period = hwc->sample_period; in perf_ibs_init()
338 local64_set(&hwc->period_left, hwc->sample_period); in perf_ibs_init()
340 hwc->config_base = perf_ibs->msr; in perf_ibs_init()
341 hwc->config = config; in perf_ibs_init()
347 struct hw_perf_event *hwc, u64 *period) in perf_ibs_set_period() argument
352 overflow = perf_event_set_period(hwc, 1<<4, perf_ibs->max_period, period); in perf_ibs_set_period()
353 local64_set(&hwc->prev_count, 0); in perf_ibs_set_period()
404 struct hw_perf_event *hwc, u64 config) in perf_ibs_enable_event() argument
406 u64 tmp = hwc->config | config; in perf_ibs_enable_event()
409 wrmsrl(hwc->config_base, tmp & ~perf_ibs->enable_mask); in perf_ibs_enable_event()
411 wrmsrl(hwc->config_base, tmp | perf_ibs->enable_mask); in perf_ibs_enable_event()
422 struct hw_perf_event *hwc, u64 config) in perf_ibs_disable_event() argument
426 wrmsrl(hwc->config_base, config); in perf_ibs_disable_event()
428 wrmsrl(hwc->config_base, config); in perf_ibs_disable_event()
439 struct hw_perf_event *hwc = &event->hw; in perf_ibs_start() local
444 if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED))) in perf_ibs_start()
447 WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE)); in perf_ibs_start()
448 hwc->state = 0; in perf_ibs_start()
450 perf_ibs_set_period(perf_ibs, hwc, &period); in perf_ibs_start()
463 perf_ibs_enable_event(perf_ibs, hwc, config); in perf_ibs_start()
470 struct hw_perf_event *hwc = &event->hw; in perf_ibs_stop() local
481 if (!stopping && (hwc->state & PERF_HES_UPTODATE)) in perf_ibs_stop()
484 rdmsrl(hwc->config_base, config); in perf_ibs_stop()
494 perf_ibs_disable_event(perf_ibs, hwc, config); in perf_ibs_stop()
505 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); in perf_ibs_stop()
506 hwc->state |= PERF_HES_STOPPED; in perf_ibs_stop()
509 if (hwc->state & PERF_HES_UPTODATE) in perf_ibs_stop()
519 hwc->state |= PERF_HES_UPTODATE; in perf_ibs_stop()
1106 struct hw_perf_event *hwc; in perf_ibs_handle_irq() local
1133 hwc = &event->hw; in perf_ibs_handle_irq()
1134 msr = hwc->config_base; in perf_ibs_handle_irq()
1142 perf_sample_data_init(&data, 0, hwc->last_period); in perf_ibs_handle_irq()
1143 if (!perf_ibs_set_period(perf_ibs, hwc, &period)) in perf_ibs_handle_irq()
1246 perf_ibs_enable_event(perf_ibs, hwc, new_config); in perf_ibs_handle_irq()