From 9f42a499f9c817c79dda47774a121a1b3dcd47e3 Mon Sep 17 00:00:00 2001
From: Qi Liu <liuqi115@huawei.com>
Date: Wed, 30 Nov 2022 19:01:39 +0800
Subject: [PATCH 190/201] perf jevents: Add support for HiSilicon SLLC PMU
 aliasing

driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I63VF5

--------------------------------------------------------------------------

Add support for HiSilicon SLLC PMU aliasing on Hip09 platform.

Signed-off-by: Qi Liu <liuqi115@huawei.com>
Signed-off-by: Junhao He <hejunhao3@huawei.com>
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>

  Conflicts:
	tools/perf/pmu-events/jevents.c
---
 .../hisilicon/hip09/sys/uncore-sllc.json      | 134 ++++++++++++++++++
 tools/perf/pmu-events/jevents.c               |   1 +
 2 files changed, 135 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-sllc.json

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-sllc.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-sllc.json
new file mode 100644
index 000000000000..3f62cb0c791d
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip09/sys/uncore-sllc.json
@@ -0,0 +1,134 @@
+[
+    {
+	"EventCode": "0x09",
+	"EventName": "sllc_cycles",
+	"BriefDescription": "Count of SLLC cycles",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventName": "cycles",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x20",
+	"EventName": "rx_req_sum",
+	"BriefDescription": "total cycles SLLC taken to receive requests",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x21",
+	"EventName": "rx_data_sum",
+	"BriefDescription": "total cycles SLLC taken to receive data",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x24",
+	"EventName": "tx_req_sum",
+	"BriefDescription": "total cycles SLLC taken to transmit requests",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x25",
+	"EventName": "tx_data_sum",
+	"BriefDescription": "total cycles SLLC taken to transmit data",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x30",
+	"EventName": "rx_req",
+	"BriefDescription": "Count of the requests received by SLLC",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x31",
+	"EventName": "rx_data",
+	"BriefDescription": "Count of the data received by SLLC",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x34",
+	"EventName": "tx_req",
+	"BriefDescription": "Count of the requests transmitted by SLLC",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"EventCode": "0x35",
+	"EventName": "tx_data",
+	"BriefDescription": "Count of the data transmitted by SLLC",
+	"Compat": "0x00000030",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"MetricExpr": "rx_req_sum / rx_req",
+	"BriefDescription": "Average latency of SLLC receive requests(cycles)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	"MetricName": "sllc_rx_req_lat",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"MetricExpr": "rx_data_sum / rx_data",
+	"BriefDescription": "Average latency of SLLC receive data(cycles)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	"MetricName": "sllc_rx_data_lat",
+	"Unit": "hisi_sccl,sllc"
+   },
+   {
+	"MetricExpr": "tx_req_sum / tx_req",
+	"BriefDescription": "Average latency of SLLC transmit requests(cycles)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	"MetricName": "sllc_tx_req_lat",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"MetricExpr": "tx_data_sum / tx_data",
+	"BriefDescription": "Average latency of SLLC transmit data(cycles)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	"MetricName": "sllc_tx_data_lat",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"MetricExpr": "rx_req * 332 / duration_time",
+	"BriefDescription": "Average bandwidth of SLLC receive requests(bits/s)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	 "MetricName": "sllc_rx_req_bw",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"MetricExpr": "rx_data * 332 / duration_time",
+	"BriefDescription": "Average bandwidth of SLLC receive data(bits/s)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	 "MetricName": "sllc_rx_data_bw",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"MetricExpr": "tx_req * 332 / duration_time",
+	"BriefDescription": "Average bandwidth of SLLC transmit requests(bits/s)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	 "MetricName": "sllc_tx_req_bw",
+	"Unit": "hisi_sccl,sllc"
+    },
+    {
+	"MetricExpr": "tx_data * 332 / duration_time",
+	"BriefDescription": "Average bandwidth of SLLC transmit data(bits/s)",
+	"Compat": "0x00000030",
+	"MetricGroup": "SLLC",
+	 "MetricName": "sllc_tx_data_bw",
+	"Unit": "hisi_sccl,sllc"
+    }
+]
\ No newline at end of file
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index b330c244f076..26275543840e 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -283,6 +283,7 @@ static struct map {
 	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
 	{ "hisi_sccl,hha", "hisi_sccl,hha" },
 	{ "hisi_sccl,l3c", "hisi_sccl,l3c" },
+	{ "hisi_sccl,sllc", "hisi_sccl,sllc" },
 	{}
 };
 
-- 
2.27.0

