• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <linux/slab.h>
3 #include <linux/pci.h>
4 #include <asm/apicdef.h>
5 #include <linux/io-64-nonatomic-lo-hi.h>
6 
7 #include <linux/perf_event.h>
8 #include "../perf_event.h"
9 
10 #define UNCORE_PMU_NAME_LEN		32
11 #define UNCORE_PMU_HRTIMER_INTERVAL	(60LL * NSEC_PER_SEC)
12 #define UNCORE_SNB_IMC_HRTIMER_INTERVAL (5ULL * NSEC_PER_SEC)
13 
14 #define UNCORE_FIXED_EVENT		0xff
15 #define UNCORE_PMC_IDX_MAX_GENERIC	8
16 #define UNCORE_PMC_IDX_MAX_FIXED	1
17 #define UNCORE_PMC_IDX_MAX_FREERUNNING	1
18 #define UNCORE_PMC_IDX_FIXED		UNCORE_PMC_IDX_MAX_GENERIC
19 #define UNCORE_PMC_IDX_FREERUNNING	(UNCORE_PMC_IDX_FIXED + \
20 					UNCORE_PMC_IDX_MAX_FIXED)
21 #define UNCORE_PMC_IDX_MAX		(UNCORE_PMC_IDX_FREERUNNING + \
22 					UNCORE_PMC_IDX_MAX_FREERUNNING)
23 
24 #define UNCORE_PCI_DEV_FULL_DATA(dev, func, type, idx)	\
25 		((dev << 24) | (func << 16) | (type << 8) | idx)
26 #define UNCORE_PCI_DEV_DATA(type, idx)	((type << 8) | idx)
27 #define UNCORE_PCI_DEV_DEV(data)	((data >> 24) & 0xff)
28 #define UNCORE_PCI_DEV_FUNC(data)	((data >> 16) & 0xff)
29 #define UNCORE_PCI_DEV_TYPE(data)	((data >> 8) & 0xff)
30 #define UNCORE_PCI_DEV_IDX(data)	(data & 0xff)
31 #define UNCORE_EXTRA_PCI_DEV		0xff
32 #define UNCORE_EXTRA_PCI_DEV_MAX	4
33 
34 #define UNCORE_EVENT_CONSTRAINT(c, n) EVENT_CONSTRAINT(c, n, 0xff)
35 
36 struct pci_extra_dev {
37 	struct pci_dev *dev[UNCORE_EXTRA_PCI_DEV_MAX];
38 };
39 
40 struct intel_uncore_ops;
41 struct intel_uncore_pmu;
42 struct intel_uncore_box;
43 struct uncore_event_desc;
44 struct freerunning_counters;
45 
46 struct intel_uncore_type {
47 	const char *name;
48 	int num_counters;
49 	int num_boxes;
50 	int perf_ctr_bits;
51 	int fixed_ctr_bits;
52 	int num_freerunning_types;
53 	unsigned perf_ctr;
54 	unsigned event_ctl;
55 	unsigned event_mask;
56 	unsigned event_mask_ext;
57 	unsigned fixed_ctr;
58 	unsigned fixed_ctl;
59 	unsigned box_ctl;
60 	union {
61 		unsigned msr_offset;
62 		unsigned mmio_offset;
63 	};
64 	unsigned mmio_map_size;
65 	unsigned num_shared_regs:8;
66 	unsigned single_fixed:1;
67 	unsigned pair_ctr_ctl:1;
68 	unsigned *msr_offsets;
69 	struct event_constraint unconstrainted;
70 	struct event_constraint *constraints;
71 	struct intel_uncore_pmu *pmus;
72 	struct intel_uncore_ops *ops;
73 	struct uncore_event_desc *event_descs;
74 	struct freerunning_counters *freerunning;
75 	const struct attribute_group *attr_groups[4];
76 	const struct attribute_group **attr_update;
77 	struct pmu *pmu; /* for custom pmu ops */
78 	/*
79 	 * Uncore PMU would store relevant platform topology configuration here
80 	 * to identify which platform component each PMON block of that type is
81 	 * supposed to monitor.
82 	 */
83 	u64 *topology;
84 	/*
85 	 * Optional callbacks for managing mapping of Uncore units to PMONs
86 	 */
87 	int (*get_topology)(struct intel_uncore_type *type);
88 	int (*set_mapping)(struct intel_uncore_type *type);
89 	void (*cleanup_mapping)(struct intel_uncore_type *type);
90 };
91 
92 #define pmu_group attr_groups[0]
93 #define format_group attr_groups[1]
94 #define events_group attr_groups[2]
95 
96 struct intel_uncore_ops {
97 	void (*init_box)(struct intel_uncore_box *);
98 	void (*exit_box)(struct intel_uncore_box *);
99 	void (*disable_box)(struct intel_uncore_box *);
100 	void (*enable_box)(struct intel_uncore_box *);
101 	void (*disable_event)(struct intel_uncore_box *, struct perf_event *);
102 	void (*enable_event)(struct intel_uncore_box *, struct perf_event *);
103 	u64 (*read_counter)(struct intel_uncore_box *, struct perf_event *);
104 	int (*hw_config)(struct intel_uncore_box *, struct perf_event *);
105 	struct event_constraint *(*get_constraint)(struct intel_uncore_box *,
106 						   struct perf_event *);
107 	void (*put_constraint)(struct intel_uncore_box *, struct perf_event *);
108 };
109 
110 struct intel_uncore_pmu {
111 	struct pmu			pmu;
112 	char				name[UNCORE_PMU_NAME_LEN];
113 	int				pmu_idx;
114 	int				func_id;
115 	bool				registered;
116 	atomic_t			activeboxes;
117 	struct intel_uncore_type	*type;
118 	struct intel_uncore_box		**boxes;
119 };
120 
121 struct intel_uncore_extra_reg {
122 	raw_spinlock_t lock;
123 	u64 config, config1, config2;
124 	atomic_t ref;
125 };
126 
127 struct intel_uncore_box {
128 	int pci_phys_id;
129 	int dieid;	/* Logical die ID */
130 	int n_active;	/* number of active events */
131 	int n_events;
132 	int cpu;	/* cpu to collect events */
133 	unsigned long flags;
134 	atomic_t refcnt;
135 	struct perf_event *events[UNCORE_PMC_IDX_MAX];
136 	struct perf_event *event_list[UNCORE_PMC_IDX_MAX];
137 	struct event_constraint *event_constraint[UNCORE_PMC_IDX_MAX];
138 	unsigned long active_mask[BITS_TO_LONGS(UNCORE_PMC_IDX_MAX)];
139 	u64 tags[UNCORE_PMC_IDX_MAX];
140 	struct pci_dev *pci_dev;
141 	struct intel_uncore_pmu *pmu;
142 	u64 hrtimer_duration; /* hrtimer timeout for this box */
143 	struct hrtimer hrtimer;
144 	struct list_head list;
145 	struct list_head active_list;
146 	void __iomem *io_addr;
147 	struct intel_uncore_extra_reg shared_regs[];
148 };
149 
150 /* CFL uncore 8th cbox MSRs */
151 #define CFL_UNC_CBO_7_PERFEVTSEL0		0xf70
152 #define CFL_UNC_CBO_7_PER_CTR0			0xf76
153 
154 #define UNCORE_BOX_FLAG_INITIATED		0
155 /* event config registers are 8-byte apart */
156 #define UNCORE_BOX_FLAG_CTL_OFFS8		1
157 /* CFL 8th CBOX has different MSR space */
158 #define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS	2
159 
160 struct uncore_event_desc {
161 	struct device_attribute attr;
162 	const char *config;
163 };
164 
165 struct freerunning_counters {
166 	unsigned int counter_base;
167 	unsigned int counter_offset;
168 	unsigned int box_offset;
169 	unsigned int num_counters;
170 	unsigned int bits;
171 	unsigned *box_offsets;
172 };
173 
174 struct pci2phy_map {
175 	struct list_head list;
176 	int segment;
177 	int pbus_to_physid[256];
178 };
179 
180 struct pci2phy_map *__find_pci2phy_map(int segment);
181 int uncore_pcibus_to_physid(struct pci_bus *bus);
182 
183 ssize_t uncore_event_show(struct device *dev,
184 			  struct device_attribute *attr, char *buf);
185 
dev_to_uncore_pmu(struct device * dev)186 static inline struct intel_uncore_pmu *dev_to_uncore_pmu(struct device *dev)
187 {
188 	return container_of(dev_get_drvdata(dev), struct intel_uncore_pmu, pmu);
189 }
190 
191 #define to_device_attribute(n)	container_of(n, struct device_attribute, attr)
192 #define to_dev_ext_attribute(n)	container_of(n, struct dev_ext_attribute, attr)
193 #define attr_to_ext_attr(n)	to_dev_ext_attribute(to_device_attribute(n))
194 
195 extern int __uncore_max_dies;
196 #define uncore_max_dies()	(__uncore_max_dies)
197 
198 #define INTEL_UNCORE_EVENT_DESC(_name, _config)			\
199 {								\
200 	.attr	= __ATTR(_name, 0444, uncore_event_show, NULL),	\
201 	.config	= _config,					\
202 }
203 
204 #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format)			\
205 static ssize_t __uncore_##_var##_show(struct device *dev,		\
206 				struct device_attribute *attr,		\
207 				char *page)				\
208 {									\
209 	BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE);			\
210 	return sprintf(page, _format "\n");				\
211 }									\
212 static struct device_attribute format_attr_##_var =			\
213 	__ATTR(_name, 0444, __uncore_##_var##_show, NULL)
214 
uncore_pmc_fixed(int idx)215 static inline bool uncore_pmc_fixed(int idx)
216 {
217 	return idx == UNCORE_PMC_IDX_FIXED;
218 }
219 
uncore_pmc_freerunning(int idx)220 static inline bool uncore_pmc_freerunning(int idx)
221 {
222 	return idx == UNCORE_PMC_IDX_FREERUNNING;
223 }
224 
uncore_mmio_is_valid_offset(struct intel_uncore_box * box,unsigned long offset)225 static inline bool uncore_mmio_is_valid_offset(struct intel_uncore_box *box,
226 					       unsigned long offset)
227 {
228 	if (offset < box->pmu->type->mmio_map_size)
229 		return true;
230 
231 	pr_warn_once("perf uncore: Invalid offset 0x%lx exceeds mapped area of %s.\n",
232 		     offset, box->pmu->type->name);
233 
234 	return false;
235 }
236 
237 static inline
uncore_mmio_box_ctl(struct intel_uncore_box * box)238 unsigned int uncore_mmio_box_ctl(struct intel_uncore_box *box)
239 {
240 	return box->pmu->type->box_ctl +
241 	       box->pmu->type->mmio_offset * box->pmu->pmu_idx;
242 }
243 
uncore_pci_box_ctl(struct intel_uncore_box * box)244 static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box)
245 {
246 	return box->pmu->type->box_ctl;
247 }
248 
uncore_pci_fixed_ctl(struct intel_uncore_box * box)249 static inline unsigned uncore_pci_fixed_ctl(struct intel_uncore_box *box)
250 {
251 	return box->pmu->type->fixed_ctl;
252 }
253 
uncore_pci_fixed_ctr(struct intel_uncore_box * box)254 static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box)
255 {
256 	return box->pmu->type->fixed_ctr;
257 }
258 
259 static inline
uncore_pci_event_ctl(struct intel_uncore_box * box,int idx)260 unsigned uncore_pci_event_ctl(struct intel_uncore_box *box, int idx)
261 {
262 	if (test_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags))
263 		return idx * 8 + box->pmu->type->event_ctl;
264 
265 	return idx * 4 + box->pmu->type->event_ctl;
266 }
267 
268 static inline
uncore_pci_perf_ctr(struct intel_uncore_box * box,int idx)269 unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx)
270 {
271 	return idx * 8 + box->pmu->type->perf_ctr;
272 }
273 
uncore_msr_box_offset(struct intel_uncore_box * box)274 static inline unsigned uncore_msr_box_offset(struct intel_uncore_box *box)
275 {
276 	struct intel_uncore_pmu *pmu = box->pmu;
277 	return pmu->type->msr_offsets ?
278 		pmu->type->msr_offsets[pmu->pmu_idx] :
279 		pmu->type->msr_offset * pmu->pmu_idx;
280 }
281 
uncore_msr_box_ctl(struct intel_uncore_box * box)282 static inline unsigned uncore_msr_box_ctl(struct intel_uncore_box *box)
283 {
284 	if (!box->pmu->type->box_ctl)
285 		return 0;
286 	return box->pmu->type->box_ctl + uncore_msr_box_offset(box);
287 }
288 
uncore_msr_fixed_ctl(struct intel_uncore_box * box)289 static inline unsigned uncore_msr_fixed_ctl(struct intel_uncore_box *box)
290 {
291 	if (!box->pmu->type->fixed_ctl)
292 		return 0;
293 	return box->pmu->type->fixed_ctl + uncore_msr_box_offset(box);
294 }
295 
uncore_msr_fixed_ctr(struct intel_uncore_box * box)296 static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box)
297 {
298 	return box->pmu->type->fixed_ctr + uncore_msr_box_offset(box);
299 }
300 
301 
302 /*
303  * In the uncore document, there is no event-code assigned to free running
304  * counters. Some events need to be defined to indicate the free running
305  * counters. The events are encoded as event-code + umask-code.
306  *
307  * The event-code for all free running counters is 0xff, which is the same as
308  * the fixed counters.
309  *
310  * The umask-code is used to distinguish a fixed counter and a free running
311  * counter, and different types of free running counters.
312  * - For fixed counters, the umask-code is 0x0X.
313  *   X indicates the index of the fixed counter, which starts from 0.
314  * - For free running counters, the umask-code uses the rest of the space.
315  *   It would bare the format of 0xXY.
316  *   X stands for the type of free running counters, which starts from 1.
317  *   Y stands for the index of free running counters of same type, which
318  *   starts from 0.
319  *
320  * For example, there are three types of IIO free running counters on Skylake
321  * server, IO CLOCKS counters, BANDWIDTH counters and UTILIZATION counters.
322  * The event-code for all the free running counters is 0xff.
323  * 'ioclk' is the first counter of IO CLOCKS. IO CLOCKS is the first type,
324  * which umask-code starts from 0x10.
325  * So 'ioclk' is encoded as event=0xff,umask=0x10
326  * 'bw_in_port2' is the third counter of BANDWIDTH counters. BANDWIDTH is
327  * the second type, which umask-code starts from 0x20.
328  * So 'bw_in_port2' is encoded as event=0xff,umask=0x22
329  */
uncore_freerunning_idx(u64 config)330 static inline unsigned int uncore_freerunning_idx(u64 config)
331 {
332 	return ((config >> 8) & 0xf);
333 }
334 
335 #define UNCORE_FREERUNNING_UMASK_START		0x10
336 
uncore_freerunning_type(u64 config)337 static inline unsigned int uncore_freerunning_type(u64 config)
338 {
339 	return ((((config >> 8) - UNCORE_FREERUNNING_UMASK_START) >> 4) & 0xf);
340 }
341 
342 static inline
uncore_freerunning_counter(struct intel_uncore_box * box,struct perf_event * event)343 unsigned int uncore_freerunning_counter(struct intel_uncore_box *box,
344 					struct perf_event *event)
345 {
346 	unsigned int type = uncore_freerunning_type(event->hw.config);
347 	unsigned int idx = uncore_freerunning_idx(event->hw.config);
348 	struct intel_uncore_pmu *pmu = box->pmu;
349 
350 	return pmu->type->freerunning[type].counter_base +
351 	       pmu->type->freerunning[type].counter_offset * idx +
352 	       (pmu->type->freerunning[type].box_offsets ?
353 	        pmu->type->freerunning[type].box_offsets[pmu->pmu_idx] :
354 	        pmu->type->freerunning[type].box_offset * pmu->pmu_idx);
355 }
356 
357 static inline
uncore_msr_event_ctl(struct intel_uncore_box * box,int idx)358 unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx)
359 {
360 	if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) {
361 		return CFL_UNC_CBO_7_PERFEVTSEL0 +
362 		       (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx);
363 	} else {
364 		return box->pmu->type->event_ctl +
365 		       (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) +
366 		       uncore_msr_box_offset(box);
367 	}
368 }
369 
370 static inline
uncore_msr_perf_ctr(struct intel_uncore_box * box,int idx)371 unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx)
372 {
373 	if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) {
374 		return CFL_UNC_CBO_7_PER_CTR0 +
375 		       (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx);
376 	} else {
377 		return box->pmu->type->perf_ctr +
378 		       (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) +
379 		       uncore_msr_box_offset(box);
380 	}
381 }
382 
383 static inline
uncore_fixed_ctl(struct intel_uncore_box * box)384 unsigned uncore_fixed_ctl(struct intel_uncore_box *box)
385 {
386 	if (box->pci_dev || box->io_addr)
387 		return uncore_pci_fixed_ctl(box);
388 	else
389 		return uncore_msr_fixed_ctl(box);
390 }
391 
392 static inline
uncore_fixed_ctr(struct intel_uncore_box * box)393 unsigned uncore_fixed_ctr(struct intel_uncore_box *box)
394 {
395 	if (box->pci_dev || box->io_addr)
396 		return uncore_pci_fixed_ctr(box);
397 	else
398 		return uncore_msr_fixed_ctr(box);
399 }
400 
401 static inline
uncore_event_ctl(struct intel_uncore_box * box,int idx)402 unsigned uncore_event_ctl(struct intel_uncore_box *box, int idx)
403 {
404 	if (box->pci_dev || box->io_addr)
405 		return uncore_pci_event_ctl(box, idx);
406 	else
407 		return uncore_msr_event_ctl(box, idx);
408 }
409 
410 static inline
uncore_perf_ctr(struct intel_uncore_box * box,int idx)411 unsigned uncore_perf_ctr(struct intel_uncore_box *box, int idx)
412 {
413 	if (box->pci_dev || box->io_addr)
414 		return uncore_pci_perf_ctr(box, idx);
415 	else
416 		return uncore_msr_perf_ctr(box, idx);
417 }
418 
uncore_perf_ctr_bits(struct intel_uncore_box * box)419 static inline int uncore_perf_ctr_bits(struct intel_uncore_box *box)
420 {
421 	return box->pmu->type->perf_ctr_bits;
422 }
423 
uncore_fixed_ctr_bits(struct intel_uncore_box * box)424 static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box)
425 {
426 	return box->pmu->type->fixed_ctr_bits;
427 }
428 
429 static inline
uncore_freerunning_bits(struct intel_uncore_box * box,struct perf_event * event)430 unsigned int uncore_freerunning_bits(struct intel_uncore_box *box,
431 				     struct perf_event *event)
432 {
433 	unsigned int type = uncore_freerunning_type(event->hw.config);
434 
435 	return box->pmu->type->freerunning[type].bits;
436 }
437 
uncore_num_freerunning(struct intel_uncore_box * box,struct perf_event * event)438 static inline int uncore_num_freerunning(struct intel_uncore_box *box,
439 					 struct perf_event *event)
440 {
441 	unsigned int type = uncore_freerunning_type(event->hw.config);
442 
443 	return box->pmu->type->freerunning[type].num_counters;
444 }
445 
uncore_num_freerunning_types(struct intel_uncore_box * box,struct perf_event * event)446 static inline int uncore_num_freerunning_types(struct intel_uncore_box *box,
447 					       struct perf_event *event)
448 {
449 	return box->pmu->type->num_freerunning_types;
450 }
451 
check_valid_freerunning_event(struct intel_uncore_box * box,struct perf_event * event)452 static inline bool check_valid_freerunning_event(struct intel_uncore_box *box,
453 						 struct perf_event *event)
454 {
455 	unsigned int type = uncore_freerunning_type(event->hw.config);
456 	unsigned int idx = uncore_freerunning_idx(event->hw.config);
457 
458 	return (type < uncore_num_freerunning_types(box, event)) &&
459 	       (idx < uncore_num_freerunning(box, event));
460 }
461 
uncore_num_counters(struct intel_uncore_box * box)462 static inline int uncore_num_counters(struct intel_uncore_box *box)
463 {
464 	return box->pmu->type->num_counters;
465 }
466 
is_freerunning_event(struct perf_event * event)467 static inline bool is_freerunning_event(struct perf_event *event)
468 {
469 	u64 cfg = event->attr.config;
470 
471 	return ((cfg & UNCORE_FIXED_EVENT) == UNCORE_FIXED_EVENT) &&
472 	       (((cfg >> 8) & 0xff) >= UNCORE_FREERUNNING_UMASK_START);
473 }
474 
475 /* Check and reject invalid config */
uncore_freerunning_hw_config(struct intel_uncore_box * box,struct perf_event * event)476 static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box,
477 					       struct perf_event *event)
478 {
479 	if (is_freerunning_event(event))
480 		return 0;
481 
482 	return -EINVAL;
483 }
484 
uncore_disable_event(struct intel_uncore_box * box,struct perf_event * event)485 static inline void uncore_disable_event(struct intel_uncore_box *box,
486 				struct perf_event *event)
487 {
488 	box->pmu->type->ops->disable_event(box, event);
489 }
490 
uncore_enable_event(struct intel_uncore_box * box,struct perf_event * event)491 static inline void uncore_enable_event(struct intel_uncore_box *box,
492 				struct perf_event *event)
493 {
494 	box->pmu->type->ops->enable_event(box, event);
495 }
496 
uncore_read_counter(struct intel_uncore_box * box,struct perf_event * event)497 static inline u64 uncore_read_counter(struct intel_uncore_box *box,
498 				struct perf_event *event)
499 {
500 	return box->pmu->type->ops->read_counter(box, event);
501 }
502 
uncore_box_init(struct intel_uncore_box * box)503 static inline void uncore_box_init(struct intel_uncore_box *box)
504 {
505 	if (!test_and_set_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
506 		if (box->pmu->type->ops->init_box)
507 			box->pmu->type->ops->init_box(box);
508 	}
509 }
510 
uncore_box_exit(struct intel_uncore_box * box)511 static inline void uncore_box_exit(struct intel_uncore_box *box)
512 {
513 	if (test_and_clear_bit(UNCORE_BOX_FLAG_INITIATED, &box->flags)) {
514 		if (box->pmu->type->ops->exit_box)
515 			box->pmu->type->ops->exit_box(box);
516 	}
517 }
518 
uncore_box_is_fake(struct intel_uncore_box * box)519 static inline bool uncore_box_is_fake(struct intel_uncore_box *box)
520 {
521 	return (box->dieid < 0);
522 }
523 
uncore_event_to_pmu(struct perf_event * event)524 static inline struct intel_uncore_pmu *uncore_event_to_pmu(struct perf_event *event)
525 {
526 	return container_of(event->pmu, struct intel_uncore_pmu, pmu);
527 }
528 
uncore_event_to_box(struct perf_event * event)529 static inline struct intel_uncore_box *uncore_event_to_box(struct perf_event *event)
530 {
531 	return event->pmu_private;
532 }
533 
534 struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu);
535 u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event);
536 void uncore_mmio_exit_box(struct intel_uncore_box *box);
537 u64 uncore_mmio_read_counter(struct intel_uncore_box *box,
538 			     struct perf_event *event);
539 void uncore_pmu_start_hrtimer(struct intel_uncore_box *box);
540 void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box);
541 void uncore_pmu_event_start(struct perf_event *event, int flags);
542 void uncore_pmu_event_stop(struct perf_event *event, int flags);
543 int uncore_pmu_event_add(struct perf_event *event, int flags);
544 void uncore_pmu_event_del(struct perf_event *event, int flags);
545 void uncore_pmu_event_read(struct perf_event *event);
546 void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *event);
547 struct event_constraint *
548 uncore_get_constraint(struct intel_uncore_box *box, struct perf_event *event);
549 void uncore_put_constraint(struct intel_uncore_box *box, struct perf_event *event);
550 u64 uncore_shared_reg_config(struct intel_uncore_box *box, int idx);
551 
552 extern struct intel_uncore_type **uncore_msr_uncores;
553 extern struct intel_uncore_type **uncore_pci_uncores;
554 extern struct intel_uncore_type **uncore_mmio_uncores;
555 extern struct pci_driver *uncore_pci_driver;
556 extern struct pci_driver *uncore_pci_sub_driver;
557 extern raw_spinlock_t pci2phy_map_lock;
558 extern struct list_head pci2phy_map_head;
559 extern struct pci_extra_dev *uncore_extra_pci_dev;
560 extern struct event_constraint uncore_constraint_empty;
561 
562 /* uncore_snb.c */
563 int snb_uncore_pci_init(void);
564 int ivb_uncore_pci_init(void);
565 int hsw_uncore_pci_init(void);
566 int bdw_uncore_pci_init(void);
567 int skl_uncore_pci_init(void);
568 void snb_uncore_cpu_init(void);
569 void nhm_uncore_cpu_init(void);
570 void skl_uncore_cpu_init(void);
571 void icl_uncore_cpu_init(void);
572 void tgl_uncore_cpu_init(void);
573 void tgl_uncore_mmio_init(void);
574 void tgl_l_uncore_mmio_init(void);
575 int snb_pci2phy_map_init(int devid);
576 
577 /* uncore_snbep.c */
578 int snbep_uncore_pci_init(void);
579 void snbep_uncore_cpu_init(void);
580 int ivbep_uncore_pci_init(void);
581 void ivbep_uncore_cpu_init(void);
582 int hswep_uncore_pci_init(void);
583 void hswep_uncore_cpu_init(void);
584 int bdx_uncore_pci_init(void);
585 void bdx_uncore_cpu_init(void);
586 int knl_uncore_pci_init(void);
587 void knl_uncore_cpu_init(void);
588 int skx_uncore_pci_init(void);
589 void skx_uncore_cpu_init(void);
590 int snr_uncore_pci_init(void);
591 void snr_uncore_cpu_init(void);
592 void snr_uncore_mmio_init(void);
593 int icx_uncore_pci_init(void);
594 void icx_uncore_cpu_init(void);
595 void icx_uncore_mmio_init(void);
596 
597 /* uncore_nhmex.c */
598 void nhmex_uncore_cpu_init(void);
599