#include <linux/perf_event.h>
#include <linux/init.h>
#include "amdgpu.h"
#include "amdgpu_pmu.h"
#define PMU_NAME_SIZE …
#define NUM_FORMATS_AMDGPU_PMU …
#define NUM_FORMATS_DF_VEGA20 …
#define NUM_EVENTS_DF_VEGA20 …
#define NUM_EVENT_TYPES_VEGA20 …
#define NUM_EVENTS_VEGA20_XGMI …
#define NUM_EVENTS_VEGA20_MAX …
#define NUM_EVENT_TYPES_ARCTURUS …
#define NUM_EVENTS_ARCTURUS_XGMI …
#define NUM_EVENTS_ARCTURUS_MAX …
struct amdgpu_pmu_event_attribute { … };
struct amdgpu_pmu_entry { … };
static ssize_t amdgpu_pmu_event_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static LIST_HEAD(amdgpu_pmu_list);
struct amdgpu_pmu_attr { … };
struct amdgpu_pmu_type { … };
struct amdgpu_pmu_config { … };
static struct amdgpu_pmu_attr amdgpu_pmu_formats[NUM_FORMATS_AMDGPU_PMU] = …;
static struct amdgpu_pmu_attr vega20_events[NUM_EVENTS_VEGA20_MAX] = …;
static struct amdgpu_pmu_type vega20_types[NUM_EVENT_TYPES_VEGA20] = …;
static struct amdgpu_pmu_config vega20_config = …;
static struct amdgpu_pmu_attr df_vega20_formats[NUM_FORMATS_DF_VEGA20] = …;
static struct amdgpu_pmu_attr df_vega20_events[NUM_EVENTS_DF_VEGA20] = …;
static struct amdgpu_pmu_config df_vega20_config = …;
static struct amdgpu_pmu_attr arcturus_events[NUM_EVENTS_ARCTURUS_MAX] = …;
static struct amdgpu_pmu_type arcturus_types[NUM_EVENT_TYPES_ARCTURUS] = …;
static struct amdgpu_pmu_config arcturus_config = …;
static int amdgpu_perf_event_init(struct perf_event *event)
{ … }
static void amdgpu_perf_start(struct perf_event *event, int flags)
{ … }
static void amdgpu_perf_read(struct perf_event *event)
{ … }
static void amdgpu_perf_stop(struct perf_event *event, int flags)
{ … }
static int amdgpu_perf_add(struct perf_event *event, int flags)
{ … }
static void amdgpu_perf_del(struct perf_event *event, int flags)
{ … }
static void amdgpu_pmu_create_event_attrs_by_type(
struct attribute_group *attr_group,
struct amdgpu_pmu_event_attribute *pmu_attr,
struct amdgpu_pmu_attr events[],
int s_offset,
int e_offset,
unsigned int type)
{ … }
static void amdgpu_pmu_create_attrs(struct attribute_group *attr_group,
struct amdgpu_pmu_event_attribute *pmu_attr,
struct amdgpu_pmu_attr events[],
int num_events)
{ … }
static int amdgpu_pmu_alloc_pmu_attrs(
struct attribute_group *fmt_attr_group,
struct amdgpu_pmu_event_attribute **fmt_attr,
struct attribute_group *evt_attr_group,
struct amdgpu_pmu_event_attribute **evt_attr,
struct amdgpu_pmu_config *config)
{ … }
static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry,
struct amdgpu_pmu_config *config)
{ … }
void amdgpu_pmu_fini(struct amdgpu_device *adev)
{ … }
static struct amdgpu_pmu_entry *create_pmu_entry(struct amdgpu_device *adev,
unsigned int pmu_type,
char *pmu_type_name,
char *pmu_file_prefix)
{ … }
int amdgpu_pmu_init(struct amdgpu_device *adev)
{ … }