[PATCH v4 7/7] perf vendor events riscv:: Add support for spacemit,riscv-iommu HPM aliasing

Lv Zheng
2026-02-05T09:12:03Z

Add JSON HPM event aliases for SpacemiT distributed IOMMU (T100) which is
general and compatible for all SpacemiT RISC-V SoCs.

Signed-off-by: Lv Zheng <lv.zheng@linux.spacemit.com>
Signed-off-by: Jingyu Li <joey.li@spacemit.com>
---
MAINTAINERS | 3 +
.../arch/riscv/spacemit/iommu/sys/ioatc.json | 30 ++++
.../arch/riscv/spacemit/iommu/sys/ioats.json | 163 ++++++++++++++++++
3 files changed, 196 insertions(+)
create mode 100644 tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioatc.json
create mode 100644 tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioats.json

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c50701b6001..4d91f99aa742 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22459,12 +22459,15 @@ K: riscv

RISC-V IOMMU
M: Tomasz Jeznach <tjeznach@rivosinc.com>
+M: Lv Zheng <lv.zheng@linux.spacemit.com>
+M: Jingyu Li <joey.li@spacemit.com>
L: iommu@lists.linux.dev
L: linux-riscv@lists.infradead.org
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
F: Documentation/devicetree/bindings/iommu/riscv,iommu.yaml
F: drivers/iommu/riscv/
+F: tools/perf/pmu-events/arch/riscv/spacemit/iommu/

RISC-V MICROCHIP SUPPORT
M: Conor Dooley <conor.dooley@microchip.com>
diff --git a/tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioatc.json b/tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioatc.json
new file mode 100644
index 000000000000..a16610ba2274
--- /dev/null
+++ b/tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioatc.json
@@ -0,0 +1,30 @@
+[
+ {
+ "EventName": "mtlb_lkp",
+ "EventCode": "0x38",
+ "BriefDescription": "IOATC main TLB (MTLB) lookups",
+ "Unit": "spacemit_ioatc_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "mtlb_mis",
+ "EventCode": "0x39",
+ "BriefDescription": "IOATC main TLB (MTLB) misses",
+ "Unit": "spacemit_ioatc_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "utlb_lkp",
+ "EventCode": "0x3A",
+ "BriefDescription": "IOATC micro TLB (uTLB) lookups",
+ "Unit": "spacemit_ioatc_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "utlb_mis",
+ "EventCode": "0x3B",
+ "BriefDescription": "IOATC micro TLB (uTLB) misses",
+ "Unit": "spacemit_ioatc_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ }
+]
diff --git a/tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioats.json b/tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioats.json
new file mode 100644
index 000000000000..e1fea4e8125c
--- /dev/null
+++ b/tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioats.json
@@ -0,0 +1,163 @@
+[
+ {
+ "EventName": "pri_rq",
+ "EventCode": "0x10",
+ "BriefDescription": "IOATS PCIe page request interface (PRI) requests",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "ptwc_rq",
+ "EventCode": "0x11",
+ "BriefDescription": "IOATS page table walk (PTW) cache requests",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "dtwc_rq",
+ "EventCode": "0x12",
+ "BriefDescription": "IOATS directory table walk (DTW) cache requests",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "dtwc_mis",
+ "EventCode": "0x13",
+ "BriefDescription": "IOATS directory table walk (DTW) cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "ptwc_mis",
+ "EventCode": "0x14",
+ "BriefDescription": "IOATS page table walk (PTW) cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "all_trans_rq",
+ "EventCode": "0x15",
+ "BriefDescription": "IOATS all translation requests",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "dtwc_lkp",
+ "EventCode": "0x20",
+ "BriefDescription": "IOATS directory table walk (DTW) cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s0_ptwc_lkp",
+ "EventCode": "0x28",
+ "BriefDescription": "IOATS s-stage level-0 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s0_ptwc_mis",
+ "EventCode": "0x29",
+ "BriefDescription": "IOATS s-stage level-0 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s1_ptwc_lkp",
+ "EventCode": "0x2A",
+ "BriefDescription": "IOATS s-stage level-1 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s1_ptwc_mis",
+ "EventCode": "0x2B",
+ "BriefDescription": "IOATS s-stage level-1 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s2_ptwc_lkp",
+ "EventCode": "0x2C",
+ "BriefDescription": "IOATS s-stage level-2 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s2_ptwc_mis",
+ "EventCode": "0x2D",
+ "BriefDescription": "IOATS s-stage level-2 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s3_ptwc_lkp",
+ "EventCode": "0x2E",
+ "BriefDescription": "IOATS s-stage level-3 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "s3_ptwc_mis",
+ "EventCode": "0x2F",
+ "BriefDescription": "IOATS s-stage level-3 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g0_ptwc_lkp",
+ "EventCode": "0x30",
+ "BriefDescription": "IOATS g-stage level-0 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g0_ptwc_mis",
+ "EventCode": "0x31",
+ "BriefDescription": "IOATS g-stage level-0 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g1_ptwc_lkp",
+ "EventCode": "0x32",
+ "BriefDescription": "IOATS g-stage level-1 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g1_ptwc_mis",
+ "EventCode": "0x33",
+ "BriefDescription": "IOATS g-stage level-1 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g2_ptwc_lkp",
+ "EventCode": "0x34",
+ "BriefDescription": "IOATS g-stage level-2 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g2_ptwc_mis",
+ "EventCode": "0x35",
+ "BriefDescription": "IOATS g-stage level-2 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g3_ptwc_lkp",
+ "EventCode": "0x36",
+ "BriefDescription": "IOATS g-stage level-3 PTW cache lookups",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ },
+ {
+ "EventName": "g3_ptwc_mis",
+ "EventCode": "0x37",
+ "BriefDescription": "IOATS g-stage level-3 PTW cache misses",
+ "Unit": "spacemit_ioats_hpm",
+ "Compat": "spacemit,riscv-iommu"
+ }
+]
--
2.43.0