Lines Matching refs:box

257 static inline bool uncore_mmio_is_valid_offset(struct intel_uncore_box *box,  in uncore_mmio_is_valid_offset()  argument
260 if (offset < box->pmu->type->mmio_map_size) in uncore_mmio_is_valid_offset()
264 offset, box->pmu->type->name); in uncore_mmio_is_valid_offset()
270 unsigned int uncore_mmio_box_ctl(struct intel_uncore_box *box) in uncore_mmio_box_ctl() argument
272 return box->pmu->type->box_ctl + in uncore_mmio_box_ctl()
273 box->pmu->type->mmio_offset * box->pmu->pmu_idx; in uncore_mmio_box_ctl()
276 static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box) in uncore_pci_box_ctl() argument
278 return box->pmu->type->box_ctl; in uncore_pci_box_ctl()
281 static inline unsigned uncore_pci_fixed_ctl(struct intel_uncore_box *box) in uncore_pci_fixed_ctl() argument
283 return box->pmu->type->fixed_ctl; in uncore_pci_fixed_ctl()
286 static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box) in uncore_pci_fixed_ctr() argument
288 return box->pmu->type->fixed_ctr; in uncore_pci_fixed_ctr()
292 unsigned uncore_pci_event_ctl(struct intel_uncore_box *box, int idx) in uncore_pci_event_ctl() argument
294 if (test_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags)) in uncore_pci_event_ctl()
295 return idx * 8 + box->pmu->type->event_ctl; in uncore_pci_event_ctl()
297 return idx * 4 + box->pmu->type->event_ctl; in uncore_pci_event_ctl()
301 unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_pci_perf_ctr() argument
303 return idx * 8 + box->pmu->type->perf_ctr; in uncore_pci_perf_ctr()
306 static inline unsigned uncore_msr_box_offset(struct intel_uncore_box *box) in uncore_msr_box_offset() argument
308 struct intel_uncore_pmu *pmu = box->pmu; in uncore_msr_box_offset()
314 static inline unsigned uncore_msr_box_ctl(struct intel_uncore_box *box) in uncore_msr_box_ctl() argument
316 if (!box->pmu->type->box_ctl) in uncore_msr_box_ctl()
318 return box->pmu->type->box_ctl + uncore_msr_box_offset(box); in uncore_msr_box_ctl()
321 static inline unsigned uncore_msr_fixed_ctl(struct intel_uncore_box *box) in uncore_msr_fixed_ctl() argument
323 if (!box->pmu->type->fixed_ctl) in uncore_msr_fixed_ctl()
325 return box->pmu->type->fixed_ctl + uncore_msr_box_offset(box); in uncore_msr_fixed_ctl()
328 static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box) in uncore_msr_fixed_ctr() argument
330 return box->pmu->type->fixed_ctr + uncore_msr_box_offset(box); in uncore_msr_fixed_ctr()
375 unsigned int uncore_freerunning_counter(struct intel_uncore_box *box, in uncore_freerunning_counter() argument
380 struct intel_uncore_pmu *pmu = box->pmu; in uncore_freerunning_counter()
390 unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) in uncore_msr_event_ctl() argument
392 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { in uncore_msr_event_ctl()
394 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); in uncore_msr_event_ctl()
396 return box->pmu->type->event_ctl + in uncore_msr_event_ctl()
397 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + in uncore_msr_event_ctl()
398 uncore_msr_box_offset(box); in uncore_msr_event_ctl()
403 unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_msr_perf_ctr() argument
405 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { in uncore_msr_perf_ctr()
407 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); in uncore_msr_perf_ctr()
409 return box->pmu->type->perf_ctr + in uncore_msr_perf_ctr()
410 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + in uncore_msr_perf_ctr()
411 uncore_msr_box_offset(box); in uncore_msr_perf_ctr()
416 unsigned uncore_fixed_ctl(struct intel_uncore_box *box) in uncore_fixed_ctl() argument
418 if (box->pci_dev || box->io_addr) in uncore_fixed_ctl()
419 return uncore_pci_fixed_ctl(box); in uncore_fixed_ctl()
421 return uncore_msr_fixed_ctl(box); in uncore_fixed_ctl()
425 unsigned uncore_fixed_ctr(struct intel_uncore_box *box) in uncore_fixed_ctr() argument
427 if (box->pci_dev || box->io_addr) in uncore_fixed_ctr()
428 return uncore_pci_fixed_ctr(box); in uncore_fixed_ctr()
430 return uncore_msr_fixed_ctr(box); in uncore_fixed_ctr()
434 unsigned uncore_event_ctl(struct intel_uncore_box *box, int idx) in uncore_event_ctl() argument
436 if (box->pci_dev || box->io_addr) in uncore_event_ctl()
437 return uncore_pci_event_ctl(box, idx); in uncore_event_ctl()
439 return uncore_msr_event_ctl(box, idx); in uncore_event_ctl()
443 unsigned uncore_perf_ctr(struct intel_uncore_box *box, int idx) in uncore_perf_ctr() argument
445 if (box->pci_dev || box->io_addr) in uncore_perf_ctr()
446 return uncore_pci_perf_ctr(box, idx); in uncore_perf_ctr()
448 return uncore_msr_perf_ctr(box, idx); in uncore_perf_ctr()
451 static inline int uncore_perf_ctr_bits(struct intel_uncore_box *box) in uncore_perf_ctr_bits() argument
453 return box->pmu->type->perf_ctr_bits; in uncore_perf_ctr_bits()
456 static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box) in uncore_fixed_ctr_bits() argument
458 return box->pmu->type->fixed_ctr_bits; in uncore_fixed_ctr_bits()
462 unsigned int uncore_freerunning_bits(struct intel_uncore_box *box, in uncore_freerunning_bits() argument
467 return box->pmu->type->freerunning[type].bits; in uncore_freerunning_bits()
470 static inline int uncore_num_freerunning(struct intel_uncore_box *box, in uncore_num_freerunning() argument
475 return box->pmu->type->freerunning[type].num_counters; in uncore_num_freerunning()
478 static inline int uncore_num_freerunning_types(struct intel_uncore_box *box, in uncore_num_freerunning_types() argument
481 return box->pmu->type->num_freerunning_types; in uncore_num_freerunning_types()
484 static inline bool check_valid_freerunning_event(struct intel_uncore_box *box, in check_valid_freerunning_event() argument
490 return (type < uncore_num_freerunning_types(box, event)) && in check_valid_freerunning_event()
491 (idx < uncore_num_freerunning(box, event)); in check_valid_freerunning_event()
494 static inline int uncore_num_counters(struct intel_uncore_box *box) in uncore_num_counters() argument
496 return box->pmu->type->num_counters; in uncore_num_counters()
508 static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box, in uncore_freerunning_hw_config() argument
517 static inline void uncore_disable_event(struct intel_uncore_box *box, in uncore_disable_event() argument
520 box->pmu->type->ops->disable_event(box, event); in uncore_disable_event()
523 static inline void uncore_enable_event(struct intel_uncore_box *box, in uncore_enable_event() argument
526 box->pmu->type->ops->enable_event(box, event); in uncore_enable_event()
529 static inline u64 uncore_read_counter(struct intel_uncore_box *box, in uncore_read_counter() argument
532 return box->pmu->type->ops->read_counter(box, event); in uncore_read_counter()
535 static inline void uncore_box_init(struct intel_uncore_box *box) in uncore_box_init() argument
537 if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { in uncore_box_init()
538 if (box->pmu->type->ops->init_box) in uncore_box_init()
539 box->pmu->type->ops->init_box(box); in uncore_box_init()
543 static inline void uncore_box_exit(struct intel_uncore_box *box) in uncore_box_exit() argument
545 if (test_and_clear_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) { in uncore_box_exit()
546 if (box->pmu->type->ops->exit_box) in uncore_box_exit()
547 box->pmu->type->ops->exit_box(box); in uncore_box_exit()
551 static inline bool uncore_box_is_fake(struct intel_uncore_box *box) in uncore_box_is_fake() argument
553 return (box->dieid < 0); in uncore_box_is_fake()
567 u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event);
568 void uncore_mmio_exit_box(struct intel_uncore_box *box);
569 u64 uncore_mmio_read_counter(struct intel_uncore_box *box,
571 void uncore_pmu_start_hrtimer(struct intel_uncore_box *box);
572 void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box);
578 void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *event);
580 uncore_get_constraint(struct intel_uncore_box *box, struct perf_event *event);
581 void uncore_put_constraint(struct intel_uncore_box *box, struct perf_event *event);
582 u64 uncore_shared_reg_config(struct intel_uncore_box *box, int idx);