Skip to content

Commit 647d5c5

Browse files
ilkka-koskinenwilldeacon
authored andcommitted
perf: arm_cspmu: Support implementation specific validation
Some platforms may use e.g. different filtering mechanism and, thus, may need different way to validate the events and group. Signed-off-by: Ilkka Koskinen <[email protected]> Reviewed-by: Jonathan Cameron <[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 0a7603a commit 647d5c5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

drivers/perf/arm_cspmu/arm_cspmu.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static void arm_cspmu_disable(struct pmu *pmu)
576576
static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
577577
struct perf_event *event)
578578
{
579-
int idx;
579+
int idx, ret;
580580
struct arm_cspmu *cspmu = to_arm_cspmu(event->pmu);
581581

582582
if (supports_cycle_counter(cspmu)) {
@@ -610,6 +610,12 @@ static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
610610
if (idx >= cspmu->num_logical_ctrs)
611611
return -EAGAIN;
612612

613+
if (cspmu->impl.ops.validate_event) {
614+
ret = cspmu->impl.ops.validate_event(cspmu, event);
615+
if (ret)
616+
return ret;
617+
}
618+
613619
set_bit(idx, hw_events->used_ctrs);
614620

615621
return idx;

drivers/perf/arm_cspmu/arm_cspmu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ struct arm_cspmu_impl_ops {
107107
/* Set event filter */
108108
void (*set_ev_filter)(struct arm_cspmu *cspmu,
109109
struct hw_perf_event *hwc, u32 filter);
110+
/* Implementation specific event validation */
111+
int (*validate_event)(struct arm_cspmu *cspmu,
112+
struct perf_event *event);
110113
/* Hide/show unsupported events */
111114
umode_t (*event_attr_is_visible)(struct kobject *kobj,
112115
struct attribute *attr, int unused);

0 commit comments

Comments
 (0)