Skip to content

Commit 691f5cb

Browse files
committed
riscv: dts: tenstorrent: Add PMU node for Linux perf support
Add a riscv,pmu device tree node with SBI PMU event mappings for the SiFive X280 hardware performance counters. This enables OpenSBI to expose the SBI PMU extension, allowing Linux perf to use the 4 programmable counters (mhpmcounter3-6) across 3 event classes: instruction commit, microarchitectural, and memory system events. Event encodings are derived from the SiFive Tenstorrent X280 MC Manual (21G3.04.00) Table 13, section 3.10.5. Signed-off-by: Michael Neuling <mikey@neuling.org> Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5764d6d commit 691f5cb

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

arch/riscv/boot/dts/tenstorrent/blackhole.dtsi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,45 @@
7777
};
7878
};
7979

80+
pmu {
81+
compatible = "riscv,pmu";
82+
riscv,event-to-mhpmevent =
83+
/* SBI_PMU_HW_CACHE_REFERENCES -> I-cache/ITIM busy | D-cache/DTIM busy */
84+
<0x00003 0x00000000 0x1801>,
85+
/* SBI_PMU_HW_CACHE_MISSES -> I-cache miss | D-cache miss */
86+
<0x00004 0x00000000 0x0302>,
87+
/* SBI_PMU_HW_BRANCH_INSTRUCTIONS -> Conditional branch retired */
88+
<0x00005 0x00000000 0x4000>,
89+
/* SBI_PMU_HW_BRANCH_MISSES -> Branch direction misprediction | Branch/jump target misprediction */
90+
<0x00006 0x00000000 0x6001>,
91+
/* L1D_READ_MISS -> Data cache miss or MMIO access */
92+
<0x10001 0x00000000 0x0202>,
93+
/* L1D_WRITE_ACCESS -> Data cache write-back */
94+
<0x10002 0x00000000 0x0402>,
95+
/* L1I_READ_MISS -> Instruction cache miss */
96+
<0x10009 0x00000000 0x0102>,
97+
/* LL_READ_MISS -> UTLB miss */
98+
<0x10011 0x00000000 0x2002>,
99+
/* DTLB_READ_MISS -> Data TLB miss */
100+
<0x10019 0x00000000 0x1002>,
101+
/* ITLB_READ_MISS -> Instruction TLB miss */
102+
<0x10021 0x00000000 0x0802>;
103+
riscv,event-to-mhpmcounters =
104+
<0x00003 0x00006 0x78>,
105+
<0x10001 0x10002 0x78>,
106+
<0x10009 0x10009 0x78>,
107+
<0x10011 0x10011 0x78>,
108+
<0x10019 0x10019 0x78>,
109+
<0x10021 0x10021 0x78>;
110+
riscv,raw-event-to-mhpmcounters =
111+
/* Class 0: Instruction Commit Events, bits 8-25 variant */
112+
<0x0 0x0 0xffffffff 0xfc0000ff 0x78>,
113+
/* Class 1: Microarchitectural Events, bits 8-18 variant */
114+
<0x0 0x1 0xffffffff 0xfff800ff 0x78>,
115+
/* Class 2: Memory System Events, bits 8-13 variant */
116+
<0x0 0x2 0xffffffff 0xffffc0ff 0x78>;
117+
};
118+
80119
soc {
81120
#address-cells = <2>;
82121
#size-cells = <2>;

0 commit comments

Comments
 (0)