[RFC PATCH] riscv: dts: starfive: jh7110: add PMU event mappings

From: Fengwei Tan

Date: Mon Nov 16 2026 - 11:04:35 EST


Add PMU event mappings for JH7110, which uses the SiFive U74-MC.

Link: https://sifive-china.oss-cn-zhangjiakou.aliyuncs.com/Standard%20Core%20IP/u74mc_core_complex_manual_21G2.pdf
Signed-off-by: Fengwei Tan <tfx2001@xxxxxxxxxxx>
---
Hi all,

I have been working on adding a riscv,pmu node for the StarFive JH7110
SoC, which integrates the SiFive U74-MC.

While reviewing the riscv,pmu DT binding [1], I noticed several event
mappings that appear to be inconsistent with the corresponding SBI event
definitions.

For example, SBI_PMU_HW_CACHE_REFERENCES maps to the Instruction or Data
cache busy events. These appear to count busy cycles rather than cache
references, which could produce misleading results for workloads with a
high cache hit rate.

Similarly, LL_READ_MISS maps to UTLB (Unified TLB) misses, whereas the
last-level cache on this platform is the L2 cache.

To investigate the cache-reference mapping, I wrote a small program that
performs random memory accesses over different working-set sizes and ran
it on a StarFive VisionFive 2 board. The program and results are
available in [2].

The results suggest that raw PMU event 0x1001 counts Data cache busy
cycles rather than cache references. I therefore propose omitting
mappings that do not match the corresponding generic SBI hardware event
semantics from the JH7110 PMU node.

The U74 mapping example was originally contributed by Nikita Shubin [3].
I have CCed Nikita and the RISC-V PMU maintainers for their input on
these mappings and whether the examples in the DT binding and OpenSBI
documentation should also be updated.

Any feedback would be appreciated.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/perf/riscv,pmu.yaml?h=v7.3
[2] https://gist.github.com/tfx2001/65b15deb82c0733eae07a4abd350a5ae
[3] https://lore.kernel.org/all/20220902074104.7082-2-nikita.shubin@xxxxxxxxxxx/
---
arch/riscv/boot/dts/starfive/jh7110.dtsi | 38 ++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)

diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi
index 82ea63f715b0..24b281ee848c 100644
--- a/arch/riscv/boot/dts/starfive/jh7110.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi
@@ -223,6 +223,44 @@ opp-1500000000 {
};
};

+ pmu {
+ compatible = "riscv,pmu";
+ riscv,event-to-mhpmevent =
+ /* SBI_PMU_HW_CACHE_MISSES -> I-cache miss | D-cache miss | MMIO access */
+ <0x00004 0x00000000 0x00302>,
+ /*
+ * SBI_PMU_HW_BRANCH_INSTRUCTIONS ->
+ * Conditional branch | JAL | JALR retired
+ */
+ <0x00005 0x00000000 0x1c000>,
+ /*
+ * SBI_PMU_HW_BRANCH_MISSES ->
+ * Branch direction misprediction | Branch/jump target misprediction
+ */
+ <0x00006 0x00000000 0x06001>,
+ /* L1D_READ_MISS -> Data cache miss or MMIO access */
+ <0x10001 0x00000000 0x00202>,
+ /* L1I_READ_MISS -> Instruction cache miss */
+ <0x10009 0x00000000 0x00102>,
+ /* DTLB_READ_MISS -> Data TLB miss */
+ <0x10019 0x00000000 0x01002>,
+ /* ITLB_READ_MISS -> Instruction TLB miss */
+ <0x10021 0x00000000 0x00802>;
+ riscv,event-to-mhpmcounters =
+ <0x00004 0x00006 0x18>,
+ <0x10001 0x10001 0x18>,
+ <0x10009 0x10009 0x18>,
+ <0x10019 0x10019 0x18>,
+ <0x10021 0x10021 0x18>;
+ riscv,raw-event-to-mhpmcounters =
+ /* Class 0: Instruction Commit Events, variant bits [25:8] */
+ <0x0 0x0 0xffffffff 0xfc0000ff 0x18>,
+ /* Class 1: Microarchitectural Events, variant bits [18:8] */
+ <0x0 0x1 0xffffffff 0xfff800ff 0x18>,
+ /* Class 2: Memory System Events, variant bits [13:8] */
+ <0x0 0x2 0xffffffff 0xffffc0ff 0x18>;
+ };
+
thermal-zones {
cpu-thermal {
polling-delay-passive = <250>;

---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261002-jh7110-pmu-node-98b04e7cc010

Best regards,
--
Fengwei Tan <tfx2001@xxxxxxxxxxx>