linux/drivers/iommu/intel/perfmon.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Support Intel IOMMU PerfMon
 * Copyright(c) 2023 Intel Corporation.
 */
#define pr_fmt(fmt)
#define dev_fmt(fmt)

#include <linux/dmar.h>
#include "iommu.h"
#include "perfmon.h"

PMU_FORMAT_ATTR();		/* ES: Events Select */
PMU_FORMAT_ATTR();	/* EGI: Event Group Index */

static struct attribute *iommu_pmu_format_attrs[] =;

static struct attribute_group iommu_pmu_format_attr_group =;

/* The available events are added in attr_update later */
static struct attribute *attrs_empty[] =;

static struct attribute_group iommu_pmu_events_attr_group =;

static cpumask_t iommu_pmu_cpu_mask;

static ssize_t
cpumask_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(cpumask);

static struct attribute *iommu_pmu_cpumask_attrs[] =;

static struct attribute_group iommu_pmu_cpumask_attr_group =;

static const struct attribute_group *iommu_pmu_attr_groups[] =;

static inline struct iommu_pmu *dev_to_iommu_pmu(struct device *dev)
{}

#define IOMMU_PMU_ATTR(_name, _format, _filter)

IOMMU_PMU_ATTR(filter_requester_id_en,	"config1:0",		IOMMU_PMU_FILTER_REQUESTER_ID);
IOMMU_PMU_ATTR(filter_domain_en,	"config1:1",		IOMMU_PMU_FILTER_DOMAIN);
IOMMU_PMU_ATTR(filter_pasid_en,		"config1:2",		IOMMU_PMU_FILTER_PASID);
IOMMU_PMU_ATTR(filter_ats_en,		"config1:3",		IOMMU_PMU_FILTER_ATS);
IOMMU_PMU_ATTR(filter_page_table_en,	"config1:4",		IOMMU_PMU_FILTER_PAGE_TABLE);
IOMMU_PMU_ATTR(filter_requester_id,	"config1:16-31",	IOMMU_PMU_FILTER_REQUESTER_ID);
IOMMU_PMU_ATTR(filter_domain,		"config1:32-47",	IOMMU_PMU_FILTER_DOMAIN);
IOMMU_PMU_ATTR(filter_pasid,		"config2:0-21",		IOMMU_PMU_FILTER_PASID);
IOMMU_PMU_ATTR(filter_ats,		"config2:24-28",	IOMMU_PMU_FILTER_ATS);
IOMMU_PMU_ATTR(filter_page_table,	"config2:32-36",	IOMMU_PMU_FILTER_PAGE_TABLE);

#define iommu_pmu_en_requester_id(e)
#define iommu_pmu_en_domain(e)
#define iommu_pmu_en_pasid(e)
#define iommu_pmu_en_ats(e)
#define iommu_pmu_en_page_table(e)
#define iommu_pmu_get_requester_id(filter)
#define iommu_pmu_get_domain(filter)
#define iommu_pmu_get_pasid(filter)
#define iommu_pmu_get_ats(filter)
#define iommu_pmu_get_page_table(filter)

#define iommu_pmu_set_filter(_name, _config, _filter, _idx, _econfig)

#define iommu_pmu_clear_filter(_filter, _idx)

/*
 * Define the event attr related functions
 * Input: _name: event attr name
 *        _string: string of the event in sysfs
 *        _g_idx: event group encoding
 *        _event: event encoding
 */
#define IOMMU_PMU_EVENT_ATTR(_name, _string, _g_idx, _event)

IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()
IOMMU_PMU_EVENT_ATTR()

static const struct attribute_group *iommu_pmu_attr_update[] =;

static inline void __iomem *
iommu_event_base(struct iommu_pmu *iommu_pmu, int idx)
{}

static inline void __iomem *
iommu_config_base(struct iommu_pmu *iommu_pmu, int idx)
{}

static inline struct iommu_pmu *iommu_event_to_pmu(struct perf_event *event)
{}

static inline u64 iommu_event_config(struct perf_event *event)
{}

static inline bool is_iommu_pmu_event(struct iommu_pmu *iommu_pmu,
				      struct perf_event *event)
{}

static int iommu_pmu_validate_event(struct perf_event *event)
{}

static int iommu_pmu_validate_group(struct perf_event *event)
{}

static int iommu_pmu_event_init(struct perf_event *event)
{}

static void iommu_pmu_event_update(struct perf_event *event)
{}

static void iommu_pmu_start(struct perf_event *event, int flags)
{}

static void iommu_pmu_stop(struct perf_event *event, int flags)
{}

static inline int
iommu_pmu_validate_per_cntr_event(struct iommu_pmu *iommu_pmu,
				  int idx, struct perf_event *event)
{}

static int iommu_pmu_assign_event(struct iommu_pmu *iommu_pmu,
				  struct perf_event *event)
{}

static int iommu_pmu_add(struct perf_event *event, int flags)
{}

static void iommu_pmu_del(struct perf_event *event, int flags)
{}

static void iommu_pmu_enable(struct pmu *pmu)
{}

static void iommu_pmu_disable(struct pmu *pmu)
{}

static void iommu_pmu_counter_overflow(struct iommu_pmu *iommu_pmu)
{}

static irqreturn_t iommu_pmu_irq_handler(int irq, void *dev_id)
{}

static int __iommu_pmu_register(struct intel_iommu *iommu)
{}

static inline void __iomem *
get_perf_reg_address(struct intel_iommu *iommu, u32 offset)
{}

int alloc_iommu_pmu(struct intel_iommu *iommu)
{}

void free_iommu_pmu(struct intel_iommu *iommu)
{}

static int iommu_pmu_set_interrupt(struct intel_iommu *iommu)
{}

static void iommu_pmu_unset_interrupt(struct intel_iommu *iommu)
{}

static int iommu_pmu_cpu_online(unsigned int cpu, struct hlist_node *node)
{}

static int iommu_pmu_cpu_offline(unsigned int cpu, struct hlist_node *node)
{}

static int nr_iommu_pmu;
static enum cpuhp_state iommu_cpuhp_slot;

static int iommu_pmu_cpuhp_setup(struct iommu_pmu *iommu_pmu)
{}

static void iommu_pmu_cpuhp_free(struct iommu_pmu *iommu_pmu)
{}

void iommu_pmu_register(struct intel_iommu *iommu)
{}

void iommu_pmu_unregister(struct intel_iommu *iommu)
{}