linux/arch/x86/events/intel/uncore.h

/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/slab.h>
#include <linux/pci.h>
#include <asm/apicdef.h>
#include <asm/intel-family.h>
#include <linux/io-64-nonatomic-lo-hi.h>

#include <linux/perf_event.h>
#include "../perf_event.h"

#define UNCORE_PMU_NAME_LEN
#define UNCORE_PMU_HRTIMER_INTERVAL
#define UNCORE_SNB_IMC_HRTIMER_INTERVAL

#define UNCORE_FIXED_EVENT
#define UNCORE_PMC_IDX_MAX_GENERIC
#define UNCORE_PMC_IDX_MAX_FIXED
#define UNCORE_PMC_IDX_MAX_FREERUNNING
#define UNCORE_PMC_IDX_FIXED
#define UNCORE_PMC_IDX_FREERUNNING
#define UNCORE_PMC_IDX_MAX

#define UNCORE_PCI_DEV_FULL_DATA(dev, func, type, idx)
#define UNCORE_PCI_DEV_DATA(type, idx)
#define UNCORE_PCI_DEV_DEV(data)
#define UNCORE_PCI_DEV_FUNC(data)
#define UNCORE_PCI_DEV_TYPE(data)
#define UNCORE_PCI_DEV_IDX(data)
#define UNCORE_EXTRA_PCI_DEV
#define UNCORE_EXTRA_PCI_DEV_MAX

#define UNCORE_EVENT_CONSTRAINT(c, n)

#define UNCORE_IGNORE_END

struct pci_extra_dev {};

struct intel_uncore_ops;
struct intel_uncore_pmu;
struct intel_uncore_box;
struct uncore_event_desc;
struct freerunning_counters;
struct intel_uncore_topology;

struct intel_uncore_type {};

#define pmu_group
#define format_group
#define events_group

struct intel_uncore_ops {};

struct intel_uncore_pmu {};

struct intel_uncore_extra_reg {};

struct intel_uncore_box {};

/* CFL uncore 8th cbox MSRs */
#define CFL_UNC_CBO_7_PERFEVTSEL0
#define CFL_UNC_CBO_7_PER_CTR0

#define UNCORE_BOX_FLAG_INITIATED
/* event config registers are 8-byte apart */
#define UNCORE_BOX_FLAG_CTL_OFFS8
/* CFL 8th CBOX has different MSR space */
#define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS

struct uncore_event_desc {};

struct freerunning_counters {};

struct uncore_iio_topology {};

struct uncore_upi_topology {};

struct intel_uncore_topology {};

struct pci2phy_map {};

struct pci2phy_map *__find_pci2phy_map(int segment);
int uncore_pcibus_to_dieid(struct pci_bus *bus);
int uncore_die_to_segment(int die);
int uncore_device_to_die(struct pci_dev *dev);

ssize_t uncore_event_show(struct device *dev,
			  struct device_attribute *attr, char *buf);

static inline struct intel_uncore_pmu *dev_to_uncore_pmu(struct device *dev)
{}

#define to_device_attribute(n)
#define to_dev_ext_attribute(n)
#define attr_to_ext_attr(n)

extern int __uncore_max_dies;
#define uncore_max_dies()

#define INTEL_UNCORE_EVENT_DESC(_name, _config)

#define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format)

static inline bool uncore_pmc_fixed(int idx)
{}

static inline bool uncore_pmc_freerunning(int idx)
{}

static inline bool uncore_mmio_is_valid_offset(struct intel_uncore_box *box,
					       unsigned long offset)
{}

static inline
unsigned int uncore_mmio_box_ctl(struct intel_uncore_box *box)
{}

static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box)
{}

static inline unsigned uncore_pci_fixed_ctl(struct intel_uncore_box *box)
{}

static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box)
{}

static inline
unsigned uncore_pci_event_ctl(struct intel_uncore_box *box, int idx)
{}

static inline
unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx)
{}

static inline unsigned uncore_msr_box_offset(struct intel_uncore_box *box)
{}

static inline unsigned uncore_msr_box_ctl(struct intel_uncore_box *box)
{}

static inline unsigned uncore_msr_fixed_ctl(struct intel_uncore_box *box)
{}

static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box)
{}


/*
 * In the uncore document, there is no event-code assigned to free running
 * counters. Some events need to be defined to indicate the free running
 * counters. The events are encoded as event-code + umask-code.
 *
 * The event-code for all free running counters is 0xff, which is the same as
 * the fixed counters.
 *
 * The umask-code is used to distinguish a fixed counter and a free running
 * counter, and different types of free running counters.
 * - For fixed counters, the umask-code is 0x0X.
 *   X indicates the index of the fixed counter, which starts from 0.
 * - For free running counters, the umask-code uses the rest of the space.
 *   It would bare the format of 0xXY.
 *   X stands for the type of free running counters, which starts from 1.
 *   Y stands for the index of free running counters of same type, which
 *   starts from 0.
 *
 * For example, there are three types of IIO free running counters on Skylake
 * server, IO CLOCKS counters, BANDWIDTH counters and UTILIZATION counters.
 * The event-code for all the free running counters is 0xff.
 * 'ioclk' is the first counter of IO CLOCKS. IO CLOCKS is the first type,
 * which umask-code starts from 0x10.
 * So 'ioclk' is encoded as event=0xff,umask=0x10
 * 'bw_in_port2' is the third counter of BANDWIDTH counters. BANDWIDTH is
 * the second type, which umask-code starts from 0x20.
 * So 'bw_in_port2' is encoded as event=0xff,umask=0x22
 */
static inline unsigned int uncore_freerunning_idx(u64 config)
{}

#define UNCORE_FREERUNNING_UMASK_START

static inline unsigned int uncore_freerunning_type(u64 config)
{}

static inline
unsigned int uncore_freerunning_counter(struct intel_uncore_box *box,
					struct perf_event *event)
{}

static inline
unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx)
{}

static inline
unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx)
{}

static inline
unsigned uncore_fixed_ctl(struct intel_uncore_box *box)
{}

static inline
unsigned uncore_fixed_ctr(struct intel_uncore_box *box)
{}

static inline
unsigned uncore_event_ctl(struct intel_uncore_box *box, int idx)
{}

static inline
unsigned uncore_perf_ctr(struct intel_uncore_box *box, int idx)
{}

static inline int uncore_perf_ctr_bits(struct intel_uncore_box *box)
{}

static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box)
{}

static inline
unsigned int uncore_freerunning_bits(struct intel_uncore_box *box,
				     struct perf_event *event)
{}

static inline int uncore_num_freerunning(struct intel_uncore_box *box,
					 struct perf_event *event)
{}

static inline int uncore_num_freerunning_types(struct intel_uncore_box *box,
					       struct perf_event *event)
{}

static inline bool check_valid_freerunning_event(struct intel_uncore_box *box,
						 struct perf_event *event)
{}

static inline int uncore_num_counters(struct intel_uncore_box *box)
{}

static inline bool is_freerunning_event(struct perf_event *event)
{}

/* Check and reject invalid config */
static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box,
					       struct perf_event *event)
{}

static inline void uncore_disable_event(struct intel_uncore_box *box,
				struct perf_event *event)
{}

static inline void uncore_enable_event(struct intel_uncore_box *box,
				struct perf_event *event)
{}

static inline u64 uncore_read_counter(struct intel_uncore_box *box,
				struct perf_event *event)
{}

static inline void uncore_box_init(struct intel_uncore_box *box)
{}

static inline void uncore_box_exit(struct intel_uncore_box *box)
{}

static inline bool uncore_box_is_fake(struct intel_uncore_box *box)
{}

static inline struct intel_uncore_pmu *uncore_event_to_pmu(struct perf_event *event)
{}

static inline struct intel_uncore_box *uncore_event_to_box(struct perf_event *event)
{}

struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu);
u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event);
void uncore_mmio_exit_box(struct intel_uncore_box *box);
u64 uncore_mmio_read_counter(struct intel_uncore_box *box,
			     struct perf_event *event);
void uncore_pmu_start_hrtimer(struct intel_uncore_box *box);
void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box);
void uncore_pmu_event_start(struct perf_event *event, int flags);
void uncore_pmu_event_stop(struct perf_event *event, int flags);
int uncore_pmu_event_add(struct perf_event *event, int flags);
void uncore_pmu_event_del(struct perf_event *event, int flags);
void uncore_pmu_event_read(struct perf_event *event);
void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *event);
struct event_constraint *
uncore_get_constraint(struct intel_uncore_box *box, struct perf_event *event);
void uncore_put_constraint(struct intel_uncore_box *box, struct perf_event *event);
u64 uncore_shared_reg_config(struct intel_uncore_box *box, int idx);
void uncore_get_alias_name(char *pmu_name, struct intel_uncore_pmu *pmu);

extern struct intel_uncore_type *empty_uncore[];
extern struct intel_uncore_type **uncore_msr_uncores;
extern struct intel_uncore_type **uncore_pci_uncores;
extern struct intel_uncore_type **uncore_mmio_uncores;
extern struct pci_driver *uncore_pci_driver;
extern struct pci_driver *uncore_pci_sub_driver;
extern raw_spinlock_t pci2phy_map_lock;
extern struct list_head pci2phy_map_head;
extern struct pci_extra_dev *uncore_extra_pci_dev;
extern struct event_constraint uncore_constraint_empty;
extern int spr_uncore_units_ignore[];
extern int gnr_uncore_units_ignore[];

/* uncore_snb.c */
int snb_uncore_pci_init(void);
int ivb_uncore_pci_init(void);
int hsw_uncore_pci_init(void);
int bdw_uncore_pci_init(void);
int skl_uncore_pci_init(void);
void snb_uncore_cpu_init(void);
void nhm_uncore_cpu_init(void);
void skl_uncore_cpu_init(void);
void icl_uncore_cpu_init(void);
void tgl_uncore_cpu_init(void);
void adl_uncore_cpu_init(void);
void mtl_uncore_cpu_init(void);
void tgl_uncore_mmio_init(void);
void tgl_l_uncore_mmio_init(void);
void adl_uncore_mmio_init(void);
int snb_pci2phy_map_init(int devid);

/* uncore_snbep.c */
int snbep_uncore_pci_init(void);
void snbep_uncore_cpu_init(void);
int ivbep_uncore_pci_init(void);
void ivbep_uncore_cpu_init(void);
int hswep_uncore_pci_init(void);
void hswep_uncore_cpu_init(void);
int bdx_uncore_pci_init(void);
void bdx_uncore_cpu_init(void);
int knl_uncore_pci_init(void);
void knl_uncore_cpu_init(void);
int skx_uncore_pci_init(void);
void skx_uncore_cpu_init(void);
int snr_uncore_pci_init(void);
void snr_uncore_cpu_init(void);
void snr_uncore_mmio_init(void);
int icx_uncore_pci_init(void);
void icx_uncore_cpu_init(void);
void icx_uncore_mmio_init(void);
int spr_uncore_pci_init(void);
void spr_uncore_cpu_init(void);
void spr_uncore_mmio_init(void);
int gnr_uncore_pci_init(void);
void gnr_uncore_cpu_init(void);
void gnr_uncore_mmio_init(void);

/* uncore_nhmex.c */
void nhmex_uncore_cpu_init(void);