linux/drivers/perf/xgene_pmu.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * APM X-Gene SoC PMU (Performance Monitor Unit)
 *
 * Copyright (c) 2016, Applied Micro Circuits Corporation
 * Author: Hoan Tran <[email protected]>
 *         Tai Nguyen <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/cpuhotplug.h>
#include <linux/cpumask.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/perf_event.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/slab.h>

#define CSW_CSWCR
#define CSW_CSWCR_DUALMCB_MASK
#define CSW_CSWCR_MCB0_ROUTING(x)
#define CSW_CSWCR_MCB1_ROUTING(x)
#define MCBADDRMR
#define MCBADDRMR_DUALMCU_MODE_MASK

#define PCPPMU_INTSTATUS_REG
#define PCPPMU_INTMASK_REG
#define PCPPMU_INTMASK
#define PCPPMU_INTENMASK
#define PCPPMU_INTCLRMASK
#define PCPPMU_INT_MCU
#define PCPPMU_INT_MCB
#define PCPPMU_INT_L3C
#define PCPPMU_INT_IOB

#define PCPPMU_V3_INTMASK
#define PCPPMU_V3_INTENMASK
#define PCPPMU_V3_INTCLRMASK
#define PCPPMU_V3_INT_MCU
#define PCPPMU_V3_INT_MCB
#define PCPPMU_V3_INT_L3C
#define PCPPMU_V3_INT_IOB

#define PMU_MAX_COUNTERS
#define PMU_CNT_MAX_PERIOD
#define PMU_V3_CNT_MAX_PERIOD
#define PMU_OVERFLOW_MASK
#define PMU_PMCR_E
#define PMU_PMCR_P

#define PMU_PMEVCNTR0
#define PMU_PMEVCNTR1
#define PMU_PMEVCNTR2
#define PMU_PMEVCNTR3
#define PMU_PMEVTYPER0
#define PMU_PMEVTYPER1
#define PMU_PMEVTYPER2
#define PMU_PMEVTYPER3
#define PMU_PMAMR0
#define PMU_PMAMR1
#define PMU_PMCNTENSET
#define PMU_PMCNTENCLR
#define PMU_PMINTENSET
#define PMU_PMINTENCLR
#define PMU_PMOVSR
#define PMU_PMCR

/* PMU registers for V3 */
#define PMU_PMOVSCLR
#define PMU_PMOVSSET

#define to_pmu_dev(p)
#define GET_CNTR(ev)
#define GET_EVENTID(ev)
#define GET_AGENTID(ev)
#define GET_AGENT1ID(ev)

struct hw_pmu_info {};

struct xgene_pmu_dev {};

struct xgene_pmu_ops {};

struct xgene_pmu {};

struct xgene_pmu_dev_ctx {};

struct xgene_pmu_data {};

enum xgene_pmu_version {};

enum xgene_pmu_dev_type {};

/*
 * sysfs format attributes
 */
#define XGENE_PMU_FORMAT_ATTR(_name, _config)

static struct attribute *l3c_pmu_format_attrs[] =;

static struct attribute *iob_pmu_format_attrs[] =;

static struct attribute *mcb_pmu_format_attrs[] =;

static struct attribute *mc_pmu_format_attrs[] =;

static const struct attribute_group l3c_pmu_format_attr_group =;

static const struct attribute_group iob_pmu_format_attr_group =;

static const struct attribute_group mcb_pmu_format_attr_group =;

static const struct attribute_group mc_pmu_format_attr_group =;

static struct attribute *l3c_pmu_v3_format_attrs[] =;

static struct attribute *iob_pmu_v3_format_attrs[] =;

static struct attribute *iob_slow_pmu_v3_format_attrs[] =;

static struct attribute *mcb_pmu_v3_format_attrs[] =;

static struct attribute *mc_pmu_v3_format_attrs[] =;

static const struct attribute_group l3c_pmu_v3_format_attr_group =;

static const struct attribute_group iob_pmu_v3_format_attr_group =;

static const struct attribute_group iob_slow_pmu_v3_format_attr_group =;

static const struct attribute_group mcb_pmu_v3_format_attr_group =;

static const struct attribute_group mc_pmu_v3_format_attr_group =;

/*
 * sysfs event attributes
 */
static ssize_t xgene_pmu_event_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{}

#define XGENE_PMU_EVENT_ATTR(_name, _config)

static struct attribute *l3c_pmu_events_attrs[] =;

static struct attribute *iob_pmu_events_attrs[] =;

static struct attribute *mcb_pmu_events_attrs[] =;

static struct attribute *mc_pmu_events_attrs[] =;

static const struct attribute_group l3c_pmu_events_attr_group =;

static const struct attribute_group iob_pmu_events_attr_group =;

static const struct attribute_group mcb_pmu_events_attr_group =;

static const struct attribute_group mc_pmu_events_attr_group =;

static struct attribute *l3c_pmu_v3_events_attrs[] =;

static struct attribute *iob_fast_pmu_v3_events_attrs[] =;

static struct attribute *iob_slow_pmu_v3_events_attrs[] =;

static struct attribute *mcb_pmu_v3_events_attrs[] =;

static struct attribute *mc_pmu_v3_events_attrs[] =;

static const struct attribute_group l3c_pmu_v3_events_attr_group =;

static const struct attribute_group iob_fast_pmu_v3_events_attr_group =;

static const struct attribute_group iob_slow_pmu_v3_events_attr_group =;

static const struct attribute_group mcb_pmu_v3_events_attr_group =;

static const struct attribute_group mc_pmu_v3_events_attr_group =;

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

static DEVICE_ATTR_RO(cpumask);

static struct attribute *xgene_pmu_cpumask_attrs[] =;

static const struct attribute_group pmu_cpumask_attr_group =;

/*
 * Per PMU device attribute groups of PMU v1 and v2
 */
static const struct attribute_group *l3c_pmu_attr_groups[] =;

static const struct attribute_group *iob_pmu_attr_groups[] =;

static const struct attribute_group *mcb_pmu_attr_groups[] =;

static const struct attribute_group *mc_pmu_attr_groups[] =;

/*
 * Per PMU device attribute groups of PMU v3
 */
static const struct attribute_group *l3c_pmu_v3_attr_groups[] =;

static const struct attribute_group *iob_fast_pmu_v3_attr_groups[] =;

static const struct attribute_group *iob_slow_pmu_v3_attr_groups[] =;

static const struct attribute_group *mcb_pmu_v3_attr_groups[] =;

static const struct attribute_group *mc_pmu_v3_attr_groups[] =;

static int get_next_avail_cntr(struct xgene_pmu_dev *pmu_dev)
{}

static void clear_avail_cntr(struct xgene_pmu_dev *pmu_dev, int cntr)
{}

static inline void xgene_pmu_mask_int(struct xgene_pmu *xgene_pmu)
{}

static inline void xgene_pmu_v3_mask_int(struct xgene_pmu *xgene_pmu)
{}

static inline void xgene_pmu_unmask_int(struct xgene_pmu *xgene_pmu)
{}

static inline void xgene_pmu_v3_unmask_int(struct xgene_pmu *xgene_pmu)
{}

static inline u64 xgene_pmu_read_counter32(struct xgene_pmu_dev *pmu_dev,
					   int idx)
{}

static inline u64 xgene_pmu_read_counter64(struct xgene_pmu_dev *pmu_dev,
					   int idx)
{}

static inline void
xgene_pmu_write_counter32(struct xgene_pmu_dev *pmu_dev, int idx, u64 val)
{}

static inline void
xgene_pmu_write_counter64(struct xgene_pmu_dev *pmu_dev, int idx, u64 val)
{}

static inline void
xgene_pmu_write_evttype(struct xgene_pmu_dev *pmu_dev, int idx, u32 val)
{}

static inline void
xgene_pmu_write_agentmsk(struct xgene_pmu_dev *pmu_dev, u32 val)
{}

static inline void
xgene_pmu_v3_write_agentmsk(struct xgene_pmu_dev *pmu_dev, u32 val) {}

static inline void
xgene_pmu_write_agent1msk(struct xgene_pmu_dev *pmu_dev, u32 val)
{}

static inline void
xgene_pmu_v3_write_agent1msk(struct xgene_pmu_dev *pmu_dev, u32 val) {}

static inline void
xgene_pmu_enable_counter(struct xgene_pmu_dev *pmu_dev, int idx)
{}

static inline void
xgene_pmu_disable_counter(struct xgene_pmu_dev *pmu_dev, int idx)
{}

static inline void
xgene_pmu_enable_counter_int(struct xgene_pmu_dev *pmu_dev, int idx)
{}

static inline void
xgene_pmu_disable_counter_int(struct xgene_pmu_dev *pmu_dev, int idx)
{}

static inline void xgene_pmu_reset_counters(struct xgene_pmu_dev *pmu_dev)
{}

static inline void xgene_pmu_start_counters(struct xgene_pmu_dev *pmu_dev)
{}

static inline void xgene_pmu_stop_counters(struct xgene_pmu_dev *pmu_dev)
{}

static void xgene_perf_pmu_enable(struct pmu *pmu)
{}

static void xgene_perf_pmu_disable(struct pmu *pmu)
{}

static int xgene_perf_event_init(struct perf_event *event)
{}

static void xgene_perf_enable_event(struct perf_event *event)
{}

static void xgene_perf_disable_event(struct perf_event *event)
{}

static void xgene_perf_event_set_period(struct perf_event *event)
{}

static void xgene_perf_event_update(struct perf_event *event)
{}

static void xgene_perf_read(struct perf_event *event)
{}

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

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

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

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

static int xgene_init_perf(struct xgene_pmu_dev *pmu_dev, char *name)
{}

static int
xgene_pmu_dev_add(struct xgene_pmu *xgene_pmu, struct xgene_pmu_dev_ctx *ctx)
{}

static void _xgene_pmu_isr(int irq, struct xgene_pmu_dev *pmu_dev)
{}

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

static int acpi_pmu_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu,
					     struct platform_device *pdev)
{}

static int acpi_pmu_v3_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu,
						struct platform_device *pdev)
{}

static int fdt_pmu_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu,
					    struct platform_device *pdev)
{}

static int xgene_pmu_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu,
					      struct platform_device *pdev)
{}

static char *xgene_pmu_dev_name(struct device *dev, u32 type, int id)
{}

#if defined(CONFIG_ACPI)
static struct
xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu,
				       struct acpi_device *adev, u32 type)
{}

static const struct acpi_device_id xgene_pmu_acpi_type_match[] =;

static const struct acpi_device_id *xgene_pmu_acpi_match_type(
					const struct acpi_device_id *ids,
					struct acpi_device *adev)
{}

static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level,
				    void *data, void **return_value)
{}

static int acpi_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu,
				  struct platform_device *pdev)
{}
#else
static int acpi_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu,
				  struct platform_device *pdev)
{
	return 0;
}
#endif

static struct
xgene_pmu_dev_ctx *fdt_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu,
				      struct device_node *np, u32 type)
{}

static int fdt_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu,
				 struct platform_device *pdev)
{}

static int xgene_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu,
				   struct platform_device *pdev)
{}

static const struct xgene_pmu_data xgene_pmu_data =;

static const struct xgene_pmu_data xgene_pmu_v2_data =;

#ifdef CONFIG_ACPI
static const struct xgene_pmu_data xgene_pmu_v3_data =;
#endif

static const struct xgene_pmu_ops xgene_pmu_ops =;

static const struct xgene_pmu_ops xgene_pmu_v3_ops =;

static const struct of_device_id xgene_pmu_of_match[] =;
MODULE_DEVICE_TABLE(of, xgene_pmu_of_match);
#ifdef CONFIG_ACPI
static const struct acpi_device_id xgene_pmu_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, xgene_pmu_acpi_match);
#endif

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

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

static int xgene_pmu_probe(struct platform_device *pdev)
{}

static void
xgene_pmu_dev_cleanup(struct xgene_pmu *xgene_pmu, struct list_head *pmus)
{}

static void xgene_pmu_remove(struct platform_device *pdev)
{}

static struct platform_driver xgene_pmu_driver =;

builtin_platform_driver();