[RFC PATCH v5 15/38] perf: arm_spe_pmu: Move struct arm_spe_pmu to a separate header file
Alexandru Elisei
alexandru.elisei at arm.com
Wed Nov 17 07:38:19 PST 2021
KVM will soon want to make use of struct arm_spe_pmu, move it to a separate
header where it will be easily accessible. This is a straightforward move
and functionality should not be impacted.
CC: Will Deacon <will at kernel.org>
Signed-off-by: Alexandru Elisei <alexandru.elisei at arm.com>
---
drivers/perf/arm_spe_pmu.c | 29 +------------------
include/linux/perf/arm_spe_pmu.h | 49 ++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 28 deletions(-)
create mode 100644 include/linux/perf/arm_spe_pmu.h
diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index d44bcc29d99c..ccb92c182527 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -27,7 +27,7 @@
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/perf_event.h>
-#include <linux/perf/arm_pmu.h>
+#include <linux/perf/arm_spe_pmu.h>
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/slab.h>
@@ -47,33 +47,6 @@ struct arm_spe_pmu_buf {
void *base;
};
-struct arm_spe_pmu {
- struct pmu pmu;
- struct platform_device *pdev;
- cpumask_t supported_cpus;
- struct hlist_node hotplug_node;
-
- int irq; /* PPI */
- u16 pmsver;
- u16 min_period;
- u16 counter_sz;
-
-#define SPE_PMU_FEAT_FILT_EVT (1UL << 0)
-#define SPE_PMU_FEAT_FILT_TYP (1UL << 1)
-#define SPE_PMU_FEAT_FILT_LAT (1UL << 2)
-#define SPE_PMU_FEAT_ARCH_INST (1UL << 3)
-#define SPE_PMU_FEAT_LDS (1UL << 4)
-#define SPE_PMU_FEAT_ERND (1UL << 5)
-#define SPE_PMU_FEAT_DEV_PROBED (1UL << 63)
- u64 features;
-
- u16 max_record_sz;
- u16 align;
- struct perf_output_handle __percpu *handle;
-};
-
-#define to_spe_pmu(p) (container_of(p, struct arm_spe_pmu, pmu))
-
/* Convert a free-running index from perf into an SPE buffer offset */
#define PERF_IDX2OFF(idx, buf) ((idx) % ((buf)->nr_pages << PAGE_SHIFT))
diff --git a/include/linux/perf/arm_spe_pmu.h b/include/linux/perf/arm_spe_pmu.h
new file mode 100644
index 000000000000..7711e59c5727
--- /dev/null
+++ b/include/linux/perf/arm_spe_pmu.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Split from from drivers/perf/arm_spe_pmu.c.
+ *
+ * Copyright (C) 2021 ARM Limited
+ */
+
+#ifndef __ARM_SPE_PMU_H__
+#define __ARM_SPE_PMU_H__
+
+#include <linux/cpumask.h>
+#include <linux/perf_event.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+
+#ifdef CONFIG_ARM_SPE_PMU
+
+struct arm_spe_pmu {
+ struct pmu pmu;
+ struct platform_device *pdev;
+ cpumask_t supported_cpus;
+ struct hlist_node hotplug_node;
+
+ int irq; /* PPI */
+ u16 pmsver;
+ u16 min_period;
+ u16 counter_sz;
+
+#define SPE_PMU_FEAT_FILT_EVT (1UL << 0)
+#define SPE_PMU_FEAT_FILT_TYP (1UL << 1)
+#define SPE_PMU_FEAT_FILT_LAT (1UL << 2)
+#define SPE_PMU_FEAT_ARCH_INST (1UL << 3)
+#define SPE_PMU_FEAT_LDS (1UL << 4)
+#define SPE_PMU_FEAT_ERND (1UL << 5)
+#define SPE_PMU_FEAT_DEV_PROBED (1UL << 63)
+ u64 features;
+
+ u16 max_record_sz;
+ u16 align;
+ struct perf_output_handle __percpu *handle;
+};
+
+#define to_spe_pmu(p) (container_of(p, struct arm_spe_pmu, pmu))
+
+#define ARMV8_SPE_PDEV_NAME "arm,spe-v1"
+
+#endif /* CONFIG_ARM_SPE_PMU */
+
+#endif /* __ARM_SPE_PMU_H__ */
--
2.33.1
More information about the linux-arm-kernel
mailing list