[PATCH 21/24] perf tools: riscv: making gtrace PMU listable

Zane Leung liangzhen at linux.spacemit.com
Thu Oct 22 20:15:02 PDT 2026


This commit enhances the RISC-V performance tools by allowing the
gtrace PMU to be listed and selected.

Signed-off-by: Zane Leung <liangzhen at linux.spacemit.com>
---
 tools/perf/arch/riscv/util/Build |  1 +
 tools/perf/arch/riscv/util/pmu.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 tools/perf/arch/riscv/util/pmu.c

diff --git a/tools/perf/arch/riscv/util/Build b/tools/perf/arch/riscv/util/Build
index e07d5525ece6..57991c43e8f0 100644
--- a/tools/perf/arch/riscv/util/Build
+++ b/tools/perf/arch/riscv/util/Build
@@ -1,2 +1,3 @@
 perf-util-y += header.o
 perf-util-y += auxtrace.o
+perf-util-y += pmu.o
diff --git a/tools/perf/arch/riscv/util/pmu.c b/tools/perf/arch/riscv/util/pmu.c
new file mode 100644
index 000000000000..8cb8c82182ac
--- /dev/null
+++ b/tools/perf/arch/riscv/util/pmu.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2026 Spacemit Technologies, Inc.
+ */
+
+#include <string.h>
+#include <linux/perf_event.h>
+
+#include "../../../util/pmu.h"
+
+#define GTRACE_PMU_NAME "gtrace"
+
+void perf_pmu__arch_init(struct perf_pmu *pmu)
+{
+	if (!strcmp(pmu->name, GTRACE_PMU_NAME)) {
+		pmu->auxtrace = true;
+		pmu->selectable = true;
+	}
+}
-- 
2.34.1




More information about the linux-riscv mailing list