Skip to content

Commit a28f3cb

Browse files
rmurphy-armwilldeacon
authored andcommitted
perf/arm_cspmu: Add PMEVFILT2R support
Architecturally we have two filters for each regular event counter, so add generic support for the second one too. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: James Clark <james.clark@linaro.org> Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com> Link: https://lore.kernel.org/r/b11be3f23a72bc27088b115099c8fe865b70babc.1741190362.git.robin.murphy@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 6de0298 commit a28f3cb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/perf/arm_cspmu/arm_cspmu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ arm_cspmu_event_attr_is_visible(struct kobject *kobj,
183183
static struct attribute *arm_cspmu_format_attrs[] = {
184184
ARM_CSPMU_FORMAT_EVENT_ATTR,
185185
ARM_CSPMU_FORMAT_FILTER_ATTR,
186+
ARM_CSPMU_FORMAT_FILTER2_ATTR,
186187
NULL,
187188
};
188189

@@ -767,9 +768,11 @@ static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
767768
const struct perf_event *event)
768769
{
769770
u32 filter = event->attr.config1 & ARM_CSPMU_FILTER_MASK;
770-
u32 offset = PMEVFILTR + (4 * hwc->idx);
771+
u32 filter2 = event->attr.config2 & ARM_CSPMU_FILTER_MASK;
772+
u32 offset = 4 * event->hw.idx;
771773

772-
writel(filter, cspmu->base0 + offset);
774+
writel(filter, cspmu->base0 + PMEVFILTR + offset);
775+
writel(filter2, cspmu->base0 + PMEVFILT2R + offset);
773776
}
774777

775778
static void arm_cspmu_set_cc_filter(struct arm_cspmu *cspmu,

drivers/perf/arm_cspmu/arm_cspmu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
/* Default filter format */
4848
#define ARM_CSPMU_FORMAT_FILTER_ATTR \
4949
ARM_CSPMU_FORMAT_ATTR(filter, "config1:0-31")
50+
#define ARM_CSPMU_FORMAT_FILTER2_ATTR \
51+
ARM_CSPMU_FORMAT_ATTR(filter2, "config2:0-31")
5052

5153
/*
5254
* This is the default event number for cycle count, if supported, since the
@@ -72,6 +74,7 @@
7274
#define PMEVCNTR_HI 0x4
7375
#define PMEVTYPER 0x400
7476
#define PMCCFILTR 0x47C
77+
#define PMEVFILT2R 0x800
7578
#define PMEVFILTR 0xA00
7679
#define PMCNTENSET 0xC00
7780
#define PMCNTENCLR 0xC20

0 commit comments

Comments
 (0)