linux/drivers/perf/alibaba_uncore_drw_pmu.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Alibaba DDR Sub-System Driveway PMU driver
 *
 * Copyright (C) 2022 Alibaba Inc
 */

#define ALI_DRW_PMUNAME
#define ALI_DRW_DRVNAME
#define pr_fmt(fmt)

#include <linux/acpi.h>
#include <linux/bitfield.h>
#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/cpuhotplug.h>
#include <linux/cpumask.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/perf_event.h>
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/rculist.h>
#include <linux/refcount.h>


#define ALI_DRW_PMU_COMMON_MAX_COUNTERS
#define ALI_DRW_PMU_TEST_SEL_COMMON_COUNTER_BASE

#define ALI_DRW_PMU_PA_SHIFT
#define ALI_DRW_PMU_CNT_INIT
#define ALI_DRW_CNT_MAX_PERIOD
#define ALI_DRW_PMU_CYCLE_EVT_ID

#define ALI_DRW_PMU_CNT_CTRL
#define ALI_DRW_PMU_CNT_RST
#define ALI_DRW_PMU_CNT_STOP
#define ALI_DRW_PMU_CNT_START

#define ALI_DRW_PMU_CNT_STATE
#define ALI_DRW_PMU_TEST_CTRL
#define ALI_DRW_PMU_CNT_PRELOAD

#define ALI_DRW_PMU_CYCLE_CNT_HIGH_MASK
#define ALI_DRW_PMU_CYCLE_CNT_LOW_MASK
#define ALI_DRW_PMU_CYCLE_CNT_HIGH
#define ALI_DRW_PMU_CYCLE_CNT_LOW

/* PMU EVENT SEL 0-3 are paired in 32-bit registers on a 4-byte stride */
#define ALI_DRW_PMU_EVENT_SEL0
/* counter 0-3 use sel0, counter 4-7 use sel1...*/
#define ALI_DRW_PMU_EVENT_SELn(n)
#define ALI_DRW_PMCOM_CNT_EN
#define ALI_DRW_PMCOM_CNT_EVENT_MASK
#define ALI_DRW_PMCOM_CNT_EVENT_OFFSET(n)

/* PMU COMMON COUNTER 0-15, are paired in 32-bit registers on a 4-byte stride */
#define ALI_DRW_PMU_COMMON_COUNTER0
#define ALI_DRW_PMU_COMMON_COUNTERn(n)

#define ALI_DRW_PMU_OV_INTR_ENABLE_CTL
#define ALI_DRW_PMU_OV_INTR_DISABLE_CTL
#define ALI_DRW_PMU_OV_INTR_ENABLE_STATUS
#define ALI_DRW_PMU_OV_INTR_CLR
#define ALI_DRW_PMU_OV_INTR_STATUS
#define ALI_DRW_PMCOM_CNT_OV_INTR_MASK
#define ALI_DRW_PMBW_CNT_OV_INTR_MASK
#define ALI_DRW_PMU_OV_INTR_MASK

static int ali_drw_cpuhp_state_num;

static LIST_HEAD(ali_drw_pmu_irqs);
static DEFINE_MUTEX(ali_drw_pmu_irqs_lock);

struct ali_drw_pmu_irq {};

struct ali_drw_pmu {};

#define to_ali_drw_pmu(p)

#define DRW_CONFIG_EVENTID
#define GET_DRW_EVENTID(event)

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

/*
 * PMU event attributes
 */
static ssize_t ali_drw_pmu_event_show(struct device *dev,
			       struct device_attribute *attr, char *page)
{}

#define ALI_DRW_PMU_ATTR(_name, _func, _config)

#define ALI_DRW_PMU_FORMAT_ATTR(_name, _config)
#define ALI_DRW_PMU_EVENT_ATTR(_name, _config)

static struct attribute *ali_drw_pmu_events_attrs[] =;

static struct attribute_group ali_drw_pmu_events_attr_group =;

static struct attribute *ali_drw_pmu_format_attr[] =;

static const struct attribute_group ali_drw_pmu_format_group =;

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

static struct device_attribute ali_drw_pmu_cpumask_attr =;

static struct attribute *ali_drw_pmu_cpumask_attrs[] =;

static const struct attribute_group ali_drw_pmu_cpumask_attr_group =;

static umode_t ali_drw_pmu_identifier_attr_visible(struct kobject *kobj,
						struct attribute *attr, int n)
{}

static DEVICE_STRING_ATTR_RO(ali_drw_pmu_identifier, 0444, "ali_drw_pmu");

static struct attribute *ali_drw_pmu_identifier_attrs[] =;

static const struct attribute_group ali_drw_pmu_identifier_attr_group =;

static const struct attribute_group *ali_drw_pmu_attr_groups[] =;

/* find a counter for event, then in add func, hw.idx will equal to counter */
static int ali_drw_get_counter_idx(struct perf_event *event)
{}

static u64 ali_drw_pmu_read_counter(struct perf_event *event)
{}

static void ali_drw_pmu_event_update(struct perf_event *event)
{}

static void ali_drw_pmu_event_set_period(struct perf_event *event)
{}

static void ali_drw_pmu_enable_counter(struct perf_event *event)
{}

static void ali_drw_pmu_disable_counter(struct perf_event *event)
{}

static irqreturn_t ali_drw_pmu_isr(int irq_num, void *data)
{}

static struct ali_drw_pmu_irq *__ali_drw_pmu_init_irq(struct platform_device
						      *pdev, int irq_num)
{}

static int ali_drw_pmu_init_irq(struct ali_drw_pmu *drw_pmu,
				struct platform_device *pdev)
{}

static void ali_drw_pmu_uninit_irq(struct ali_drw_pmu *drw_pmu)
{}

static int ali_drw_pmu_event_init(struct perf_event *event)
{}

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

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

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

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

static void ali_drw_pmu_read(struct perf_event *event)
{}

static int ali_drw_pmu_probe(struct platform_device *pdev)
{}

static void ali_drw_pmu_remove(struct platform_device *pdev)
{}

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

/*
 * Due to historical reasons, the HID used in the production environment is
 * ARMHD700, so we leave ARMHD700 as Compatible ID.
 */
static const struct acpi_device_id ali_drw_acpi_match[] =;

MODULE_DEVICE_TABLE(acpi, ali_drw_acpi_match);

static struct platform_driver ali_drw_pmu_driver =;

static int __init ali_drw_pmu_init(void)
{}

static void __exit ali_drw_pmu_exit(void)
{}

module_init();
module_exit(ali_drw_pmu_exit);

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();