[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250218092000.41641-6-yangyicong@huawei.com>
Date: Tue, 18 Feb 2025 17:19:56 +0800
From: Yicong Yang <yangyicong@...wei.com>
To: <will@...nel.org>, <mark.rutland@....com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
CC: <jonathan.cameron@...wei.com>, <prime.zeng@...ilicon.com>,
<linuxarm@...wei.com>, <yangyicong@...ilicon.com>, <wangyushan12@...wei.com>
Subject: [PATCH 5/9] drivers/perf: hisi: Add support for HiSilicon SLLC v3 PMU driver
From: Junhao He <hejunhao3@...wei.com>
SLLC v3 PMU has the following changes compared to previous version:
a) update the register layout
b) update the definition of SRCID_CTRL and TGTID_CTRL registers.
To be compatible with v2, we use maximum width (11 bits)
and mask the extra length for themselves.
c) remove latency events (driver does not need to be adapted).
SLLC v3 PMU is identified with HID HISI0264.
Signed-off-by: Junhao He <hejunhao3@...wei.com>
Signed-off-by: Yicong Yang <yangyicong@...ilicon.com>
---
drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c
index c1fd60d397c3..dce7195320f2 100644
--- a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c
@@ -28,6 +28,18 @@
#define SLLC_VERSION 0x1cf0
#define SLLC_EVENT_CNT0_L 0x1d00
+/* SLLC registers definition in v3 */
+#define SLLC_V3_INT_MASK 0x6834
+#define SLLC_V3_INT_STATUS 0x6838
+#define SLLC_V3_INT_CLEAR 0x683c
+#define SLLC_V3_VERSION 0x6c00
+#define SLLC_V3_PERF_CTRL 0x6d00
+#define SLLC_V3_SRCID_CTRL 0x6d04
+#define SLLC_V3_TGTID_CTRL 0x6d08
+#define SLLC_V3_EVENT_CTRL 0x6d14
+#define SLLC_V3_EVENT_TYPE0 0x6d18
+#define SLLC_V3_EVENT_CNT0_L 0x6e00
+
#define SLLC_EVTYPE_MASK 0xff
#define SLLC_PERF_CTRL_EN BIT(0)
#define SLLC_FILT_EN BIT(1)
@@ -40,6 +52,12 @@
#define SLLC_TGTID_MAX_MSK GENMASK(22, 12)
#define SLLC_SRCID_CMD_MSK GENMASK(11, 1)
#define SLLC_SRCID_MSK_MSK GENMASK(22, 12)
+
+#define SLLC_V3_TGTID_MIN_MSK GENMASK(9, 1)
+#define SLLC_V3_TGTID_MAX_MSK GENMASK(18, 10)
+#define SLLC_V3_SRCID_CMD_MSK GENMASK(9, 1)
+#define SLLC_V3_SRCID_MSK_MSK GENMASK(18, 10)
+
#define SLLC_NR_EVENTS 0x80
#define SLLC_EVENT_CNTn(cnt0, n) ((cnt0) + (n) * 8)
#define SLLC_FIRST_BIT(_mask) (find_first_bit((const unsigned long *)&(_mask), 32))
@@ -405,6 +423,27 @@ static const struct hisi_pmu_dev_info hisi_sllc_v2 = {
.private = &hisi_sllc_v2_pmu_regs,
};
+static struct hisi_sllc_pmu_regs hisi_sllc_v3_pmu_regs = {
+ .int_mask = SLLC_V3_INT_MASK,
+ .int_clear = SLLC_V3_INT_CLEAR,
+ .int_status = SLLC_V3_INT_STATUS,
+ .perf_ctrl = SLLC_V3_PERF_CTRL,
+ .srcid_ctrl = SLLC_V3_SRCID_CTRL,
+ .srcid_mask_msk = SLLC_V3_SRCID_MSK_MSK,
+ .srcid_cmd_msk = SLLC_V3_SRCID_CMD_MSK,
+ .tgtid_ctrl = SLLC_V3_TGTID_CTRL,
+ .tgtid_max_msk = SLLC_V3_TGTID_MAX_MSK,
+ .tgtid_min_msk = SLLC_V3_TGTID_MIN_MSK,
+ .event_ctrl = SLLC_V3_EVENT_CTRL,
+ .event_type0 = SLLC_V3_EVENT_TYPE0,
+ .version = SLLC_V3_VERSION,
+ .event_cnt0 = SLLC_V3_EVENT_CNT0_L,
+};
+
+static const struct hisi_pmu_dev_info hisi_sllc_v3 = {
+ .private = &hisi_sllc_v3_pmu_regs,
+};
+
static const struct hisi_uncore_ops hisi_uncore_sllc_ops = {
.write_evtype = hisi_sllc_pmu_write_evtype,
.get_event_idx = hisi_uncore_pmu_get_event_idx,
@@ -498,6 +537,7 @@ static void hisi_sllc_pmu_remove(struct platform_device *pdev)
static const struct acpi_device_id hisi_sllc_pmu_acpi_match[] = {
{ "HISI0263", (kernel_ulong_t)&hisi_sllc_v2 },
+ { "HISI0264", (kernel_ulong_t)&hisi_sllc_v3 },
{}
};
MODULE_DEVICE_TABLE(acpi, hisi_sllc_pmu_acpi_match);
--
2.24.0
Powered by blists - more mailing lists