Skip to content

Commit 0a7603a

Browse files
ilkka-koskinenwilldeacon
authored andcommitted
perf: arm_cspmu: Support implementation specific filters
ARM Coresight PMU architecture specification [1] defines PMEVTYPER and PMEVFILT* registers as optional in Chapter 2.1. Moreover, implementers may choose to use PMIMPDEF* registers (offset: 0xD80-> 0xDFF) to filter the events. Add support for those by adding implementation specific filter callback function. [1] https://developer.arm.com/documentation/ihi0091/latest Signed-off-by: Ilkka Koskinen <[email protected]> Reviewed-by: Besar Wicaksono <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 8c28241 commit 0a7603a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

drivers/perf/arm_cspmu/arm_cspmu.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ static unsigned long arm_cspmu_cpuhp_state;
116116

117117
static DEFINE_MUTEX(arm_cspmu_lock);
118118

119+
static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
120+
struct hw_perf_event *hwc, u32 filter);
121+
119122
static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
120123
{
121124
return *(struct acpi_apmt_node **)dev_get_platdata(dev);
@@ -454,6 +457,7 @@ static int arm_cspmu_init_impl_ops(struct arm_cspmu *cspmu)
454457
CHECK_DEFAULT_IMPL_OPS(impl_ops, event_type);
455458
CHECK_DEFAULT_IMPL_OPS(impl_ops, event_filter);
456459
CHECK_DEFAULT_IMPL_OPS(impl_ops, event_attr_is_visible);
460+
CHECK_DEFAULT_IMPL_OPS(impl_ops, set_ev_filter);
457461

458462
return 0;
459463
}
@@ -815,9 +819,9 @@ static inline void arm_cspmu_set_event(struct arm_cspmu *cspmu,
815819
writel(hwc->config, cspmu->base0 + offset);
816820
}
817821

818-
static inline void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
819-
struct hw_perf_event *hwc,
820-
u32 filter)
822+
static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
823+
struct hw_perf_event *hwc,
824+
u32 filter)
821825
{
822826
u32 offset = PMEVFILTR + (4 * hwc->idx);
823827

@@ -849,7 +853,7 @@ static void arm_cspmu_start(struct perf_event *event, int pmu_flags)
849853
arm_cspmu_set_cc_filter(cspmu, filter);
850854
} else {
851855
arm_cspmu_set_event(cspmu, hwc);
852-
arm_cspmu_set_ev_filter(cspmu, hwc, filter);
856+
cspmu->impl.ops.set_ev_filter(cspmu, hwc, filter);
853857
}
854858

855859
hwc->state = 0;

drivers/perf/arm_cspmu/arm_cspmu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ struct arm_cspmu_impl_ops {
104104
u32 (*event_type)(const struct perf_event *event);
105105
/* Decode filter value from configs */
106106
u32 (*event_filter)(const struct perf_event *event);
107+
/* Set event filter */
108+
void (*set_ev_filter)(struct arm_cspmu *cspmu,
109+
struct hw_perf_event *hwc, u32 filter);
107110
/* Hide/show unsupported events */
108111
umode_t (*event_attr_is_visible)(struct kobject *kobj,
109112
struct attribute *attr, int unused);

0 commit comments

Comments
 (0)