Skip to content

Commit 312eca9

Browse files
Junhao Hewilldeacon
authored andcommitted
drivers/perf: hisi: Add support for HiSilicon UC PMU driver
On HiSilicon Hip09 platform, there are 4 UC (unified cache) modules on each chip CCL (CPU Cluster). UC is a cache that provides coherence between NUMA and UMA domains. It is located between L2 and Memory System. Many PMU events are supported. Let's support the UC PMU driver using the HiSilicon uncore PMU framework. * rd_req_en : rd_req_en is the abbreviation of read request tracetag enable and allows user to count only read operations. Details are listed in the hisi-pmu document at Documentation/admin-guide/perf/hisi-pmu.rst * srcid_en & srcid: Allows users to filter statistical information based on specific CPU/ICL by srcid. srcid_en depends on rd_req_en being enabled. * uring_channel: Allows users to filter statistical information based on the specified tx request uring channel. uring_channel only supported events: [0x47 ~ 0x59]. Signed-off-by: Junhao He <[email protected]> Reviewed-by: Yicong Yang <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 1a51688 commit 312eca9

File tree

4 files changed

+588
-2
lines changed

4 files changed

+588
-2
lines changed

drivers/perf/hisilicon/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-$(CONFIG_HISI_PMU) += hisi_uncore_pmu.o hisi_uncore_l3c_pmu.o \
33
hisi_uncore_hha_pmu.o hisi_uncore_ddrc_pmu.o hisi_uncore_sllc_pmu.o \
4-
hisi_uncore_pa_pmu.o hisi_uncore_cpa_pmu.o
4+
hisi_uncore_pa_pmu.o hisi_uncore_cpa_pmu.o hisi_uncore_uc_pmu.o
55

66
obj-$(CONFIG_HISI_PCIE_PMU) += hisi_pcie_pmu.o
77
obj-$(CONFIG_HNS3_PMU) += hns3_pmu.o

drivers/perf/hisilicon/hisi_uncore_pmu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
#include "hisi_uncore_pmu.h"
2222

23-
#define HISI_GET_EVENTID(ev) (ev->hw.config_base & 0xff)
2423
#define HISI_MAX_PERIOD(nr) (GENMASK_ULL((nr) - 1, 0))
2524

2625
/*
@@ -226,6 +225,9 @@ int hisi_uncore_pmu_event_init(struct perf_event *event)
226225
hwc->idx = -1;
227226
hwc->config_base = event->attr.config;
228227

228+
if (hisi_pmu->ops->check_filter && hisi_pmu->ops->check_filter(event))
229+
return -EINVAL;
230+
229231
/* Enforce to use the same CPU for all events in this PMU */
230232
event->cpu = hisi_pmu->on_cpu;
231233

drivers/perf/hisilicon/hisi_uncore_pmu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@
4343
return FIELD_GET(GENMASK_ULL(hi, lo), event->attr.config); \
4444
}
4545

46+
#define HISI_GET_EVENTID(ev) (ev->hw.config_base & 0xff)
47+
48+
#define HISI_PMU_EVTYPE_BITS 8
49+
#define HISI_PMU_EVTYPE_SHIFT(idx) ((idx) % 4 * HISI_PMU_EVTYPE_BITS)
50+
4651
struct hisi_pmu;
4752

4853
struct hisi_uncore_ops {
54+
int (*check_filter)(struct perf_event *event);
4955
void (*write_evtype)(struct hisi_pmu *, int, u32);
5056
int (*get_event_idx)(struct perf_event *);
5157
u64 (*read_counter)(struct hisi_pmu *, struct hw_perf_event *);

0 commit comments

Comments
 (0)