linux/drivers/dma/idxd/perfmon.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2020 Intel Corporation. All rights rsvd. */

#include <linux/sched/task.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include "idxd.h"
#include "perfmon.h"

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

static cpumask_t		perfmon_dsa_cpu_mask;
static bool			cpuhp_set_up;
static enum cpuhp_state		cpuhp_slot;

/*
 * perf userspace reads this attribute to determine which cpus to open
 * counters on.  It's connected to perfmon_dsa_cpu_mask, which is
 * maintained by the cpu hotplug handlers.
 */
static DEVICE_ATTR_RO(cpumask);

static struct attribute *perfmon_cpumask_attrs[] =;

static struct attribute_group cpumask_attr_group =;

/*
 * These attributes specify the bits in the config word that the perf
 * syscall uses to pass the event ids and categories to perfmon.
 */
DEFINE_PERFMON_FORMAT_ATTR();
DEFINE_PERFMON_FORMAT_ATTR();

/*
 * These attributes specify the bits in the config1 word that the perf
 * syscall uses to pass filter data to perfmon.
 */
DEFINE_PERFMON_FORMAT_ATTR();
DEFINE_PERFMON_FORMAT_ATTR();
DEFINE_PERFMON_FORMAT_ATTR();
DEFINE_PERFMON_FORMAT_ATTR();
DEFINE_PERFMON_FORMAT_ATTR();

#define PERFMON_FILTERS_START
#define PERFMON_FILTERS_MAX

static struct attribute *perfmon_format_attrs[] =;

static struct attribute_group perfmon_format_attr_group =;

static const struct attribute_group *perfmon_attr_groups[] =;

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

static bool is_idxd_event(struct idxd_pmu *idxd_pmu, struct perf_event *event)
{}

static int perfmon_collect_events(struct idxd_pmu *idxd_pmu,
				  struct perf_event *leader,
				  bool do_grp)
{}

static void perfmon_assign_hw_event(struct idxd_pmu *idxd_pmu,
				    struct perf_event *event, int idx)
{}

static int perfmon_assign_event(struct idxd_pmu *idxd_pmu,
				struct perf_event *event)
{}

/*
 * Check whether there are enough counters to satisfy that all the
 * events in the group can actually be scheduled at the same time.
 *
 * To do this, create a fake idxd_pmu object so the event collection
 * and assignment functions can be used without affecting the internal
 * state of the real idxd_pmu object.
 */
static int perfmon_validate_group(struct idxd_pmu *pmu,
				  struct perf_event *event)
{}

static int perfmon_pmu_event_init(struct perf_event *event)
{}

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

static void perfmon_pmu_event_update(struct perf_event *event)
{}

void perfmon_counter_overflow(struct idxd_device *idxd)
{}

static inline void perfmon_reset_config(struct idxd_device *idxd)
{}

static inline void perfmon_reset_counters(struct idxd_device *idxd)
{}

static inline void perfmon_reset(struct idxd_device *idxd)
{}

static void perfmon_pmu_event_start(struct perf_event *event, int mode)
{}

static void perfmon_pmu_event_stop(struct perf_event *event, int mode)
{}

static void perfmon_pmu_event_del(struct perf_event *event, int mode)
{}

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

static void enable_perfmon_pmu(struct idxd_device *idxd)
{}

static void disable_perfmon_pmu(struct idxd_device *idxd)
{}

static void perfmon_pmu_enable(struct pmu *pmu)
{}

static void perfmon_pmu_disable(struct pmu *pmu)
{}

static void skip_filter(int i)
{}

static void idxd_pmu_init(struct idxd_pmu *idxd_pmu)
{}

void perfmon_pmu_remove(struct idxd_device *idxd)
{}

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

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

int perfmon_pmu_init(struct idxd_device *idxd)
{}

void __init perfmon_init(void)
{}

void __exit perfmon_exit(void)
{}