A community experiment testing the high bits of the mhpmevent3 register on SpacemiT K3 reveals which RISC-V privilege-level inhibition fields are actually implemented.
RISC-V defines a set of machine-level counter-event selector CSRs named mhpmevent3 through mhpmevent31. These CSRs control which events increment the corresponding mhpmcounter registers. The high bits of each mhpmevent CSR can act as event filters:
The VSINH and VUINH fields matter for virtualization-aware profiling and for any hypervisor that wants per-VM performance attribution.
The author wrote values that set each filter bit in turn and observed which bits were retained by the hardware. The results posted on the SpacemiT forum are:
This means K3 performance counters can distinguish between M, S, and U privilege levels, but they cannot currently separate counts that occur in a virtualized guest from counts that occur in the host.
If you are writing a hypervisor or a profiling tool for K3, you should not rely on VSINH/VUINH for automatic guest/host filtering. Two practical alternatives remain:
For bare-metal or single-kernel use, the limitation is transparent: M/S/U filtering works as expected.
To test the filter bits yourself from M-mode:
csrr t0, mhpmevent3 li t1, (1 << 63) | (1 << 62) | (1 << 61) | (1 << 60) | (1 << 59) | (1 << 58) csrs mhpmevent3, t1 csrr t2, mhpmevent3 and t2, t2, t1 # bits that read back as 1 are implementedOn K3, expect t2 to contain bits 63 down to 60 set, while bits 59 and 58 remain clear.
The SpacemiT K3 is marketed as a RVA23-compliant AI CPU with eight X100 application cores and eight A100 AI cores. Understanding which privileged-architecture features are silicon-complete helps developers set realistic expectations for porting hypervisors, profilers, and OS-level tooling. At open-riscv.com we cover these micro-architectural details alongside higher-level software porting guides for K1 and K3.
Source: K3 mhpmeventX寄存器的VSINH/VUINH域是否实现